Posted by Valerie on November 05, 2011 at 04:10:31:
In Reply to: Copy file with variables in dos bat file posted by Ian on November 04, 2011 at 05:47:48:
For testing purposes two files were created (A) %temp%\chauffeur.accdb containing random characters and (B) %temp%\chaufnbr.txt containing 0 (zero).
All files are output to the %temp% folder. Please consider the script as untested, change paths to suit your setup and remove the REM when you are satisfied with the output.
:: Script Starts
@Echo Off
cls
setlocal enabledelayedexpansion
set /p nbr=nul
echo %nbr% > %temp%\chaufnbr.txt
if %nbr% gtr 5 (
set /a delnum=!nbr!-5
echo Chauffeur!delnum!.accdb being deleted
REM del %temp%\chauffeur!delnum!.accdb
)
:: Script Ends