![]() |
|
|
| Subject:
open many bat files at once
Category: Computers > Programming Asked by: rayzuntheterrible-ga List Price: $2.00 |
Posted:
10 May 2004 14:01 PDT
Expires: 09 Jun 2004 14:01 PDT Question ID: 344239 |
I have many folders in my main folder: C:\BAT\creation\processing\1111 in each folder has an .bat file. in each .bat file, Im creating files with the echo >>newfile.txt command is there an way to open all .bat file's so the files which the .bat file creates stay in the current folder's structure? |
|
| There is no answer at this time. |
|
| Subject:
Re: open many bat files at once
From: crythias-ga on 06 Jun 2004 11:06 PDT |
Are all the .bat files named the same in the subfolders? or are the
.bats the same as the folder?
If you don't mind getting awk95.exe from somewhere and put it in your
path, here's a hint:
in your C:\BAT\creation\processing\1111
create your uberbat.bat
REM Begin uberbat.bat
dir /ad | find "<DIR>" > dirlist.txt
awk95 "NR>2 {print \"cd \" $1 \"\ncall subbat.bat\ncd ..\"}"
dirlist.txt >> dothis.bat
REM End uberbat.bat
then you should be successful merely running the dothis.bat change
subbat.bat to be the name of the batch file in your directory. |
| Subject:
Re: open many bat files at once
From: crythias-ga on 06 Jun 2004 11:22 PDT |
ick. one of the lines wrapped. The dirlist.txt >> dothis.bat line must
be on the same line as the awk95 line,
awk95 "NR>2 {print \"cd \" $1 \"\ncall subbat.bat\ncd ..\"}"
dirlist.txt >> dothis.bat
and if this also wraps, just make sure the dothis.bat is after the >>
There is no error checking for this, so realize dirlist.txt will
overwrite if exists, but dothis.bat will APPEND each time you run the
uberbat.bat. Be sure to delete dothis.bat each time you run the
uberbat (which may not need to be run but once ever.)
IF the .bat file (and I hope there's only one per folder) is different
named in each folder, then we can simply parse each subfolder for the
bat file...
OTOH, if the subfolder bat files are all the same, then the code is simpler!
in the 1111 dir, put the subbat.bat file.
REM Begin uberbat.bat
dir /ad | find "<DIR>" > dirlist.txt
awk95 "NR>2 {print \"call subbat.bat \" $1}" dirlist.txt >> dothis.bat
REM End uberbat.bat
in your subbat.bat, echo >> %1\newfile.txt
run dothis.bat |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
| Search Google Answers for |
| Google Home - Answers FAQ - Terms of Service - Privacy Policy |