I need help converting a batch file to VBScript!
If possible, can anyone PLEASE lead me in the right direction with converting this batch code to VBS? Thanks!
--------------------------------------------------------
@ECHO OFF
ECHO Removing the previous SQL Native Client installation.
MsiExec.exe /x{D411E9C9-CE62-4DBF-9D92-4CB22B750ED5} /passive /norestart /log "C:\Temp\Synchro\SQL_Remove.log"
CD C:\Temp\Synchro
ECHO Installing the Synchro 9 suite prerequisites...
msiexec /i 1_sqlncli_64.msi /passive IACCEPTSQLNCLILICENSETERMS=YES /log "C:\Temp\Synchro\SQL_Native.log"
msiexec /i 2_SqlLocaLDB_64.msi /passive IACCEPTSQLLOCALDBLICENSETERMS=YES /log "C:\Temp\Synchro\SQL_LocalDB.log"
msiexec /i 3_SqlCmdLnUtils_64.msi /passive /log "C:\Temp\Synchro\SQL_CMD_Utils.log"
ECHO Installing the Synchro 9 suite...
Start /wait /HIGH setup.exe /S
del /f "C:\Users\Public\Desktop\Synchro 9.lnk"
del /f "C:\Users\Public\Desktop\SimTraffic 9.lnk"
del /f "C:\Users\Public\Desktop\3DViewer 9.lnk"
del /f "C:\Users\Public\Desktop\TripGen 2014.lnk"
del /f "C:\Users\Public\Desktop\Warrants 9.lnk"
del /f "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\3DViewer 9.lnk"
del /f "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\SimTraffic 9.lnk"
del /f "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\Synchro 9.lnk"
del /f "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\TripGen 2014.lnk"
del /f "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\Warrants 9.lnk"
ECHO The installation process has completed successfully.
-
Grab yourself a copy of the Windows Scripting Host download which comes with a help file that has dozens of code examples you can adapt to your requirements - EdT 9 years ago
Answers (5)
I'm a bit of a purist so would abandon the calls to MSIExec and use the Windows Installer Object Model to do the uninstalling but that is a whole different level of scripting.
First of all, *why* do you want to convert the command file to VBS?
Second, there are a quadzillion examples of VBSes which execute a program or programs out there that could easily be adapted. A good place to start would be www.computerperformance.com.
The golden rule of scripting (which your command file ignores) is to error-trap everything. Never - EVER - assume that each line of code will execute successfully. Build robustness in from Day One.