Solved Creating invisible vbs file from batch

October 22, 2011 at 12:53:34
Specs: Windows Vista
When the batch file is ran, I want it to create an invis.vbs file with the following:
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

I've tried:

ECHO CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False >invis.vbs

and

echo. 2>invis.vbs
ECHO CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False >>invis.vbs

Both create the invis.vbs file, but they don't have the text inside.


See More: Creating invisible vbs file from batch

Report •


#1
October 22, 2011 at 13:10:59
✔ Best Answer
The ampersand character & has special meaning in the command shell, try escaping it so that it is echoed as a literal:


ECHO CreateObject("Wscript.Shell").Run """" ^& WScript.Arguments(0) ^& """", 0, False >invis.vbs


Please come back & tell us if your problem is resolved.


Report •

#2
October 22, 2011 at 13:20:23
ty! Worked. Didn't think that the &s mattered.

Report •

Related Solutions


Ask Question