Batch scripting question

SoulAssassin

Diamond Member
Feb 1, 2001
6,135
2
0
Here's the deal, putting a script together to do some automated notification when condition X is received. Run executable which returns a numeric value, based on that numeric value, either exit or send notification.

95% of this is very easy, problem I'm having is taking the output of the cmd and assigning it to a variable that I can use for comparison purposes.

I can run:

somecmd.exe | find /i /c "whatI'mlookingfor" > %temp%\filename.txt

and get it into a file

somecmd.exe | find /i "whatI'mlookingfor" > %variablename%

doesn't work

somecmd.exe | find /i "whatI'mlookingfor" > %temp%\filename.txt
set %temp%\filename.txt=%variablename%

doesn't work

somecmd.exe | find /i "whatI'mlookingfor" > %temp%\filename.txt
type %temp%\filename.txt=%variablename%

doesn't work.

End result I'm looking for is just getting the output of the executable into a variable.

Any thoughts? Googled my brains out and checked alot of sites I normally look for these kind of things w no luck. Brain hurts. ;)
 

SoulAssassin

Diamond Member
Feb 1, 2001
6,135
2
0
Originally posted by: groovin
theres no way to redirect command line output to a variable?

Not that I've found so far....seems like it should be an easy thing but for the life of me I can't figure this one out.