Jump to content

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

Recommended Posts

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 :


Version of MS-DOS used under VirtualBox is 6.22

any suggestion ?

Link to post
Share on other sites
  • 1 month later...

First, you may want to read up on LFNFOR,,. Also, as of MS-DOS 7 (you are using 6.22 which is even older), doublequoted strings are treated as a single element, wether they contain delimiters or not. I'm not so sure that this applies to v6.xx. You should run some tests to verify. Anything Windows XP and above, to MS-DOS 6.22 is a huge jump... I can't really see how you'd expect to get anything but the most basic scripts to remain *valid* as much has changed.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy