Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > Windows batch file: set output of program to a variable?
Word :    Username :           
 

I have gone through the above thread. I have a specific requirement to count the files in a folder and set it's count value to a variable in the batch script. I will then use this value later in the program. e.g.

for /f "delims=" %a in ('dir /a-D /B /s "C:\code\depot\install\Data File Distrib\ProductName" |find /c /v ""') do Set tempVar=%a

I am having trouble with the space in the path. I tried using escape with slash '\' but didn't help. Can anyone correct my above command and get the count in the tempVar?

Your help is very much appreciated.

Regards
Prashant Lade

Sponsored Links
Register or log in to remove.

Its been too long since I have worked extensively with bat files but here is a link
that could be helpful.
http://commandwindows.com/
Maybe there will be something helpful in there for you.

I have tried your bat and I think the trouble lies in the find command.
While spending a short time in the above site I saw this and thought it could help
http://commandwindows.com/batchfiles-iterating.htm
You may end up using the IF and Set commands to set a counter.
Ill try to get back after a while and see what else i can find.

Reply to pat mcgroin
Tom's Hardware > Forum > Windows XP > Windows XP General Discussion > Windows batch file: set output of program to a variable?
Go to:

There are 1178 identified and unidentified users. To see the list of identified users, Click here.

Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them