If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Dos script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-06, 09:24
rahul_s80 rahul_s80 is offline
Registered User
 
Join Date: Jul 2006
Location: Pune , India
Posts: 433
Exclamation 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
Reply With Quote
  #2 (permalink)  
Old 12-23-06, 11:32
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Try the "for /f" command, so called extended syntax - it's described in Windows help.
Reply With Quote
  #3 (permalink)  
Old 12-27-06, 01:50
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Hi,
something like:
Code:
for /f "tokens=1" %%i in ('indstr "free" dir.txt') do (
      set your_variable=%%i
       	)
Hope this helps,
Grofaty
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On