My Windows 7 system path looks something like this:
Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;....
I am trying to set a new user variable based on whether its defined or not already:
IF NOT DEFINED DEFAULTP (
echo Setting DEFAULTP to backup the system PATH
SETX DEFAULTP=%PATH%
)
When I try to do this, I get an error that looks like this:
\NVIDIA was unexpected at this time.
Can anyone guess why?
Try this, adding double quotes around %PATH%
to become "%PATH%"
:
IF NOT DEFINED DEFAULTP (
echo Setting DEFAULTP to backup the system PATH
SETX DEFAULTP "%PATH%"
)
Edit: Running setx /?
gives these examples:
Examples:
SETX MACHINE COMPAQ
SETX MACHINE "COMPAQ COMPUTER" /M
SETX MYPATH "%PATH%"
SETX MYPATH ~PATH~