Computing.Net > Forums > Disk Operating System > copying in dos with batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

copying in dos with batch file

Reply to Message Icon

Name: ian5150
Date: November 17, 2004 at 22:10:16 Pacific
OS: winxp sp2
CPU/Ram: 2.4 intel 512mb ram
Comment:

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:\excel

or:

copy C:\Documents and Settings\ian\My Documents\excel\*.xls d:/excel


thanks in advance all you dos gurus



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: November 17, 2004 at 22:42:05 Pacific
Reply:

Which is it, DOS or XP?

M2


0

Response Number 2
Name: jboy
Date: November 17, 2004 at 22:42:34 Pacific
Reply:

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.


0

Response Number 3
Name: ian5150
Date: November 17, 2004 at 22:47:13 Pacific
Reply:

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 WORD

FILES 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 :)


0

Response Number 4
Name: jboy
Date: November 17, 2004 at 22:57:13 Pacific
Reply:

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.


0

Response Number 5
Name: jboy
Date: November 17, 2004 at 23:01:53 Pacific
Reply:

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.


0

Related Posts

See More



Response Number 6
Name: TopFarmer
Date: November 18, 2004 at 19:02:42 Pacific
Reply:

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


0

Response Number 7
Name: jboy
Date: November 18, 2004 at 19:16:07 Pacific
Reply:

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.

Computerhope:

"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.


0

Response Number 8
Name: Mechanix2Go
Date: November 18, 2004 at 22:09:06 Pacific
Reply:

These work [w2k]

dir "\Program Files\*.exe" /s
dir "\Program Files

This doesn't:

dir "\Program Files\*.exe /s

Go figure.

Kludge is the operative word.

M2


0

Response Number 9
Name: jboy
Date: November 19, 2004 at 05:15:05 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: copying in dos with batch file

Writing CD's in DOS with LFN www.computing.net/answers/dos/writing-cds-in-dos-with-lfn/11900.html

setup epson with batch file www.computing.net/answers/dos/setup-epson-with-batch-file/5261.html

Printing in dos with Hewlett packard DeskJet www.computing.net/answers/dos/printing-in-dos-with-hewlett-packard-deskjet/3560.html