Saved Bookmarks
| 1. |
Solve : Assigning value to a variable? |
|
Answer» ACTUALLY you should see it's VALUE since your batch file does not turn echo off. However, this will work: Code: [Select] for /f "tokens=1-6 delims=:. " %%i in ('ipconfig ^| find /i "ip address"') do set ip=%%k.%%l.%%m.%%n echo %ip% When debugging batch files (scripts too!) echo is a very handy instruction to have around. Hope this helps. It correctly displayed my ip address. So if the code is logically correct and the variable is correctly set to the ip of my machine, why is it that only the first part of the if STATEMENT works? if the ip address is outside the range specified and applies to the ELSE command, the default printer does not change.i think i have solved the problem, i forgot that my computer has 2 network CARDS and this could be where the problem is coming from. i tried it on another computer on the network and it seemed to work perfectly. thanks a lot for your help sidewinder.You're very welcome. So now stick around, your knowledge may help someone else out. |
|