1

I'm using setx to set a Environment variable.

My command is

setx -m PSR_NLC_FILE "%PROGRAMFILES(x86)%\Test Folder\" 

But when i check on my system is set to

C:\Program Files (x86)\Test Folder" 

The path is not found because of the quote.

When i use this command for another Environment variable is set correct without quote.

setx -m PSR_NLC_FILE "%PROGRAMFILES(x86)%\Test Folder\File.lic" C:\Program Files (x86)\Test Folder\File.lic 

Can someone explain to me what i'm doing wrong?

2 Answers 2

2

Look here

Some commands (e.g. REG and FINDSTR) use the standard escape character of \ (as used by C, Python, SQL, bash and many other languages.) The \ escape can cause problems with quoted directory paths that contain a trailing backslash because the closing quote " at the end of the line will be escaped \".

In your case another backslash should do the trick

setx -m PSR_NLC_FILE "%PROGRAMFILES(x86)%\Test Folder\\"

1

Don't provide the trailing backslash in your command. It's not necessary for the path name to be interpreted correctly.

The modified command would look like this:

setx -m PSR_NLC_FILE "%PROGRAMFILES(x86)%\Test Folder" 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.