John Lokanis Posted June 29, 2010 Report Share Posted June 29, 2010 I think I have figured out how to get my LabVIEW built exe to always run as administrator (embed a custom manifest file) but now I need to run some post install batch files as administrator as well. Does anyone know how to get the LabVIEW installer to do this? I also need to mark some other batch files I install to only run as administrator. Perhaps there is a way to do this within the main batch file that I run post install. It would also be nice if the resulting installer was backward compatible with WinXP. But the Program Files (x86) thing is really getting in the way of that... Quote Link to comment
jdunham Posted June 30, 2010 Report Share Posted June 30, 2010 (edited) I think I have figured out how to get my LabVIEW built exe to always run as administrator (embed a custom manifest file) but now I need to run some post install batch files as administrator as well. Does anyone know how to get the LabVIEW installer to do this? I also need to mark some other batch files I install to only run as administrator. Perhaps there is a way to do this within the main batch file that I run post install. It would also be nice if the resulting installer was backward compatible with WinXP. But the Program Files (x86) thing is really getting in the way of that... John, we use elevate.exe to run some batch files during our installs: http://www.wintellec...e-in-vista.aspx the batch files also check the windows version and the existence of "ProgramFiles(x86)" which exists as an environment variable if you are running 64-bit windows @ECHO OFFPUSHD %~dp0REM "FIND" will not be found without its path if you have cygwin installedVER | %WINDIR%\SYSTEM32\FIND " 6."IF NOT ERRORLEVEL 1 ( InstallationSupport\Elevate.exe CMD "" /C "CD /D %CD% && InstallationSupport\InstallAll.bat" ) ELSE ( @ECHO This installer is for Windows Vista and higher only! PAUSE)POPD This code finds our install folder and puts it in an environment variable so that other batch files can use it. @echo offIF "x%ProgramFiles(x86)%x" == "xx" ( REM CASE 32-bit REM Quote marks are added here to make it consistent with 64-bit case SET ShotSpotterProgramDir="%ProgramFiles%\ShotSpotter" ) ELSE ( REM CASE 64-bit REM quotation marks are unfortunate but totally necessary, or else the if statement cannot be parsed. REM this did not seem to be a problem in XP, but windows 7 chokes on it. REM the added quote marks end up in the environment variable, but everything seems to work OK. REM even the quotes end up in the middle of paths built using this variable. REM if the additional elements of your filepath have no spaces you will be all set. SET ShotSpotterProgramDir="%ProgramFiles(x86)%\ShotSpotter\" )REM enable next line for debugging:REM @echo ShotSpotter Location = %ShotSpotterProgramDir% - Jason Edited June 30, 2010 by jdunham Quote Link to comment
Mads Posted June 30, 2010 Report Share Posted June 30, 2010 If you set the installer to run the batch files they will run with the same access level as the installer, at least that's what my experience is so far. We use batch files to install our app as a service. If run on their own they have to be run by the Administrator...but that is no issue when they are run by the installer. I think I have figured out how to get my LabVIEW built exe to always run as administrator (embed a custom manifest file) but now I need to run some post install batch files as administrator as well. Does anyone know how to get the LabVIEW installer to do this? I also need to mark some other batch files I install to only run as administrator. Perhaps there is a way to do this within the main batch file that I run post install. It would also be nice if the resulting installer was backward compatible with WinXP. But the Program Files (x86) thing is really getting in the way of that... Quote Link to comment
John Lokanis Posted June 30, 2010 Author Report Share Posted June 30, 2010 Thanks guys! I will give this a try. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.