Using the result of one command in another

  • Thread starter Thread starter David Topham
  • Start date Start date
D

David Topham

Hi

Does anyone know how, in a batch file to use the result of one command in
the syntax of another.

Say, for example, I want to set what the VER command returns (ie the string
describing the Windows version) to an environment variable, somthing along
the lines of:

set MYVAR=VER

Only of course that just sets it to the string "VER", not the return of the
VER command.

[Just to clarify, I'm *sure* there are better ways of getting the windows
version in an environment variable, I'm just using this as an example of the
sort of thing I'm trying to do :-]

(For multi-OS types, this is similar to what is possible in some Un!x shells
by using backticks, ie the ` quote).

Any ideas.

Thanks

David
 
OK, the FOR command....

*That* makes sense.......;)

For cross-platform (NT/2K/XP/K3) syntax on the FOR Command, see
(http://TheSystemGuard.com/TheGuardBook/CCS-Int/FOR.htm)

-tsg

/-----------------+---------------+----------------------\
| COMPATIBILITY | CLARITY | SPEED |
| Write code ONCE | Make it clear | THEN...Make it fast! |
\-----------------+---------------+----------------------/
400+ command-line resources using ONLY native NT commands!
(http://TheSystemGuard.com/default.asp#MasterCommandList)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top