computing
  • 3

Creating VBS With Batch File

  • 3

Hi, I’m trying to create a Windows Script to run a batch file [without that ugly black screen =P] using a Batch File [I know most people do the opposite but w/e] but Command Prompt just won’t accept it [except for the last line], I get this message:

“The system cannot find the path specified.
‘Chr’ is not recognized as an internet or external command, operable program or batch file.”

Here’s the code of the batch file:

@ECHO OFF
ECHO Set WshShell = CreateObject(“WScript.Shell”) > vbs.vbs
ECHO WshShell.Run chr(34) & “C:\sandbox\test.bat” & Chr(34), 0 >> vbs.vbs
ECHO Set WshShell = Nothing >> vbs.vbs
exit

Share

1 Answer

  1. the ampersands are ampersanding. You’ll need to escape
    them:
    ECHO WshShell.Run chr(34) ^& “C:\sandbox\test.bat” ^& Chr(34), 0 >> vbs.vbs
    • 0