I developed a workaround for WinXP legacy software (code/project not available, its very old!) that allows it to run in Windows 10. The workaround essentially consists of an Inno script setup that: 1) Runs the software's XP installer (prompts for admin), and 2) Runs BATCH file to copy files "comctl32.dll/.ocx" to the Windows/SysWOW64
The intent is to run this installer silently on client PCs, and installation/copy of files are fine, but my main problem is that the programs installed must be "Run As Admin" at least once, in order to work subsequently for local admin & standard users.
So currently my silent installer / batch does everything fine, but I still have to right-click all those programs and do Run As Admin once (which defeats the purpose of creating that installer/script if I have to do this with all my machines!). So I'm thinking that I should add to my Batch file to run the program (as admin), then force-close.
Any suggestions on how I can script this? FYI, I considered "nircmd" but I think our scanners flagged it and it was gone from my PC before I could try anything with it. ^_^
The user accounts of these PCs are always set to "local admin", but not any admin level higher than that. I really don't know whats going on in the background when the programs start with Run as Admin (did I mention no access to code/project? ^_^)
Here is the Batch file I wrote that runs after that XP installer. This essentially does some of that extra workaround file copy and tries to run the program, taskkill after... Do you think this is headed in the right direction?
ECHO
TITLE "C Win10 Installer"
COPY "c:\temp\Cwin10\Cicon.ico" "C:\Program Files (x86)\ABC\Cfolder\C.ico"
COPY "c:\temp\Cwin10\comctl32.dll" "C:\Program Files (x86)\ABC\Cfolder\comctl32.dll"
COPY "c:\temp\Cwin10\comctl32.ocx" "C:\Program Files (x86)\ABC\Cfolder\\comctl32.ocx"
COPY "c:\temp\Cwin10\CDM20830_Setup.exe" "C:\Program Files (x86)\ABC\Cfolder"
XCOPY "c:\temp\Cwin10\ref" "C:\Program Files (x86)\ABC\Cfolder\ref" /i /s
COPY "C:\Program Files (x86)\ABC\Cfolder\Strip.ocx" "C:\Program Files (x86)\ABC\Cfolder\app\Strip.ocx"
RUNAS /env /user:Administrator "C:\Program Files (x86)\ABC\Cfolder\app\App.exe"
TASKKILL /F /im App.exe
DEL "C:\temp\Cwin10\Cicon.ico"
set folder="C:\temp\Cwin10"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)
Also FYI, I do have this added to the top of my batch How can I auto-elevate my batch file, so that it requests from UAC administrator rights if required?
UPDATE: Modified to register the DLLs in INNO instead, here's where I am currently. I am using the Shortcut workaround to run the application as Admin once, so subsequent runs will work... however I want to TASKKILL so it runs for a quick sec and closes immediately, then runs the next two applications.
However what it really is doing is running the application and does nothing. When I close, then TASKKILL comes and cannot find the running process. Any suggestions to RUN then TASKKILL in one second?
ECHO
TITLE "C Win10 Installer"
"C:\temp\Cwin10\BexeShortcut.lnk"
TASKKILL /F /im B.exe
"C:\temp\Cwin10\EexeShortcut.lnk"
TASKKILL /F /im E.exe
"C:\temp\Cwin10\Cexe.lnk"
TASKKILL /F /im Cexe.exe
set folder="C:\temp\Cwin10"
cd /d %folder%
for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q)