Results 1 to 3 of 3

Thread: Dos script

  1. #1
    Join Date
    Jul 2006
    Location
    Pune , India
    Posts
    433

    Exclamation Unanswered: Dos script

    well my problem is more related to dos script
    i want to capture the o/p of the following batch file into variable so as to pass them into another batch file which can insert it into a table which can keep details of free space available on drives.
    can some1 guide me how to capture them into variables

    @ECHO OFF
    c:
    dir > dir.txt
    echo on Drive C
    findstr "free" dir.txt
    del dir.txt
    D:
    dir > dir.txt
    echo on Drive D
    findstr "free" dir.txt
    db2cmd -i aaa.bat

    regards
    Rahul singh

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Try the "for /f" command, so called extended syntax - it's described in Windows help.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Jan 2003
    Posts
    1,605
    Hi,
    something like:
    Code:
    for /f "tokens=1" %%i in ('indstr "free" dir.txt') do (
          set your_variable=%%i
           	)
    Hope this helps,
    Grofaty

Posting Permissions

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