I recently discovered that set and setx behave completely different when it comes to escape characters.
Example:
set bob="C:\Program Files (x86)\Notepad++\notepad++.exe"
setx bobx "C:\Program Files (x86)\Notepad++\notepad++.exe"
right? Seems correct, but one will work, while the other wont.
Executing %bob% will launch notepad while %bobx% will error out.
why? Well, apparently
setx bobx "C:\Program Files (x86)\Notepad++\notepad++.exe" equates to using set with no quotes - like so:
set bob=C:\Program Files (x86)\Notepad++\notepad++.exe
What we find, is that setx has it's own wonky magic, and if we wanted to escape a character, we use \ ... which doesn't come up in documentation. Awesome, yea?
setx bobx "\"C:\Program Files (x86)\Notepad++\notepad++.exe"\" which would equate to
..set bob="C:\Program Files (x86)\Notepad++\notepad++.exe"
now %bobx% will start notepad++
free plug for one of the 10^10 blogs that caught it - http://batcheero.blogspot.com/2008/03/setx-escape-character.html
..set bob="C:\Program Files (x86)\Notepad++\notepad++.exe"
now %bobx% will start notepad++
free plug for one of the 10^10 blogs that caught it - http://batcheero.blogspot.com/2008/03/setx-escape-character.html