ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

[Solved] Batch file problem

(1/2) > >>

mediaguycouk:
I have the following batch file but I have a problem with it. The IF statements check that a tv program has been recorded. If it has then it runs it through VideoReDo, if it hasn't it will send an email so I can check the recording software.

My problem is that when it runs the email sending .bat file the current batch file stops. It will stop at the first instance and not run any of the other code, even the pause at the end. It just stops (and closes before I can read anything on the screen).

Is there some command that I need to place before the bat file to stop this from happening and ensure that computer returns to the original file?

@echo off
echo Deleting files
del "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsArabicTuesday.mpg"
del "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRAITuesday.mpg"
del "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRTPTuesday.mpg"
del "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRussianTuesday.mpg"
del "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsArabicTuesday.mpg"
del "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsRAITuesday.mpg
del "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsRTPTuesday.mpg
del "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsRussianTuesday.mpg
echo Deleting done
echo Renaming files
rename "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsArabicThursday*.mpg" NewsArabicThursday.mpg
rename "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRAIThursday*.mpg" NewsRAIThursday.mpg
rename "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRTPThursday*.mpg" NewsRTPThursday.mpg
rename "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRussianThursday*.mpg" NewsRussianThursday.mpg
echo Renaming done
echo Start conversion:

IF EXIST "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsArabicThursday.mpg". (
cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsArabicThursday.mpg" "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsArabicThursday.mpg" /t1 /d /q /e
) ELSE (
EmailFileMissing.bat .
)

IF EXIST "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRAIThursday.mpg". (
cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRAIThursday.mpg" "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsRAIThursday.mpg" /t1 /d /q /e
) ELSE (
EmailFileMissing.bat .
)

IF EXIST "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRTPThursday.mpg". (
cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRTPThursday.mpg" "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsRTPThursday.mpg" /t1 /d /q /e
) ELSE (
EmailFileMissing.bat .
)

IF EXIST "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRussianThursday.mpg". (
cscript //nologo "C:\Program Files\VideoReDoPlus\vp.vbs" "E:\Staff Media\Private Files\#shared\LRC\gra\Recorded\NewsRussianThursday.mpg" "E:\Staff Media\Private Files\#shared\LRC\gra\Fixed\NewsRussianThursday.mpg" /t1 /d /q /e
) ELSE (
EmailFileMissing.bat .
)

echo All done
pause

aphoria:
Use the CALL statement anywhere you are calling another .BAT file.

For example,

CALL EmailFileMissing.bat

Without the the CALL statement, the current .BAT file runs the second .BAT file but execution is not returned when the second .BAT file is finished.  The CALL statement means run the second .BAT file and then return execution to the line after the CALL.

Rover:
Yes.  Call is the answer.

I'm so happy someone still uses .BAT files.   :P

mediaguycouk:
They're certainly easier than c#.net

mediaguycouk:
That worked great. Thanks for your help

Navigation

[0] Message Index

[#] Next page

Go to full version