• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Batch scripting question

SoulAssassin

Diamond Member
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. 😉
 
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.
 
Back
Top