Computer Hope

Microsoft => Microsoft DOS => Topic started by: Blisk on February 22, 2019, 02:22:42 AM

Title: another script runed by batch goes into loop
Post by: Blisk on February 22, 2019, 02:22:42 AM
I have problem when first batch start second batch than that second batch is runned fev times with 1 second appart.
Have anyone idea what can cause that and how to prevent that, so second script is run only once?
Title: Re: another script runed by batch goes into loop
Post by: DaveLembke on February 22, 2019, 09:30:09 AM
Can you share what your batch instructions look like so we can see what your doing to help you correct the problem.
Title: Re: another script runed by batch goes into loop
Post by: patio on February 22, 2019, 09:36:35 AM
You're Help requests lack details most of the time....
You have been here long enuff to know the drill by now...

Just sayin.
Title: Re: another script runed by batch goes into loop
Post by: Blisk on February 22, 2019, 10:08:46 AM
I have this script in one of batch which search and call copy_sendmail.bat
Everytime it runs I get log file run_bats_alarm.txt
When I check run_bats_alarm.txt I see it was runned 6 times for 1 second appart

Code: [Select]
echo start run bats %date% %time% >> run_bats_alarm.txt

set startdir=%cd%
for /d %%i in (*) do (
cd %%i
if exist "copy_sendmail.bat" call "copy_sendmail.bat"
cd %startdir%
)


In next bat file I have this at the bottom of batch

Code: [Select]
start cmd /c "\\cpisrv1\skleda\programi\progscr\logiranje\log.bat"

in file log.bat I have also this for logs
Code: [Select]
echo start run log %date% %time% >> log.txt
and when I check I check log.txt I see it is runned every fev seconds or minutes, like this hour_minutes_seconds
18_20_22
18_20_31
18_20_56
18_22_02 
18_24_30
18_35_21