I have this batch working magnificantly in Windows 2000 and 2003 and XP with the help of the Experts here; but not in Win95! What do I need to change in order to make this batch work under Win95, and, determine which OS it is running under and work accordingly? I will never use anything older that Win95.
I suspect it is the for statements?
@echo off
setlocal
CD \RMS\C001\DL
COPY C:\GEMCOM\BACKUP\01VERIFO.DAT C:\RMS\C001\DL\01VERIFO.DAT
COPY C:\RMS\C001\DR\DRSA* C:\RMS\C001\DL\DRSA*
for /f "tokens=1,* delims==" %%a in ('type "C:\PDIMSG32\PDIMSG32.PMC" 2^>NUL') do if /i "%%a"=="Storeid" set locvar=%%b&goto FOUNDIT
echo NO store ID !!
pause
goto :EOF
:FOUNDIT
for /F "tokens=1-4 delims=/- " %%a in ('date/T') do set date=%%d%%c%%b
for /F "tokens=1-4 delims=/- " %%a in ('date/T') do set /a DAY=%%b
set /a YESTERDAY = DATE - 100
if "%DAY%" == "1" (
set YESTERDAY=%DATE%
)else (
set YESTERDAY = DATE - 100
)
set drdate=%yesterday:~6,2%%yesterday:~4,2%
set locvar=%locvar:~-3%
echo %locvar%
echo %drdate%
for /f "delims=" %%a in ('dir /b /a-d DRSA*.') do call :PROCESS "%%a"
goto :EOF
:PROCESS
set FileName=%~nx1
rename "%FileName%" "%locvar%%drdate%.P%FileName:~4%"
:EOF
write a test script to echo the date and see how it compares to your other machines... then alter the script accordingly.