I'm trying to set some environment variables using 'SET' so they are set locally and not on the system level, which happens when using SETX. However the variables are not appearing to be passed into the final command being executed (.exe) How can i set local env variables and pass the modified env into the exe?
@echo off
setlocal
:: Assign all Path variables
SET STARTUP="%~dp0startup"
set ADSK_3DSMAX_STARTUPSCRIPTS_ADDON_DIR=%STARTUP%
echo ADSK_3DSMAX_STARTUPSCRIPTS_ADDON_DIR %STARTUP%
start /d "%PROGRAMW6432%\Autodesk\3ds Max 2022\" 3dsmax.exe /i
endlocal
exit
CodePudding user response:
The solution could be at first setting the environment variables in the batch file using set and then running the executable directly (without start). If it works, tell me!
CodePudding user response:
Use set "var1=data"
for setting string values - this avoids problems caused by trailing spaces.
If you use your syntax, you execute
set ADSK_3DSMAX_STARTUPSCRIPTS_ADDON_DIR=""%~dp0startup""
which is probably not what you expect.