PDA

View Full Version : Environment variable



Pastisam
10-24-2003, 05:21 AM
Hello,

I create an environment variable in Installscript. My project is a std project in DEV 7.

// set variable ALC_TOMCAT_INSTDIR
szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

nResult = RegDBSetKeyValueEx(szKey, "ALC_TOMCAT_INSTDIR", REGDB_STRING, szTomcatHome, nvSize);
if (nResult < 0) then
MessageBox("Failed to Set Environment Variable", WARNING);
else
// Flush the NT registry to all applications.
szEnv = "Environment";
pEnv = &szEnv;
SendMessage (HWND_BROADCAST, WM_WININICHANGE, 0, pEnv );
endif;


szSetupName = "Bin";
szCommand = "tomcatInstall.bat";
szCommand = INSTALLDIR ^ szSetupName ^ szCommand;
LongPathToQuote(szCommand, TRUE);
LongPathToQuote(szSetupName, TRUE);
ChangeDirectory(INSTALLDIR ^ szSetupName);
szParameters = "";
nResult = LaunchApp(szCommand, szParameters);


The pb is the environment variable is set but not update for windows applications. And the file.bat which use it doesn't work fine.

What can I do to resolve this pb?

Best regards!!

dgbach
10-24-2003, 11:23 AM
This might work:
szCommand = "cmd /c " + szCommand;

-Dennis