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.

 

1 Comment   [ + ] Show Comment

Comments

  • 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
Please log in to comment

Answers

0
A better conversion would be to power-shell  it is rapidly replacing vb-script and it has a lot more power

Write-host "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

Write-host "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"

write-host "Installing the Synchro 9 suite..."

& Start /wait /HIGH setup.exe /S

Remove-Item -Path "C:\Users\Public\Desktop\Synchro 9.lnk" -Force
Remove-Item -Path  "C:\Users\Public\Desktop\SimTraffic 9.lnk" -Force
Remove-Item -Path "C:\Users\Public\Desktop\3DViewer 9.lnk" -Force
Remove-Item -Path  "C:\Users\Public\Desktop\TripGen 2014.lnk"  -Force
Remove-Item -Path  "C:\Users\Public\Desktop\Warrants 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\3DViewer 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\SimTraffic 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\Synchro 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\TripGen 2014.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\Warrants 9.lnk"  -Force

write-host "The installation process has completed successfully."
Answered 03/25/2015 by: dcookBE
Senior White Belt

Please log in to comment
0
convert it to power shell instead 
Write-host "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

Write-host "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"

write-host "Installing the Synchro 9 suite..."

& Start /wait /HIGH setup.exe /S

Remove-Item -Path "C:\Users\Public\Desktop\Synchro 9.lnk" -Force
Remove-Item -Path  "C:\Users\Public\Desktop\SimTraffic 9.lnk" -Force
Remove-Item -Path "C:\Users\Public\Desktop\3DViewer 9.lnk" -Force
Remove-Item -Path  "C:\Users\Public\Desktop\TripGen 2014.lnk"  -Force
Remove-Item -Path  "C:\Users\Public\Desktop\Warrants 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\3DViewer 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\SimTraffic 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\Synchro 9.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\TripGen 2014.lnk"  -Force
Remove-Item -Path  "%ProgramData%\Microsoft\Windows\Start Menu\Programs\Trafficware\Warrants 9.lnk"  -Force

write-host "The installation process has completed successfully."

Answered 03/25/2015 by: dcookBE
Senior White Belt

Please log in to comment
0
 Convert to power shell instead 

Answered 03/25/2015 by: dcookBE
Senior White Belt

Please log in to comment
0

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.

Answered 03/20/2015 by: VBScab
Red Belt

Please log in to comment
0
https://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.85).aspx

Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell")
oShell.run "cmd /K CD C:\ & Dir"
Set oShell = Nothing

Answered 03/20/2015 by: aragorn.2003
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share