1

Hi I'm trying to run this script but it's giving me 'Exepected end of statement.

wscript.exe "C:\test.vbs" "your_file.bat"

I'm putting the above in run.vbs, and I'm trying execute run.vbs from withing windows by double clicking the file. I get 'Expected end of statement' error

in the invis.vbs there is :

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Earlier I got this solution from : Running Batch File in background when windows boots up

Please advise.

Community
  • 1
  • 1
user726720
  • 1,127
  • 7
  • 25
  • 59

2 Answers2

2

The wscript.exe "c:\test.vbs" "your_file.bat" you can't put in run.vbs. It's batch script. Put that in a run.bat....

or

Modify run.vbs to look like:

Set objShell = CreateObject("WScript.Shell")
objShell.run("wscript C:\test.vbs your_file.bat")
apollosoftware.org
  • 12,161
  • 4
  • 48
  • 69
2

This

wscript.exe "C:\test.vbs" "your_file.bat"

is meant for textual input in the command prompt/console/dos box window. If you put it into a .VBS file, you (deserve and) get a syntax error. This:

CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

looks like valid VBScript code (whether in invis.vbs or test.vbs).

Trying to run a .VBS by double click is a bad idea if you plan to pass parameters to the script.

So you should start afresh and think about/describe clearly what you want to achieve.

Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96