Batch File: works under cmd-Windows , NOT under MS-DOS

eawedat

New member
Local time
4:02 AM
Messages
1
I made these codes to backup files :


Code:
set p=C:\Users\

for /f %%a in ('dir C:\Users\ /b') do (

if not "%%a"=="Public", (
set fileDest=C:\Backup-%%a_%date:~7,2%.%date:~4,2%.%date:~10,4%
If Not Exist "%fileDest%" mkdir "%fileDest%"
set "fullPath=%p%%%a%"
xcopy "%fullPath%" %fileDest% /e /h /y /k
rem call blah.bat
)
)

When I test it under cmd of Windows 7 , it works great!!

When I try it under MS-DOS(VirtualBOX) it does not

It gives me these errors :

LSa2G.png


Version of MS-DOS used under VirtualBox is 6.22

any suggestion ?
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba
OS
Windows 7
CPU
i3
Graphics Card(s)
Nvidia
Antivirus
AVG
Browser
Chrome
The command line in Windows 7 is a superset of the commands avaiable in the real DOS 6.22, not exactly the same. Over the newer versions it has added new commands and syntax, and it seems that you're using something new in the FOR command, not available back then.

I'm don't know what it support exactly, but, in DOS, open HELP FOR and check what syntax does it support. You'll have to create another version of the .bat file for DOS which uses only the features there, or restrict to the subset of commands common to both DOS 6.22 and Win7.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
Back
Top