Command output ==> environment variable
Results 1 to 2 of 2

Thread: Command output ==> environment variable

  1. #1
    Join Date
    Jun 2001
    Location
    Jacksonville,Fl,USA
    Posts
    341

    Command output ==> environment variable

    Hi all, once again I need help with something that should be easy, but I can't get to work. I'ld like to get the output of a command into an environment variable without writing to a temp file. In other words, something that might look like this:

    SET dirtemp=<DIR /AD /-P|FIND "Directory"

    Obviously, that doesn't work. I've found lots of batch file examples that show how to do this using a temp file, but if possible, I'ld like to avoid that.

    Thanks all.

    Dex

    EDIT: There's supposed to be colon between the A|D above, but the forum wants to make it a "smiley" . . .


  2. #2
    Join Date
    Feb 2000
    Location
    26.03°N 80.14°W
    Posts
    9,410
    Can't be done without creating temp files. The pipe ("|") through FIND, (or MORE or SORT), will automatically create (and delete) them.
    Vernon Frazee, Microsoft MVP (Windows - Shell/User)

    Defenses Up!
    Tip: When prompted for a password, give an incorrect one first. A phishing site will accept it; a legitimate one won't.


    Inside Spyware: A Guide to Finding, Removing and Preventing Online Pests


    If you don't keep up with security fixes, your computer|network won't be yours for long.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •