How to store a DOS command result in variable & later us
Posted: 24 Jul 2009 19:36
Hi Everybody
This is my first posting in this forum.
I want to be able to store the result of the "Find" dos command in a variable and then later use it to do an if test. Is there a way to do it?
This is what I am trying to do in the batch file :-
The "Test.txt" file has the following contents (result of the find command) :-
Blank Line
---------- CTR1.TXT: 3
I want to be able to store the number "3" (this can range from 1 through to 4 both inclusive) in a variable and then do an "If" test to determine if it is "1" or not. If it is "1" then run another command (say run this file [test.grs - this contains the Genie Backup commands for a scheduled job - I know how to do this bit]
What I am not able to do is to store this number "3" (in this instance) excluding all the other text to to be able to test and compare if that number in the variable is 1 or not?
Any suggestions on that please!
Best regards
Deepak Agarwal
This is my first posting in this forum.
I want to be able to store the result of the "Find" dos command in a variable and then later use it to do an if test. Is there a way to do it?
This is what I am trying to do in the batch file :-
The "Test.txt" file has the following contents (result of the find command) :-
Blank Line
---------- CTR1.TXT: 3
I want to be able to store the number "3" (this can range from 1 through to 4 both inclusive) in a variable and then do an "If" test to determine if it is "1" or not. If it is "1" then run another command (say run this file [test.grs - this contains the Genie Backup commands for a scheduled job - I know how to do this bit]
What I am not able to do is to store this number "3" (in this instance) excluding all the other text to to be able to test and compare if that number in the variable is 1 or not?
Any suggestions on that please!
Best regards
Deepak Agarwal