saving export of a command into a variable

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

saving export of a command into a variable

#1 Post by Mohammad_Dos » 24 Mar 2012 15:37

how to save export of a command into a variable?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: saving export of a command into a variable

#2 Post by aGerman » 24 Mar 2012 16:20

That's a bit unspecific. If "export" means "output" of a command then you could use a FOR /F loop to save a line or a part of a line into a variable. Generally:
for /f "your options here" %%i in ('your command line here') do set "variable=%%i"

That's also unspecific but it's the best I can answer. It depends on the command, its output and what part of it you want to save ...

Regards
aGerman

Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

Re: saving export of a command into a variable

#3 Post by Mohammad_Dos » 24 Mar 2012 16:49

yes. that is true
i mean output
thank u so much

and sorry for my english :oops:

Post Reply