simple windows batch file question

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

How do I assign the program output to a variable in a batch file?

I guessed it would be something like:

set MY_VAR = `type filename`
echo %MY_VAR%

I want to assign the one line that is in the file to be assigned to
MY_VAR.

Thanks,

Paul.

.



Relevant Pages

  • Re: Persisting env vars in cmd windows
    ... The help text for the command you question goes like this: ... format by typing this: echo %date% ... If you don't then the batch file will fail. ... echo:: ERROR ERROR ERROR ERROR ...
    (microsoft.public.win2000.general)
  • Re: Win2000 Printing Nightmare
    ... Purge the print spooler, to do so at a command prompt issue the ... You can make a small batch file to do the above job, ... @echo off ... ping localhost -n 4> nul ...
    (microsoft.public.win2000.file_system)
  • Re: logging batch files
    ... @echo off ... REM the start of your batch file ... >set LogCmd= ... >:LogIt ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Batch File Parameters
    ... While your batch file uses a number of advanced features, ... > @echo off ... > goto GETNEXT ... > a folder in "My Documents" and move them to an Archive folder while ...
    (microsoft.public.windowsxp.general)
  • Re: Disk Free Space Alert
    ... If you want a percentage then you can run this batch file: ... $goto Start ... $ echo Press the Space Bar to close this window. ... $echo Free space on drive %Drive% is %percent%%% of capacity ...
    (microsoft.public.win2000.general)