Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i want to copy excel file (.xls) from my documents folder to d:\excel . I tried a batch file but it says it the system cannot find the path specified. below is my batch file. any help guys??
COPY C:\MY DOCUMENTS\excel\*.xls d:\excelor:
copy C:\Documents and Settings\ian\My Documents\excel\*.xls d:/excel
thanks in advance all you dos gurus

Try using quotes around long file & folder names.
COPY "C:\MY DOCUMENTS\excel\"*.xls d:\excel
A long filename is one that exceeds the old '8.3' DOS naming convention - embedded spaces are also problematic
The secret of life is honesty and fair dealing..if you can fake that, you've got it made.

i want to do it in notepad as a .bat file
here is the batch file as i have written it
@ECHO OFF
ECHO. THE FOLLOWING BATCH FILE WILL COPY ALL EXCEL,ACCESS AND WORDFILES FROM C TO D
PAUSE
COPY "C:\MYDOC~\excel\*.xls" C:\excel
COPY "C:\MYDOC~\access\*.mdb" c:\access
COPY "C:\MYDOC~\word\*.doc" c:\word
ECHO COMPLETED
PAUSE
be gentle i am only a beginner :)

That's all well and good, however the "DOS" that comes with XP is an emulation provided by the actual NT based Operating System. Things aren't quite the same as they would be in 'true' DOS.
The quotes trick is required when working with LFNs in Win9x DOS (which really is a DOS) since the long filename feature of those systems is a bit of a kludge that was shoehorned in.
I don't know if it's necessary under XP - perhaps, in the DOS emulation, it is.
The secret of life is honesty and fair dealing..if you can fake that, you've got it made.

The alternative to using quotes is to use the short (8.3) file and folder names.
You don't need both
The secret of life is honesty and fair dealing..if you can fake that, you've got it made.

if XP's DOS emulation is the same with 98 your dos short name is wrong. It is not "MYDOC~" should be MYDOCU~1

Yeah - I don't know a whole lot about XP, but I would think that there's a better way - it seems that it varies.
"Note: Users running later versions of Microsoft Windows such as Microsoft Windows 2000 or Windows XP will be able to uses spaces in a MS-DOS shell without using the quotes, however this will not work with all commands.
Interestingly, you don't have to close the quotes - just use one at the beginning.
The secret of life is honesty and fair dealing..if you can fake that, you've got it made.

These work [w2k]
dir "\Program Files\*.exe" /s
dir "\Program FilesThis doesn't:
dir "\Program Files\*.exe /s
Go figure.
Kludge is the operative word.
M2

Sure - PCGuide puts it well:
"Basically, the implementation is a hack built on top of the standard FAT file system, and there are numerous problems that you should be aware of when using LFNs"
The secret of life is honesty and fair dealing..if you can fake that, you've got it made.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |