Jump to content

Installing applications under Win7 (UAC)


Recommended Posts

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...

Link to comment

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 by jdunham
Link to comment

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...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.