cscript

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+ ...

execute caspol from within vbscript

Hi all, I'd like to call caspol from within a script inside a custom action in an msi (setup project). I'd prefer a standard msi to ClickOnce, because with a standard msi I can install drivers & associate filetypes with our application whereas with ClickOnce I can't. When I execute the caspol command from the command line it succeeds, ...

svn dump fails with WScript.Shell

var WshShell = new ActiveXObject("WScript.Shell"); var commandLine = "svnadmin dump " + repoFullPath + " > " + repoName + ".dumpfile"; WshShell.Exec(commandLine) I am trying to run above cscript in windows but it seems like, it's doing nothing. It doesn't create the dump file. Any mistake that I am doing? Thanks, ...

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 aim is to have our development version of a dll found before a pre-existing older one in %WINDIR% etc. without having to write a program j...

Creating a Windows checkbox in a VBScript that will be executed by cscript.exe

If I have a VBScript like... inputControl1 = InputBox("Hello World") WScript.Quit How can a check box be created in there rather then the InputBox? I know VBScript itself does not have a checkbox control like the InputBox, but is there some library I can use to do something like the following? inputControl1 = CreateObject("library.c...

Is there a way to run a command line command from JScript (not javascript) in Windows Scripting Host (WSH) cscript.exe ?

I'm writing a JScript program which is run in cscript.exe. Is it possible to run a commnad line command from within the script. It would really make the job easy, as I can run certain commands instead of writing more code in jscript to do the same thing. For example: In order to wait for a keypress for 10 seconds, I could straight awa...

How to change cscript.exe to wscript.exe execution for all VBScript files?

After installing the new server, I am facing an issue. I have lot of .vbs files, all need to run in wscript, reason, I use all those command like WScript.Echo "hello" I want to be able to see the output when I double click the VBScript file. But when I right click on the vbs file, I see console, I want to change the default to Windows...

How can you get STDIN input to a WSH script using cscript.exe?

I'm trying to use WSH in place of DOS/Batch files. Thanks for the input! ...

How do I call a vbs script from Inno Setup script with cscript and vbs arguments?

The following is an entry I'm using to attempt to create a virtual directory in IIS 6: [Run] Filename: {tmp}\cscript.exe mkvirtdir.vbs; Parameters: "-c LocalHost -w ""Default Web Site"" -v ""ectUpload_Server""", {app},""ectUpload_Server"""; WorkingDir: {tmp}; Flags: skipifdoesntexist; StatusMsg: Creating IIS Virtual Directory" I get t...

How to set Authentication Methods in IIS programattically

We are working on automating the deployment of some IIS applications. I've used cscript.exe inside a windows batch file to create the web app and such. There are however a few settings currently done by hand that I need to automate. Namely, if you look at the properties of an app, under Directory Structure -> Authentication and access...

Batch file conversion to vbscript

I need to convert a batch file to vbscript but am unfamiliar with both. If I can understand what is going on in the batch file I can work out the vbscript easy enough. Problem is the batch file runs a few cscript commands which is supposed to have a syntax of cscript [script name] [host options] [script arguments] However whomever ...

Is it possible to enumerate the field names of an ADO Recordset with JavaScript and cscript?

I am writing some scripts to run on old Windows NT machines. I am planning on using the command-based script host (cscript) to execute them. The script are querying some SQL data and I want to retrieve the field names from the RecordSet, but it doesn't seem to work. This is the code I'm using: rs.open(query, conn, adOpenForwardOnly, ad...

CScript and VBS to Remove Line Breaks from Text File

I have a batch file running which spits out a text/html file. The batch file is causing some line breaks in the text file, which do not translate very well in opening the file in an email. I have been trying to read up on CScript to create a vbs script that can read the text file and strip out the line breaks but have had no luck. Any...

Script to download file and rename according to date on Windows Vista machine?

Hi, I need to daily run a script that will download a file from a fixed location and save it on my computer with an appropriate filename-YYYYMMDD-HHSS.ext timestamp. I need a historical record of what that file was at that particular time. I can manually check and see what the changes were, so compairson not needed. (I was looking for ...

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

...

cscript - print output on same line on console?

If I have a cscript that outputs lines tothe screen, how do I avoid the "line feed" after each print? Example: for a = 1 to 10 WScript.Print "." REM (do something) next The expected output should be: .......... Not: . . . . . . . . . . In the past I've used to print the "up arrow character" ASCII code. Can this be done i...

passing arguments to javascript through cscript on the command line

I have a small command line javascript routine that I usually run from the command line using cscript in windows. I'd like to be able to pass in arguments hopefully along the lines of... %:>cscript doSomethingToFile.js FileInQuestion.txt Any insight on how to do this? Thanks much. ...

Set MSMQ permissions using VBScript (via Nant)

We are using Nant to deploy an application and need to create some MSMQ Queues during the process. We use Nant/psexec/cscript to call a VBScript to create the queue itself but we also need to set the permissions. Can this be done programmatically? I am aware of Setting permissions on a MSMQ queue in script however that question asks ...

how do you include an external script using javascript in windows script host cscript.exe

how do you include an external script using javascript in windows script host cscript.exe ...

Getting rid of the printer spooling dialog box during programmatic printing

The following is the CScript script I use for the programmatic printing of a Word document. var err = 0; var app = WScript.CreateObject("Word.Application"); try { var filename = WScript.Arguments(0); var enc = (filename.toLowerCase().indexOf(".txt") >= 0) || (filename.toLowerCase().indexOf(".htm")) ? 65001 : 1252; var objDoc = app...