Dr. Thomas C. King
Dr. Thomas C. King

Reputation: 1044

In a batch file, how do I execute a .vbs from the same directory? How do I take parameters?

Very simple question I am sure.

I have a file called ACLReader.vbs which I have written. I want a user to be able to run a batch file

I also want the batch to take a parameter and pass it to ACLReader.vbs instead of using testText.txt (as the user would if execute ACLReader.vbs from the command line)

This is what I have from googling but it doesn't work:

%~d0
cd %~p0
cscript ACLReader.vbs testText.txt

Upvotes: 2

Views: 9674

Answers (2)

sakra
sakra

Reputation: 65981

To make the CD command in your original script work, you have to change it in the following way:

cd /D "%~dp0"
cscript ACLReader.vbs %*

Upvotes: 1

Bob Vale
Bob Vale

Reputation: 18474

have you tried

cscript ACLReader.vbs %*

Upvotes: 2

Related Questions