Please lend some help, I'm a beginner with batch file and vbscript. I would be grateful if you could help me solve my problem.
Given:
a:
@echo off
pushd "C:\Program Files\appName" && popd
IF ERRORLEVEL 1 EXIT 0
pushd "C:\Program Files\appName"
IF EXIST application.exe GOTO Installed
popd
EXIT 1
:Installed
EXIT 2
b:
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objFile = objFSO.OpenTextFile(listFile, 1)
dim sh , res
objName = objFSO.GetTempName
objTempFile = objName
'---- Sample Code 0 ----------------------'
'set sh = WScript.CreateObject("WScript.shell")
'res = sh.run("fileFullPath",0,true)
'wScript.echo res
'----Sample Code 1 ---------------'
'set sh = WScript.CreateObject("WScript.shell")
'res = sh.run("fileName",0,true)
'wScript.echo res
'---- Sample Code 2 ---------------------
'set sh = WScript.CreateObject("WScript.shell")
'res = sh.run("cmd /c fileName",0,true)
'wScript.echo res
'---- Sample Code 3 ---------------------
'set sh = WScript.CreateObject("WScript.shell")
'res = sh.run("cmd /c fileFullPath",0,true)
'wScript.echo res
The b:sample code 1 & 2 works fine with me but I need the sample code 0 & 3. with sample code 1 I always get an error : The system cannot find the file selected ,while with sample code 3 it would only return 0 when failed then 1 when successful, and not the returned value of the batch file.
Thanks,
exit /binstead of justexit.exit /bbefore, but it still won't work. Considering that the file I'm going to search does exists. With sample code 1 & 2 it gives the value of 2. While with Sample Code 3, specified the full path of the batch file I keep on having 1 as my output. Is there another way around for me to have same output as sample code 1 & 2 given that I have to access the batch file by it's full path. Thanks.