VBScript fails to execute when called from within WiseScript
Created: 24 Apr 2013 • Updated: 02 May 2013 | 5 comments
This issue has been solved. See solution.
I am trying to call a .CMD file from within a vbscript. Following is the code.
Dim WshShell, strPathName, cmdFileName
Set WshShell = CreateObject("WScript.Shell")
strPathName = Left (wscript.ScriptFullName,Instrrev (wscript.ScriptFullName,"\"))
cmdFileName = strPathName & "silentclient.cmd"
Set WshShell = Nothing
Note : the vbscript and the .CMD file reside at the same location.
Now, when I execute the vbscript by double-clicking on it, the .CMD file gets executed as expected.
However, when I call the vbscript from within a wise script using the "Execute program" command to call %SYS32%\wscript.exe (or cscript.exe), and pass the full path of the vbs file as the command line argument, the WshShell.RUN cmdFileName,0 line does not get executed and the script exits without any error prompts.
Thanks in advance.