How do I create a Batch file to change an exe installer to Win XP SP3 compatibility mode and launch installer

This is all I could get to. I also was trying to call this batch file from the source batch file. Don’t ask my why I’m using the CD. That doesn’t work but basically I’m trying to set the compatiblity mode for all EXE’s in that directory. I am copying the files locally because I have not figured out how to run them from the server:

Here is: !Set_Comp_Mode.bat

cd "C:\Temp\Pivotal 6.0.12 HF2\5-Reinstall After Pivotal 6 - Pivotal 5.9r4\"
pause
for %x in ("*.exe") do reg.exe Add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "%~fx" /d "WINXPSP3"

I’m also trying to “Run As Admin” all I have to do is prompt for the credentials but maybe there is a better way?

Here is the mother batch:

@ECHO off
cls
:start
ECHO.
ECHO 1-PREREQ6.0.10
ECHO 2-PivotalPackagedClient6.0.12
ECHO 3-PackagedClientSP12_HotFix2
ECHO 4-ExeFolderFix
ECHO 5-Reinstall After Pivotal 6 - Pivotal 5.9r4
ECHO 6-Pivotal 5.9r5 HB NoC
ECHO 7-Exit
set /p choice=Menu:
rem if not '%choice%'=='' set choice=%choice:~0;1% ( don`t use this command, because it takes only first digit in the case you type more digits. After that for example choice 23455666 is choice 2 and you get "bye"
rem if not '%choice%'=='' ECHO "%choice%" is not valid please try again
if '%choice%'=='1' goto Step1
if '%choice%'=='2' goto Step2
if '%choice%'=='3' goto Step3
if '%choice%'=='4' goto Step4
if '%choice%'=='5' goto Step5
if '%choice%'=='6' goto Step6
if '%choice%'=='7' goto end
ECHO.
goto start

:Step1
ECHO ****1-PREREQ6.0.10****
runas /noprofile /savecred /user:Administrator "%~dp01-PREREQ6.0.10\setup.exe" 

goto start

:Step2
ECHO ****2-PivotalPackagedClient6.0.12****
runas /noprofile /savecred /user:Administrator "%~dp02-PivotalPackagedClient6.0.12\ManualInstall.bat"
goto start

Leave a Comment