سؤال

SETX works fine in Windows 7 32 Bit but doesn't work on 64 bit.

Here is my .bat file content :

setx PATH "%%ProgramFiles%\MySQL\MySQL Server 5.5\bin%;"

Doesn't get any error but doesn't work.

But when I try this:

setx PATH "%C:\Program Files\MySQL\MySQL Server 5.5\bin\%;"

It works fine! Why?

هل كانت مفيدة؟

المحلول

In the first code you are using two percents at the start of the string and also one percent at the end, obviously that's incorrect like the start/end percents of the second example too.

Also what your two codes are trying to do is to replace the entire Path, and that will 'cause problems (you will cannot find the path for any legitime Windows command of application like for example "cmd.exe"), so if you want to add a new entry to the current path then do this:

setx PATH "%PATH%;%ProgramFiles%\MySQL\MySQL Server 5.5\bin"

PS: Works in both win7 architectures.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top