Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Combine 2 batch files into one

459 views
Skip to first unread message

Andy

unread,
Jul 8, 2013, 4:19:16 PM7/8/13
to
Is there a way to combine these 2 bat files into one ?

Thanks,
Andy

:: once.bat Run a batch file or program only once per day
:: **** USED BY BAK.BAT ****
:: Todd, Frank W., Herbert K.,

@echo off
cls
set Semaphore=%temp%\Semaphore.bat

call "%Semaphore%"
cls

if "%lastrun%" equ "%date%" goto End

:Action

echo set lastrun=%date%>"%Semaphore%"
call bak.bat
goto :eof

:End

echo.
echo.
echo %~nx0 ALREADY RAN ONCE TODAY !!
echo.
echo.
PING localhost -n 3 > nul

Second batch file.

:: bak.bat

c:\windows\wzzip -u source.zip *.asm *.rc *.ico *.inc *.def *.dll *.bat *.xml *.txt *.bmp

c:\windows\wzzip -u c:\masm32\SOURCE\bats.zip *.bat *.cmd
cd\
cd masm32\bin
c:\windows\wzzip -u c:\masm32\SOURCE\win32_bats.zip *.bat

cd\
cd masm32
c:\windows\wzzip -u c:\masm32\SOURCE\source.zip menus.ini

JJ

unread,
Jul 8, 2013, 4:39:14 PM7/8/13
to
On Mon, 8 Jul 2013 13:19:16 -0700 (PDT), Andy wrote:
> Is there a way to combine these 2 bat files into one ?

You mean:
Could anyone combine these 2 bat files for me?

Herbert Kleebauer

unread,
Jul 8, 2013, 4:37:49 PM7/8/13
to
On 08.07.2013 22:19, Andy wrote:

> Is there a way to combine these 2 bat files into one ?
>
> Thanks,
> Andy
>
> :: once.bat Run a batch file or program only once per day
> :: **** USED BY BAK.BAT ****
> :: Todd, Frank W., Herbert K.,
>
> @echo off
> cls
> set Semaphore=%temp%\Semaphore.bat
>
> call "%Semaphore%"
> cls
>
> if "%lastrun%" equ "%date%" goto End
>
> :Action
>
> echo set lastrun=%date%>"%Semaphore%"


> call bak.bat

replace this by
call :bak.bat


> goto :eof
>
> :End
>
> echo.
> echo.
> echo %~nx0 ALREADY RAN ONCE TODAY !!
> echo.
> echo.
> PING localhost -n 3 > nul
>

> Second batch file.
>
> :: bak.bat

replace this by

goto :eof
:: Second batch file.

Andy

unread,
Jul 8, 2013, 5:53:04 PM7/8/13
to
Yes.

Andy

Andy

unread,
Jul 8, 2013, 5:54:17 PM7/8/13
to
:: bak.bat is only a comment in the batch file.

Andy

Herbert Kleebauer

unread,
Jul 8, 2013, 6:23:35 PM7/8/13
to
On 08.07.2013 23:54, Andy wrote:

> :: bak.bat is only a comment in the batch file.

Therefore you should replace it by

:bak.bat

because then it is a label and you can call it by

call :bak.bat

which has the same effect as calling the the second
batch file bak.bat which now is part of the first batch file.


Andy

unread,
Jul 8, 2013, 9:29:14 PM7/8/13
to
Thanks, I get it now.

Andy
0 new messages