Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Running two bat files ?

13 Feb 2016   #1
countmypennies

windows 7 home premium 64 bit
 
 
Running two bat files ?

I have a outlook backup program that backs up all the mail and offers a way to enter a POST Backup CMD

The program runs great and if I add a script (bat file) in the post back up CMD area, it will also run perfectly separately


BUT

I have two (2) scripts (.bat files) I would like to run, one after the other,,, but NOT sure how to join them..

I included the 2 scripts here if someone can help me?

bat file one: (backup_additional_settings.bat)

Code:
@ECHO OFF
rem set backup folder here
pushd \\FILESERVER\OUTLOOK\CD-OPTI9020

setlocal EnableDelayedExpansion

rem backup signatures
copy "%APPDATA%\Microsoft\Signatures\*" *

rem backup registry settings
rem uncomment for outlook 2010
rem regedit /e outlook_settings_backup.reg "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" 

rem uncomment for outlook 2013
rem regedit /e outlook_settings_backup.reg "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles"

rem uncomment for outlook 2016
rem regedit /e outlook_settings_backup.reg "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Profiles"



endlocal
and here is the second bat file: (keep_n_backups.bat)

Code:
@echo off
setlocal enableextensions enabledelayedexpansion

rem set max no of backups to keep and backup folder
set MAX_BACKUP=5
pushd \\FILESERVER\OUTLOOK\CD-OPTI9020


set rev=0

rem read last revision no
if exist revision.txt (
	for /f "delims=" %%a in (revision.txt) do (
		set rev=%%a
	)
)
Set /A rev=!rev!+1
Set /A rev=!rev! %% !MAX_BACKUP!

rem find pst-file and rename
FOR /F "delims=" %%I IN ('DIR *.pst *.ost /B') DO (
	set x=%%I
	if exist "!x:~0,-4!_!rev!.bak" del "!x:~0,-4!_!rev!.bak"
	ren "!x!" "!x:~0,-4!_!rev!.bak"
) 

echo !rev! > revision.txt


endlocal
any help would be GREAT !


..


My System SpecsSystem Spec
.
13 Feb 2016   #2
Mellon Head

Win 7 Pro x64/Win 10 Pro x64 dual boot
 
 

Use a text editor and copy and paste BAT file 2 onto the end of BAT file 1, and save as a BAT file with a different name. You should be good to go, if they run properly one right after another. Like this:

Code:
@ECHO OFF
rem set backup folder here
pushd \\FILESERVER\OUTLOOK\CD-OPTI9020

setlocal EnableDelayedExpansion

rem backup signatures
copy "%APPDATA%\Microsoft\Signatures\*" *

rem backup registry settings
rem uncomment for outlook 2010
rem regedit /e outlook_settings_backup.reg "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles" 

rem uncomment for outlook 2013
rem regedit /e outlook_settings_backup.reg "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles"

rem uncomment for outlook 2016
rem regedit /e outlook_settings_backup.reg "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Profiles"



endlocal

@echo off
setlocal enableextensions enabledelayedexpansion

rem set max no of backups to keep and backup folder
set MAX_BACKUP=5
pushd \\FILESERVER\OUTLOOK\CD-OPTI9020


set rev=0

rem read last revision no
if exist revision.txt (
    for /f "delims=" %%a in (revision.txt) do (
        set rev=%%a
    )
)
Set /A rev=!rev!+1
Set /A rev=!rev! %% !MAX_BACKUP!

rem find pst-file and rename
FOR /F "delims=" %%I IN ('DIR *.pst *.ost /B') DO (
    set x=%%I
    if exist "!x:~0,-4!_!rev!.bak" del "!x:~0,-4!_!rev!.bak"
    ren "!x!" "!x:~0,-4!_!rev!.bak"
) 

echo !rev! > revision.txt


endlocal
My System SpecsSystem Spec
13 Feb 2016   #3
countmypennies

windows 7 home premium 64 bit
 
 

Worked PERFECT! Thank you SO very Much!
My System SpecsSystem Spec
.

13 Feb 2016   #4
Mellon Head

Win 7 Pro x64/Win 10 Pro x64 dual boot
 
 

You're very welcome.
My System SpecsSystem Spec
Reply

 Running two bat files ?




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
How do I share files with a PC running XP?
I wanted to share files between a PC running XP Pro and my Win Laptop through a router with ethernet cables. I tried a lot and lot (have done system restore for 8-10 times in this process) to do this by following the tutorials and guides all over the internet but in vain. I don't wanna mess it up...
Network & Sharing
.exe files running problem
all my .exe files are getting opened with utorrent. tried to fix it with .reg file but that didn't help at all. now i cant download, cant install anything .unable to run any .exe programs.:cry: how can i fix this?
General Discussion
Problem running some .exe and .bat files
I made some changes with the cmd to fix a password problem, but now I have a problem running some programs Here's what i did: cd /d d:\ CD Windows\system32 ren cmd.exe cmd.old ren magnify.exe cmd.exe ren cmd.old magnify.exe (i did it to change my password, my previous thread:...
General Discussion
How about running .jar files on win 7 beta
quick question: anybody have problems running .jar files on windows 7 ? Already downloaded newest version 14 from sun.
Software
problem: running srt,sub with mkv files
hi i have hp laptop with windowd 7 in the beginning my MC wasn't able to play mkv files until i installed win7codecs pack and x64components pack. the problem is my subtitles don't show up with the video in MC. I can run my Subtitles with WMP and Real player but i can't run it with MC
Media Center
problem with running .reg files
When I run .reg files I choose to run them as administrator. I get an information saying that the information was succesfully added to the registry. However, when I open the registry I see that those keys weren't added at all. What's wrong?
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:24.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App