troubleshooting Question

MS-DOS batch that works in W2k and up - but not Win95

Avatar of ToddRod_Taylor
ToddRod_TaylorFlag for United States of America asked on
Microsoft DOSWindows OSWindows Batch
10 Comments1 Solution276 ViewsLast Modified:
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

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros