starting batch with another batch cause multiple runningwait after call command minecraftBatch - call another...
Saint abbreviation
Why is it that Bernie Sanders is always called a "socialist"?
A starship is travelling at 0.9c and collides with a small rock. Will it leave a clean hole through, or will more happen?
How to visualize the Riemann-Roch theorem from complex analysis or geometric topology considerations?
How do you funnel food off a cutting board?
How to assess the long-term stability of a college as part of a job search
How to politely refuse in-office gym instructor for steroids and protein
Early credit roll before the end of the film
A Missing Symbol for This Logo
How to make ice magic work from a scientific point of view?
Why do we have to make "peinlich" start with a capital letter and also end with -s in this sentence?
Why avoid shared user accounts?
Boss asked me to sign a resignation paper without a date on it along with my new contract
Cat is tipping over bed-side lamps during the night
Short story where statues have their heads replaced by those of carved insect heads
How can I play a serial killer in a party of good PCs?
Globe trotting Grandpa. Where is he going next?
Airplane generations - how does it work?
What is the difference between rolling more dice versus fewer dice?
How do you voice extended chords?
What happens when I Twin Life Transference?
What is the wife of a henpecked husband called?
Citing paywalled articles accessed via illegal web sharing
Is there a defined priority for pattern matching?
starting batch with another batch cause multiple running
wait after call command minecraftBatch - call another batch and have it executedcreating a batch file to run different codes sequentiallyHow to have a batch call another batch based on its location?How to call perl file every minute from batch fileHow can I tell if my batch file is running?How to run multiple commands one after another in cmdHow to do division and rounding within the string?how to chain batches properly?How do you use a batch file to create another batch file that contains %username%
I have batch and start another batch with first one and I noticed that second batch is ran many times in 1 second appart. Some other with 1 minute appart even if I use TIMEOUT /T 1000
I see this is not a problem only with one batch set which start another batch, but it happend with all batches which are ran by another batch.
Can someone help me with this, how to solve this problem
I tried with
start /B batch.bat
call batch.bat
start cmd /c "batch.bat"
If I use this script it makes batch to start 6 times in 1 second appart, but it should only 1 time.
set startdir=%cd%
for /d %%i in (*) do (
cd %%i
if exist "new_copy_sendmail.bat" call "new_copy_sendmail.bat"
cd %startdir%
)
windows batch script batch-file
New contributor
add a comment |
I have batch and start another batch with first one and I noticed that second batch is ran many times in 1 second appart. Some other with 1 minute appart even if I use TIMEOUT /T 1000
I see this is not a problem only with one batch set which start another batch, but it happend with all batches which are ran by another batch.
Can someone help me with this, how to solve this problem
I tried with
start /B batch.bat
call batch.bat
start cmd /c "batch.bat"
If I use this script it makes batch to start 6 times in 1 second appart, but it should only 1 time.
set startdir=%cd%
for /d %%i in (*) do (
cd %%i
if exist "new_copy_sendmail.bat" call "new_copy_sendmail.bat"
cd %startdir%
)
windows batch script batch-file
New contributor
3
Without your exact batch files I can't replicate the behaviour. Your 2nd example will iterate subfolders and call each"new_copy_sendmail.bat"
it finds there. BTW stepping in/out subfolders might be easier using pushd/popd.
– LotPings
Feb 22 at 10:53
Try"start /wait new_copy_sendmail.bat"
instead of"new_copy_sendmail.bat"
– dmb
Feb 22 at 11:04
that's not working it is the same
– Dennis
yesterday
Perhaps in thefor /d
loop you need to add a line such asif exist "new_copy_sendmail.bat" echo "%%~finew_copy_sendmail.bat"
and see if there's 6 different batch files within that directory structure. To me it sounds like it is executing each batch found and it finds the batch 6 different times.
– Pimp Juice IT
13 hours ago
add a comment |
I have batch and start another batch with first one and I noticed that second batch is ran many times in 1 second appart. Some other with 1 minute appart even if I use TIMEOUT /T 1000
I see this is not a problem only with one batch set which start another batch, but it happend with all batches which are ran by another batch.
Can someone help me with this, how to solve this problem
I tried with
start /B batch.bat
call batch.bat
start cmd /c "batch.bat"
If I use this script it makes batch to start 6 times in 1 second appart, but it should only 1 time.
set startdir=%cd%
for /d %%i in (*) do (
cd %%i
if exist "new_copy_sendmail.bat" call "new_copy_sendmail.bat"
cd %startdir%
)
windows batch script batch-file
New contributor
I have batch and start another batch with first one and I noticed that second batch is ran many times in 1 second appart. Some other with 1 minute appart even if I use TIMEOUT /T 1000
I see this is not a problem only with one batch set which start another batch, but it happend with all batches which are ran by another batch.
Can someone help me with this, how to solve this problem
I tried with
start /B batch.bat
call batch.bat
start cmd /c "batch.bat"
If I use this script it makes batch to start 6 times in 1 second appart, but it should only 1 time.
set startdir=%cd%
for /d %%i in (*) do (
cd %%i
if exist "new_copy_sendmail.bat" call "new_copy_sendmail.bat"
cd %startdir%
)
windows batch script batch-file
windows batch script batch-file
New contributor
New contributor
edited Feb 22 at 10:45
LotPings
4,9711822
4,9711822
New contributor
asked Feb 22 at 10:39
DennisDennis
1
1
New contributor
New contributor
3
Without your exact batch files I can't replicate the behaviour. Your 2nd example will iterate subfolders and call each"new_copy_sendmail.bat"
it finds there. BTW stepping in/out subfolders might be easier using pushd/popd.
– LotPings
Feb 22 at 10:53
Try"start /wait new_copy_sendmail.bat"
instead of"new_copy_sendmail.bat"
– dmb
Feb 22 at 11:04
that's not working it is the same
– Dennis
yesterday
Perhaps in thefor /d
loop you need to add a line such asif exist "new_copy_sendmail.bat" echo "%%~finew_copy_sendmail.bat"
and see if there's 6 different batch files within that directory structure. To me it sounds like it is executing each batch found and it finds the batch 6 different times.
– Pimp Juice IT
13 hours ago
add a comment |
3
Without your exact batch files I can't replicate the behaviour. Your 2nd example will iterate subfolders and call each"new_copy_sendmail.bat"
it finds there. BTW stepping in/out subfolders might be easier using pushd/popd.
– LotPings
Feb 22 at 10:53
Try"start /wait new_copy_sendmail.bat"
instead of"new_copy_sendmail.bat"
– dmb
Feb 22 at 11:04
that's not working it is the same
– Dennis
yesterday
Perhaps in thefor /d
loop you need to add a line such asif exist "new_copy_sendmail.bat" echo "%%~finew_copy_sendmail.bat"
and see if there's 6 different batch files within that directory structure. To me it sounds like it is executing each batch found and it finds the batch 6 different times.
– Pimp Juice IT
13 hours ago
3
3
Without your exact batch files I can't replicate the behaviour. Your 2nd example will iterate subfolders and call each
"new_copy_sendmail.bat"
it finds there. BTW stepping in/out subfolders might be easier using pushd/popd.– LotPings
Feb 22 at 10:53
Without your exact batch files I can't replicate the behaviour. Your 2nd example will iterate subfolders and call each
"new_copy_sendmail.bat"
it finds there. BTW stepping in/out subfolders might be easier using pushd/popd.– LotPings
Feb 22 at 10:53
Try
"start /wait new_copy_sendmail.bat"
instead of "new_copy_sendmail.bat"
– dmb
Feb 22 at 11:04
Try
"start /wait new_copy_sendmail.bat"
instead of "new_copy_sendmail.bat"
– dmb
Feb 22 at 11:04
that's not working it is the same
– Dennis
yesterday
that's not working it is the same
– Dennis
yesterday
Perhaps in the
for /d
loop you need to add a line such as if exist "new_copy_sendmail.bat" echo "%%~finew_copy_sendmail.bat"
and see if there's 6 different batch files within that directory structure. To me it sounds like it is executing each batch found and it finds the batch 6 different times.– Pimp Juice IT
13 hours ago
Perhaps in the
for /d
loop you need to add a line such as if exist "new_copy_sendmail.bat" echo "%%~finew_copy_sendmail.bat"
and see if there's 6 different batch files within that directory structure. To me it sounds like it is executing each batch found and it finds the batch 6 different times.– Pimp Juice IT
13 hours ago
add a comment |
1 Answer
1
active
oldest
votes
It's running once for each folder that contains a batch file with that name and once for each folder with a space or special character in it if the batch file also exists in startdir
since the cd
will fail if the folder has a space or special character (like ampersand). you can fix it by changing the cd
call to cd "%%~i"
instead. This syntax will allow you to cd
to directories with spaces or other special characters.
A cleaner method would be to run it only for the specific files instead of jumping into the subdirectories with forfiles
. This will only run once per new_copy_sendmail.bat
file in the current directory or any subdirectory.
forfiles /m "new_copy_sendmail.bat" /S /C "cmd /c call @relpath"
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Dennis is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1408454%2fstarting-batch-with-another-batch-cause-multiple-running%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
It's running once for each folder that contains a batch file with that name and once for each folder with a space or special character in it if the batch file also exists in startdir
since the cd
will fail if the folder has a space or special character (like ampersand). you can fix it by changing the cd
call to cd "%%~i"
instead. This syntax will allow you to cd
to directories with spaces or other special characters.
A cleaner method would be to run it only for the specific files instead of jumping into the subdirectories with forfiles
. This will only run once per new_copy_sendmail.bat
file in the current directory or any subdirectory.
forfiles /m "new_copy_sendmail.bat" /S /C "cmd /c call @relpath"
add a comment |
It's running once for each folder that contains a batch file with that name and once for each folder with a space or special character in it if the batch file also exists in startdir
since the cd
will fail if the folder has a space or special character (like ampersand). you can fix it by changing the cd
call to cd "%%~i"
instead. This syntax will allow you to cd
to directories with spaces or other special characters.
A cleaner method would be to run it only for the specific files instead of jumping into the subdirectories with forfiles
. This will only run once per new_copy_sendmail.bat
file in the current directory or any subdirectory.
forfiles /m "new_copy_sendmail.bat" /S /C "cmd /c call @relpath"
add a comment |
It's running once for each folder that contains a batch file with that name and once for each folder with a space or special character in it if the batch file also exists in startdir
since the cd
will fail if the folder has a space or special character (like ampersand). you can fix it by changing the cd
call to cd "%%~i"
instead. This syntax will allow you to cd
to directories with spaces or other special characters.
A cleaner method would be to run it only for the specific files instead of jumping into the subdirectories with forfiles
. This will only run once per new_copy_sendmail.bat
file in the current directory or any subdirectory.
forfiles /m "new_copy_sendmail.bat" /S /C "cmd /c call @relpath"
It's running once for each folder that contains a batch file with that name and once for each folder with a space or special character in it if the batch file also exists in startdir
since the cd
will fail if the folder has a space or special character (like ampersand). you can fix it by changing the cd
call to cd "%%~i"
instead. This syntax will allow you to cd
to directories with spaces or other special characters.
A cleaner method would be to run it only for the specific files instead of jumping into the subdirectories with forfiles
. This will only run once per new_copy_sendmail.bat
file in the current directory or any subdirectory.
forfiles /m "new_copy_sendmail.bat" /S /C "cmd /c call @relpath"
answered 10 mins ago
shawnshawn
323110
323110
add a comment |
add a comment |
Dennis is a new contributor. Be nice, and check out our Code of Conduct.
Dennis is a new contributor. Be nice, and check out our Code of Conduct.
Dennis is a new contributor. Be nice, and check out our Code of Conduct.
Dennis is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1408454%2fstarting-batch-with-another-batch-cause-multiple-running%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Without your exact batch files I can't replicate the behaviour. Your 2nd example will iterate subfolders and call each
"new_copy_sendmail.bat"
it finds there. BTW stepping in/out subfolders might be easier using pushd/popd.– LotPings
Feb 22 at 10:53
Try
"start /wait new_copy_sendmail.bat"
instead of"new_copy_sendmail.bat"
– dmb
Feb 22 at 11:04
that's not working it is the same
– Dennis
yesterday
Perhaps in the
for /d
loop you need to add a line such asif exist "new_copy_sendmail.bat" echo "%%~finew_copy_sendmail.bat"
and see if there's 6 different batch files within that directory structure. To me it sounds like it is executing each batch found and it finds the batch 6 different times.– Pimp Juice IT
13 hours ago