I am using the following VBScript code to extract a setup file,
Set oShell = CreateObject ("WScript.Shell")
oShell.Run "cmd.exe ""C:\Program Files\NewFolder\setup.exe"" /extract:""C:\Program Files\NewFolder"" "
This works fine when done manually in the command-prompt. But in VBScript it only opens the command-prompt and nothing happens.
I also tried this,
Set oShell = CreateObject ("WScript.Shell")
oShell.Run "%comspec% /K ""C:\Program Files\NewFolder\setup.exe"" /extract:""C:\Program Files\NewFolder"" "
This way, it says that,
'C:\Program' is not recognized as as internal or external command, operable program or batch file.
I also tried these,
Set oShell = CreateObject ("WScript.Shell")
oShell.Run "cmd.exe /c ""C:\Program Files\NewFolder\setup.exe"" /extract:""C:\Program Files\NewFolder"" "
Set oShell = CreateObject ("WScript.Shell")
oShell.Exec "cmd.exe ""C:\Program Files\NewFolder\setup.exe"" /extract:""C:\Program Files\NewFolder"" "
It does not work.
What is the issue here please?
cmd /ccmd /c,cmd.exe /c, or%comspec% /cshould work just fine. Use/kinstead of/cto prevent the CMD window from closing, so you can inspect the command output. The error message you received when you tried that suggests that contrary to what you claimed you did not put the path tosetup.exein quotes./kand I get the message which says'C:\Program' is not recognized as as internal or external command, operable program or batch file.setup.exe(upload it to dropbox or something) so we will test this ourselves?