setx problems
Hi I'm trying to use setx to change an environment variable, it’s acting up when I try to assign a path with space to the Environment Variable (I had the “†around the value but it’s still not working)
Here is the command I'm using
setx MYCDO "d:\My CDOs\" -m
But by doing this it sets the variable as a user environment variable like this,
d:\My CDOs" -m
I've looked at a few manuals online but I can't seem to get it to work,
http://www.amirkamal.com/tools/setx_d.htm
When you take away the backslash it works fine, can anyone help?
Here is the command I'm using
setx MYCDO "d:\My CDOs\" -m
But by doing this it sets the variable as a user environment variable like this,
d:\My CDOs" -m
I've looked at a few manuals online but I can't seem to get it to work,
http://www.amirkamal.com/tools/setx_d.htm
When you take away the backslash it works fine, can anyone help?
0 Comments
[ + ] Show comments
Answers (2)
Please log in to answer
Posted by:
weberik
13 years ago
Posted by:
shenmue232
13 years ago
I managed to get it working in the end using the registry mode in setx, here's the example,
Registry Mode Syntax
setx variable -k hive\key\...\value [-m]
Where:
variable
is the name of the environmental variable to be set.
-k
specifies that the variable is set based on information from a registry key.
hive\key\...\value
is the registry path to the value for the environmental variable. For example: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName
-m
specifies that the value being set is in the system environment. The default is the user environment.
I added a reference registry key into the registry with the value I wanted, I then pointed setx to that location in the registry.
Thanks for all your help weberik
Registry Mode Syntax
setx variable -k hive\key\...\value [-m]
Where:
variable
is the name of the environmental variable to be set.
-k
specifies that the variable is set based on information from a registry key.
hive\key\...\value
is the registry path to the value for the environmental variable. For example: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation\StandardName
-m
specifies that the value being set is in the system environment. The default is the user environment.
I added a reference registry key into the registry with the value I wanted, I then pointed setx to that location in the registry.
Thanks for all your help weberik
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.