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



## eawedat (Jul 27, 2014)

I made these codes to backup files :


```
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 :


----------



## foxidrive (Oct 20, 2012)

MS-DOS has a much more limited command set using command.com instead of cmd.exe

Those commands are using the NT series of Windows CMD.EXE syntax.


----------



## eawedat (Jul 27, 2014)

Is there a way to let these codes work under DOS ?


----------



## foxidrive (Oct 20, 2012)

The code you have cannot work under MSDOs. It will have to be rewritten using MSDOS tools and kludges

It looks like you are backing up some elements of a modern Windows user profile using msdos - and that is going to lose all long file and folder names.


----------

