Robert
Robert

Reputation: 135

Windows Script Host - there is no file extension in (variable)

I have this issue with my VBS script. I'm getting an error of "There is no file extension in ""

The issue is I know how to launch the script by using double quotation marks, as this:

shell "wscript ""C:\Users\First LastName\test1.vbs"" "

How do I pass to wscript as a variable for the path to the vbs file that has spaces in it? For example, variable is myFile = "c:\Users\John Rodgers\test1.vbs"

How do I call script to run the vbs?

I've tried to no avail:

Shell "wscript " & myFile

Upvotes: 0

Views: 1453

Answers (1)

Tim Williams
Tim Williams

Reputation: 166755

shell Replace("wscript ""FILE"" ","FILE", myFile)

or

shell "wscript """ & myFile & """ "

Upvotes: 1

Related Questions