Skip to main content

Questions tagged [wsh]

For questions relating to Windows Script Host (WSH), a language-independent scripting host for the Windows operating system. It allows scripts to be run from both the graphical Windows desktop (via WScript.exe) and the command prompt (via CScript.exe).

wsh
717 votes
24 answers
1.1m views

"rm -rf" equivalent for Windows?

I need a way to recursively delete a folder and its children. Is there a prebuilt tool for this, or do I need to write one? DEL /S doesn't delete directories. DELTREE was removed from Windows 2000+
FlySwat's user avatar
  • 175k
135 votes
10 answers
136k views

Windows XP or later Windows: How can I run a batch file in the background with no window displayed?

I know I have already answered a similar question (Running Batch File in background when windows boots up), but this time I need to launch a batch: from another batch, without any console window ...
VonC's user avatar
  • 1.3m
92 votes
1 answer
96k views

Difference between wscript and cscript

What is the difference between cscript and wscript? Which is best for doing Telnet and FTP automation in Windows?
rashok's user avatar
  • 13.2k
91 votes
5 answers
302k views

Can I pass an argument to a VBScript (vbs file launched with cscript)?

I have this script saved in "test.vbs": Set FSO = CreateObject("Scripting.FileSystemObject") Set File = FSO.OpenTextFile(workFolder &"\test.txt", 2, True) File.Write "testing" File.Close Set File = ...
Peter's user avatar
  • 1,573
38 votes
4 answers
66k views

How do I set the timezone from command line ?

How can I set the timezone in Windows from command line or from a batch file? Do I need to use powershell or cscript?
Eduard Florinescu's user avatar
36 votes
3 answers
125k views

how can I check if a file exists?

I want to check to see if a file exists and if it does, I want to open it and read the 1st line, If the file doesn't exist or if the file has no contents then I want to fail silently without letting ...
Cocoa Dev's user avatar
  • 9,511
33 votes
6 answers
119k views

Base64 Encode String in VBScript

I have a web service load driver that's a Windows Script File (WSF), that includes some VBScript and JavaScript files. My web service requires that the incoming message is base64 encoded. I currently ...
Patrick Cuff's user avatar
  • 29.3k
26 votes
2 answers
66k views

How can I download a file with batch file without using any external tools?

First to clarify this question is aimed to HTTP(s) download .For FTP may be I'll ask (and answer) another question. Here are some similar questions - but I want to be more precise . Besides ...
npocmaka's user avatar
  • 56.7k
23 votes
5 answers
80k views

Can I pick up environment variables in vbscript WSH script?

Is is possible to read system environment variables in a Windows Scripting Host (WSH) VBS script? (I am writing a VBScript using Windows Scripting Host for task for a Cruise Control and want to pick ...
mike nelson's user avatar
  • 21.9k
23 votes
6 answers
56k views

Script to make content entry into a text file

How do I include some "text" into a .txt format file without opening the same via a script on Windows?
user358485's user avatar
23 votes
3 answers
9k views

What is the ProgId or CLSID for IE9's Javascript engine (code-named "Chakra")

Using .NET, I can write an app that hosts a scripting engine that complies with Microsoft's IActiveScript conventions. This includes JScript and VBScript from Microsoft, and also PerlScript, ...
Cheeso's user avatar
  • 192k
22 votes
3 answers
70k views

Is it possible to add a directory to DLL search path from a batch file or cmd script?

MSDN says that the function SetDllDirectory() can be used to insert a directory into the DLL Search Path. Can this function be accessed from a batch file or cmd script, perhaps using via cscript? The ...
20 votes
5 answers
36k views

Force a VBS to run using cscript instead of wscript

What is the stackoverflow approved (and hence correct) method to force a VBS to run using cscript instead of wscript - irrespective of what the user tries? A quick Google search shows plenty of ...
Richard's user avatar
  • 1,481
20 votes
2 answers
14k views

Should we use CScript.exe or WScript.exe to run .vbs files? [duplicate]

VBScript (.vbs) files can be run using either cscript.exe or wscript.exe. What's the difference between these two options?
Pacerier's user avatar
  • 88.6k
19 votes
3 answers
41k views

What is the difference between CreateObject and Wscript.CreateObject?

Does anyone know the reasoning behind having the option using: Wscript.CreateObject("some.object") and CreateObject("some.object") within VBScript? when I find documentation or examples that use ...
mrTomahawk's user avatar

15 30 50 per page
1
2 3 4 5
72