Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Can my script be improved? trying to learn more scripting

$
0
0

Hi all,

I am fairly new to all this scripting stuff and i have been tasked at work to uninstall an application and then install the new version. Unfortuantely for various reasons, this is a **** programmed piece of software. I cant just run the uninstaller as it leaves files on the harddrive that needs to be gone and things in the registry which also has to be removed.

It is pretty self explanatory my script, but would like to know if it could be improved. the worst bit so far is the method to do wait on. so wait for the uninstall to complete before the install part starts.

@ECHO OFF

IF EXIST c:\removemag_computer.txt GOTO END

IF EXIST c:\maginus\live\maginus.ini COPY c:\maginus\live\maginus.ini C:\

MsiExec.exe /x {1A93D21E-7408-4309-BD8A-EFDE1D1F0F1E} /qn
MsiExec.exe /x {5A7B021A-F07A-49B6-8007-371DED5000FC} /qn

ping 1.1.1.1 -n 1 -w 60000 > nul

rmdir C:\Maginus /s /q

reg delete HKLM\Software\Maginus /f

GOTO main

:modkey
  REG DELETE HKU\%1\Software\Maginus /f
  REG DELETE HKU\%1\Software\Mancos /f
GOTO end

:main
  FOR /F "tokens=2* delims=\" %%a IN ('REG QUERY HKU ^|Findstr /R "S-1-5-[0-9]*-[0-9-]*$"') DO CALL :modkey %%a
  copy /y nul c:\removemag_computer.txt
  GOTO install

:install
  ping 1.1.1.1 -n 1 -w 60000 > nul
  msiexec /i "\\dnsarrow\dfs\gpo\MaginusV8\MaginusV8.msi" /qn
  GOTO end

:END

ExIT



Regards
ronnie.jorgensen systems engineer
My blog



Viewing all articles
Browse latest Browse all 15028

Trending Articles