1.

Solve : batch for run all bat files?

Answer»

I have to try to run all batch files under folder subfolder wih one batch
I tried this bot not working
for /d /r %%i in (D:\myfloder\Drivers\conf\) do if exist "%%i\copylog.bat" start /wait call "%%i\copylog.bat"

bat file which must be runed is under D:\myfloder\Drivers\conf\MIKE\archive\bat

I tried to run batch files from other topicThis will launch each batch file in that folder:

Code: [Select]echo off
cd /d "D:\myfloder\Drivers\conf"
for %%a in (*.bat) do call "%%a"
pause
Just make sure foxidrive's file isn't in D:\myflder\Drivers\conf or you will enter an infinite loop. Here is a workaround.

Code: [Select]echo off
cd /d "D:\myfloder\Drivers\conf"
for /f "delims=" %%A in ('dir /b *.bat ^| find /v "%~nx0"') do echo call "%%A"
echo.
echo All done.
pause

Proof of concept:
Code: (code) [Select]echo off

echo Before:
echo %time%
for %%a in (*.bat) do echo call "%%a"
echo %time%
echo.

echo After:
echo %time%
for /f "delims=" %%A in ('dir /b *.bat ^| find /v "%~nx0"') do echo call "%%A"
echo %time%
echo.

echo All done.
pause>nul
Code: (output) [Select]T:\>findAllBat
Before:
 9:43:12.28
call "colorsd.bat"
call "colorText.bat"
call "countLines.bat"
call "findAllBat.bat"
call "note.bat"
call "realtime.bat"
call "snakeV1.bat"
call "spaces.bat"
call "test.bat"
 9:43:12.29

After:
 9:43:12.30
call "colorsd.bat"
call "colorText.bat"
call "countLines.bat"
call "note.bat"
call "realtime.bat"
call "snakeV1.bat"
call "spaces.bat"
call "test.bat"
 9:43:12.37

All done.
lemonilla thanks but not working.
file not found Quote from: foxidrive on April 25, 2014, 03:47:15 AM

This will launch each batch file in that folder:

Code: [Select]echo off
cd /d "D:\myfloder\Drivers\conf"
for %%a in (*.bat) do call "%%a"
pause

here nothing happendsAre your batch files in this folder: D:\myfloder\Drivers\conf Quote from: Squashman on April 25, 2014, 01:26:26 PM
Are your batch files in this folder: D:\myfloder\Drivers\conf

no there must be batch which runs all batch files

batch files are under
 D:\myfloder\Drivers\conf\MIKE\archive\bat

but all folders are diferend because are from differend usernames, this one is for MIKE.
and there is 30 users and 30 folders which have 30 batch files which needs to be runned
  Quote from: Blisk on April 25, 2014, 01:36:28 PM
no there must be batch which runs all batch files

batch files are under
 D:\myfloder\Drivers\conf\MIKE\archive\bat

but all folders are diferend because are from differend usernames, this one is for MIKE.
and there is 30 users and 30 folders which have 30 batch files which needs to be runned
Then you got your first code example COMPLETELY BACKWARDS as your code is looking for all the batch files in that folder.
D:\myfloder\Drivers\conf\)Hmm,
If there are 30 users how are we doing to know which one is logged in for the correct directory path? Quote from: Squashman on April 25, 2014, 01:51:27 PM
Hmm,
If there are 30 users how are we doing to know which one is logged in for the correct directory path?

this is runned on server

and I need to run this batch files
Code: [Select]echo off
pushd "..\logfiles"
for /f "delims=" %%a in ('dir /b /od /a-d ') do set "lastest_file=%%a"
copy "%lastest_file%" "..\test\new"
popd"Runned is not a word."
Does your browser not have spell check.

Nor does your reply answer my question. Quote from: Squashman on April 25, 2014, 01:56:30 PM
"Runned is not a word."
Does your browser not have spell check.

Nor does your reply answer my question.

Don't know what you mean with user logged on?
Because it is not relevant for this batch files.

We need to search copy.bat files in subfolders
 D:\myfloder\Drivers\conf

and after that script will find copy.bat under

 D:\myfloder\Drivers\conf\MIKE\archive\bat
 D:\myfloder\Drivers\conf\JOE\archive\bat
 D:\myfloder\Drivers\conf\NIKE\archive\bat

and it will run that copy.bat files
So you SAID 30 folders with 30 batch files.  That is 900 batch files.  You really want to execute 900 batch files?I have no idea what you are trying to accomplish.  But this is my take on it.
Code: [Select]for /d %%G in (D:\myfloder\Drivers\conf\*) do (
FOR %%H in ("%%G\archive\bat\*.bat") do call "%%H"
)


Discussion

No Comment Found