Output to Variable

May 4, 2009 at 11:37:47
Specs: Windows Vista

My question is: Is it possible to get the output of a
command saved in a specific variable?
like for example: Time >%time% or something.

Grateful for any replies =)

See More: Output to Variable

Report •

May 4, 2009 at 13:40:29
About Time and Date commands there is no need to code anything as you can directly access the system variables (to be not modified!) %time% and %date%.

About other commands you can issue the For /F statement, i.e.

for /F "delims=" %%j in ('Win_Command') do set Var=%%j

but that instruction is more useful if joined with parsing options. This however is far beyond a short note. To know more type For /? at command prompt.

Report •
Related Solutions

Ask Question