Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 05, 2016, 10:39:34 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: [Solved] Batch file problem  (Read 3787 times)

mediaguycouk

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 245
    • View Profile
    • Mediaguy
    • Donate to Member
[Solved] Batch file problem
« on: April 03, 2008, 10:31:13 AM »
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
Learning C# - Graham Robinson
« Last Edit: April 04, 2008, 04:18:55 AM by mediaguycouk »

aphoria

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Re: Batch file problem
« Reply #1 on: April 03, 2008, 12:17:14 PM »
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

  • Master of Smilies
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 630
    • View Profile
    • Donate to Member
Re: Batch file problem
« Reply #2 on: April 03, 2008, 12:53:45 PM »
Yes.  Call is the answer.

I'm so happy someone still uses .BAT files.   :P
Insert Brilliant Sig line here

mediaguycouk

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 245
    • View Profile
    • Mediaguy
    • Donate to Member
Re: Batch file problem
« Reply #3 on: April 03, 2008, 01:48:28 PM »
They're certainly easier than c#.net
Learning C# - Graham Robinson

mediaguycouk

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 245
    • View Profile
    • Mediaguy
    • Donate to Member
Re: Batch file problem
« Reply #4 on: April 04, 2008, 04:18:39 AM »
That worked great. Thanks for your help
Learning C# - Graham Robinson

aphoria

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 5
    • View Profile
    • Donate to Member
Re: [Solved] Batch file problem
« Reply #5 on: April 04, 2008, 06:15:53 AM »
You're welcome...glad I could help.