hi there im looking for some help if possible. I’ve made the script that starts the windows backup and places the backup image in a new folder once completed. I want to be able to read in an INI file for the “drives to include” and “unc network path”.
Cant seem to get it to read from the ini correctly. if i manually enter the “include” and “backupshare” variables into the batch file it works. Could someone have a look please. heres the script
@echo off
:: backup.cmd
:: Backup using WBADMIN.EXE
for /f “tokens=1,2 delims==” %%a in (ini.ini) do (
if %%a==backupshare set backupshare=%%b
if %%a==include set include=%%b
)
echo %backupshare%
echo %include%
rem backup share UNC
set backupshare=%backupshare%
rem files and folders to include
set include=%include%
rem define date time variables for building the folder name
set m=%date:~6,2%
set d=%date:~3,2%
set y=%date:~9,4%
rem set h=%time:~0,2%
rem set min=%time:~3,2%
rem set sec=%time:~6,2%
rem defining a new folder like \\\\\
set newfolder=%backupshare%\%computername%\%d%%m%%y%
echo Creating %newfolder%
mkdir %newfolder%
rem run the backup
echo Backing up %include% to %newfolder%
wbadmin START BACKUP -backuptarget:%newfolder% -include:%include% -allCritical -vssFull -quiet
pause
and heres the INI file ive been using
backupshare=10.11.13.5/test/
include=c:
Thanks for your time
Leave echo off, and post the output. 80% chance cmd’s not finding the ini file.
How To Ask Questions The Smart Way