I have this "test.bat" to call "myprogram.exe"
Note: test.bat is fixed by Noodles
"Cmd /c ""myprogram.exe"" & Dir & set ppbPath=myprogram & set pathHold=%path% & set path=%ppbPath%;%path% & ppbS create ""myprogram"" ShowPct 1 No Crawl 1 SetCrawlTime 1 300000 & ppbS settext 1 ""Start myprogram... Be pacient"" & ppbS shutdown"
I used this "test.vbs" to call "test.bat"
On Error Resume next
mensaje = MSGBOX ("Start Test PC", vbOKCancel, "Test PC")
If mensaje = vbOK Then
SCRIPT = "test.bat"
Set objShell = CreateObject("Wscript.Shell")
strPath = Wscript.ScriptFullName
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPath)
strFolder = objFSO.GetParentFolderName(objFile)
NewPath = objFSO.BuildPath(strFolder, SCRIPT)
set objshell = createobject("wscript.shell")
objshell.run NewPath,vbhide
Else
Set objshell = createobject("Wscript.shell")
rmensaje = objshell.popup("Cancel Test",3,"Test PC",16)
End If
As you can see, they are too many scripts to call a simple program.
What i want is suppress "test.bat" and include its code into "test.vbs", for use only one script to call myprogram.exe
cmd /c start "" c:\windows\notepad & Dir & Set Fred=Cat & Set F & Pause. Because you aren't typing you must usestartto start programs if you don't want to wait for the program to exit.Callis used for starting batch files. Normally to start a program you only specify the exe. See my answer here on the three ways to start programs stackoverflow.com/questions/31820569/… – Noodles 1 hour agoOn Error GoTo 0as the last line. The error context is destroyed immediately after that line, so it does nothing but make code slower. Your last three lines in the batch file also do nothing. They run and then the environment they change gets destroyed, so it does nothing but make code slower. – Noodles 1 hour agocallto start a program. Use the program's name (to wait for program to exit) orstart(start the program and don't wait) depending on the behaviour desired."Cmd /c ""myprogram.exe"" & Dir & set ppbPath=myprogram & set pathHold=%path% & set path=%ppbPath%;%path% & ppbS create ""myprogram"" ShowPct 1 No Crawl 1 SetCrawlTime 1 300000 & ppbS settext 1 ""Start myprogram... Be pacient"" & ppbS shutdown"A set of opening and closing quotes for VBS. Quotes within the string are escaped so""means a single"within the string. – Noodles 42 mins agocmd /c set fred=cat & Echo %Fred%and with special mode (seecmd /?andsetlocal /?)cmd /v:on /c set fred=cat & echo !fred!. – Noodles 33 mins ago