Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: (`command`)  (Read 5003 times)

0 Members and 1 Guest are viewing this topic.

tensaix2j

  • Guest
(`command`)
« on: October 23, 2008, 10:07:14 PM »
is there any unix $() or `command` equivalent in DOS ?

for example: 

set %a% = `type b.txt`   so %a% will be assigned with stdout result of command `type b.txt` rather than taking the command `type b.txt` as string literally.   

gpl



    Apprentice
  • Thanked: 27
    Re: (`command`)
    « Reply #1 on: October 24, 2008, 02:29:12 AM »
    From this page -> www.computerhope.com/forhlp.htm

    There is this
    Quote
    Finally, you can use the FOR /F command to parse the output of a command. You do this by making the filenameset between the parenthesis a back quoted string. It will be treated as a command line, which is passed to a child CMD.EXE and the output is captured into memory and parsed as if it was a file. So the following example:

    FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

    would enumerate the environment variable names in the current environment.

    I think this is what you were looking for
    Graham