|
Answer» I have some batch files with the same name and differend folders and I need to be executed. So I need a batch to find copylog.bat find path for that file and than use it for execute it and than find another copylog.bat find path for that file and use it with copylog.bat to execute it. Untile the last copylog.bat and all executed.
Can someone helps me please?How many files? Why not do it by hand? Who did this? Why not make him do it? In the future, implement a practice of using number to disambiguate files with the same name. Like Copyright(1), Copyright(2), Copyright(3), an so on.
This command at the drive root
Code: [Select]DIR *.bat /b /s >likstWill makes a list of all bat files with path name. The list can be parsed in a FOR loop. Or you can look at the list ans SEE what was found.
this didn't show any path of it. I am not so good with forfiles tooThis MIGHT be what you are after:
Code: [Select]echo off for /r "d:\base\folder" %%a in (copylog.bat?) do ( cd /d "%%~dpa" call "%%a" ) thank you this works now.No I found out it doesn't work, because it runs another batch file which should not be runned instead of the right one. this I have in runbats.bat
Code: [Select]echo off for /r "d:\base\folder" %%a in (copylog.bat?) do ( cd /d "%%~dpa" call "%%a" )and it is in \\mysrv\Drivers\DVD
and this are batch filles all the same in difrend subfolders copylog.bat
Code: [Select]echo off pushd "..\logfiles" del /Q ..\logfiles\new\*.txt for /f "delims=" %%a in ('dir LOGH*.txt /b /od /a-d ') do set "lastest_file=%%a" copy "%lastest_file%" "..\logfiles\new\" popd
but instead of this batch it runs this one user_sel.bat
Code: [Select]robocopy \\mysrv\Drivers\DVD\conf\aleksandar\log \mysrv\Drivers\DVD\conf\maja\chk /W:5 robocopy \\mysrv\Drivers\DVD\conf\aleksandar\log \\mysrv\skleda\Drivers\DVD\conf\suzana\chk /W:5
exit both copylog.bat and user_sel.bat are in the same folder \\mysrv\skleda\Drivers\DVD\conf\suzana
and next copylog.bat and user_sel.bat \\mysrv\skleda\Drivers\DVD\conf\maja
and next copylog.bat and user_sel.bat \\mysrv\skleda\Drivers\DVD\conf\jure
etctry changing the line`call "%%A" ` to ` if "%%A"=="copylog.bat" call "%%A"`.
Quote from: Blisk on AUGUST 04, 2014, 03:18:55 AM but instead of this batch it runs this one user_sel.bat
The code that I suggested will not do that when using a local drive, and you need to say that you are using a network.
Quote from: Lemonilla on August 04, 2014, 06:20:05 AMtry changing the line`call "%%A" ` to ` if "%%A"=="copylog.bat" call "%%A"`.
That doesn't work, nothing happends
Quote from: foxidrive on August 04, 2014, 09:21:11 AMThe code that I suggested will not do that when using a local drive, and you need to say that you are using a network.
sorry, that's why I posted now allCan you map the network share to a local drive letter?
Do the batch file use network paths in them too?
Quote from: foxidrive on August 04, 2014, 11:25:44 AMCan you map the network share to a local drive letter?
Do the batch file use network paths in them too?
no unfotunally can not map it, because I use %computername% for string in each users backup
for this what I need is all above, paths and batchs. All use newtorks pathsbump no luck with this one So if I get this right you want two files to be ran. Simple IF it is in the same directory use " start filename.bat " then use " taskkill filename.bat " mabye a sleep command in the middle of then but if there not in the same dir use " for " or " forfiles " and/ or you could help you understand this batch stuff like I did trial and error and this website http://ss64.com/nt/ Hope this helps Shiverbob
|