Guest francoisbrochu@yahoo.com Posted July 19, 2007 Posted July 19, 2007 as part of my logonscript I like to change some of the setting for user so I use a batch file like this test.bat: if NOT "%USERNAME%" == "Administrator" ( set windozPref=hello echo %windozPref% world ) 1- run test.bat you expect "hello world" to be echoed, but no it echo world 2- run set you will see windozPref=hello 3- run test.bat one more time it will echo "hello world" 4- run set windozPref= set will reveal it's unset 5- for fun add this line to test.bat "set windozPref=foo" before the IF statment test.bat now look like this set windozPref=foo if NOT "%USERNAME%" == "Administrator" ( set windozPref=hello echo %windozPref% world ) 6- run test.bat it will echo "foo world" 7- run it again it still echo "foo world" run set, look "windozPref=hello" I really don't know why this behavoiur change in the last month, it work just fine last month
Recommended Posts