1.

Solve : comand variable?

Answer»

How do you SET the results of a comand to be a variable like this

set com1= command hereYou need to parse the result of the command using FOR:

FOR /f "tokens=*" %%a in ('"command here"') do set com1=%%a

For more info about the FOR command type FOR /? or look here:
http://dostips.cmdtips.com/DosCommandRef.htm#FOR

Hope this helps! i need to set the output of this to com1

CODE: [Select]for /f "tokens=14-16 delims=:." %%i in ('ipconfig ^| FIND /i "IP address"') do echo %%i.%%j.%%kSometimes batch language is as simple as doing the obvious.

Quote

i need to set the output of this to com1

Code: [Select]for /f "tokens=14-16 delims=:." %%i in ('ipconfig ^| find /i "ip address"') do set com1=%%i.%%j.%%k

Note: com1 will not be a complete IP address, but will look something like 192.168.2

When you reference com1 after the set statement, use %com1%.

Have you checked out the DOS documentation suggested in some of your other posts?

8-)yes i have been reading them think you they are vey helpfull IM gust mostly confuster on thes = %%


Discussion

No Comment Found