Command line switch test script
Sometimes, when i'm re-packaging an app, i run into problems and start to google / looking here for simular issues. And sometimes, i run into a commandline to install the app i'm repacking silently, ergo, there wasn't any need to repackage the app @ the first place. I decided to write a script in VB that executes a number of commandlines based on input. But i can't get the execution of the actual commandline to work. The script thusfar:
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim ProgName
On Error Resume Next
Msgbox "remember to copy this script to program dir!"
ProgName=Inputbox("Provide the executable name:")
If ProgName = "" Then Wscript.Quit
WSHShell.Run "ProgName /s"
Msgbox "Trying /s commandline.."
WSHShell.Run "ProgName /silent"
Msgbox "Trying /silent commandline.."
WSHShell.Run "ProgName /verysilent"
Msgbox "Trying /verysilent commandline.."
WSHShell.Run "ProgName /q"
Msgbox "Trying /q commandline.."
WSHShell.Run "ProgName /quiet"
Msgbox "Trying /quiet commandline.."
WSHShell.Run "ProgName /veryquiet"
Msgbox "Trying /veryquiet commandline.."
WSHShell.Run "ProgName /u"
Msgbox "Trying /u commandline.."
WSHShell.Run "ProgName /unattended"
Msgbox "Trying /unattended commandline.."
WSHShell.Run "ProgName -s"
Msgbox "Trying -s commandline.."
Wscript.Quit(0)
The idea of the script is that, when an installation starts off with setup.exe, the user should copy the script to the folder with setup.exe, starting it off, then entering setup.exe in the messagebox and the script would try a number of "silent" switches. The script does ask for the input, but it doens't seem to run the input + the switch afterwards. I think the problems' in the "WSHShell.Run "ProgName /s"" line.. Tried omitting the quotes and using brackets, but no luck.. Any suggestions/comments would be greatly appreciated.. TIA and kind regards!
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim ProgName
On Error Resume Next
Msgbox "remember to copy this script to program dir!"
ProgName=Inputbox("Provide the executable name:")
If ProgName = "" Then Wscript.Quit
WSHShell.Run "ProgName /s"
Msgbox "Trying /s commandline.."
WSHShell.Run "ProgName /silent"
Msgbox "Trying /silent commandline.."
WSHShell.Run "ProgName /verysilent"
Msgbox "Trying /verysilent commandline.."
WSHShell.Run "ProgName /q"
Msgbox "Trying /q commandline.."
WSHShell.Run "ProgName /quiet"
Msgbox "Trying /quiet commandline.."
WSHShell.Run "ProgName /veryquiet"
Msgbox "Trying /veryquiet commandline.."
WSHShell.Run "ProgName /u"
Msgbox "Trying /u commandline.."
WSHShell.Run "ProgName /unattended"
Msgbox "Trying /unattended commandline.."
WSHShell.Run "ProgName -s"
Msgbox "Trying -s commandline.."
Wscript.Quit(0)
The idea of the script is that, when an installation starts off with setup.exe, the user should copy the script to the folder with setup.exe, starting it off, then entering setup.exe in the messagebox and the script would try a number of "silent" switches. The script does ask for the input, but it doens't seem to run the input + the switch afterwards. I think the problems' in the "WSHShell.Run "ProgName /s"" line.. Tried omitting the quotes and using brackets, but no luck.. Any suggestions/comments would be greatly appreciated.. TIA and kind regards!
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
WiseUser
19 years ago
Btw, a nice feature of VBScript is that you can drag and drop files onto them and then read their path from within the script.
Thus you wouldn't have to copy the script to the application folder or type in the exe file's name.
ProgName = Wscript.Arguments(0)
If ProgName = "" Then Wscript.Quit
WSHShell.Run Chr(34) & ProgName & Chr(34) & " /s"
Msgbox "Trying /s commandline.."
Hope this helps.[;)]
Thus you wouldn't have to copy the script to the application folder or type in the exe file's name.
ProgName = Wscript.Arguments(0)
If ProgName = "" Then Wscript.Quit
WSHShell.Run Chr(34) & ProgName & Chr(34) & " /s"
Msgbox "Trying /s commandline.."
Hope this helps.[;)]
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.