Computing.Net > Forums > Programming > scripting 'My Documents'

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.

scripting 'My Documents'

Reply to Message Icon

Name: Sebastian42
Date: September 28, 2007 at 18:14:21 Pacific
OS: WinMe
CPU/Ram: PIII/256Mb
Product: generic
Comment:

In a batch file,
if I write "copy C:\My Documents\testfile.txt C:\"
the response is 'Too many parameters'
if I write "copy C:\My Doc~1\testfile.txt C:\"
the response is 'Too many parameters'
if I write "copy C:\My_Doc~1\testfile.txt C:\"
the response is 'File not found'
How should 'My Documents' be scripted to 'work' in a batch file ?

Basty



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: September 28, 2007 at 21:15:53 Pacific
Reply:

This is more of a post for the Windows forums, but I'm feeling nice tonight.

copy "C:\My Documents\testfile.txt" c:\
copy C:\MYDOCU~1\testfile.txt c:\


0

Response Number 2
Name: Sebastian42
Date: September 29, 2007 at 00:12:47 Pacific
Reply:

Nice-feeling-tonight Razor2.3
I WILL try - but you seem to imply that spaces can just be ignored IN THIS CONTEXT.


Basty


0

Response Number 3
Name: StuartS
Date: September 29, 2007 at 03:40:50 Pacific
Reply:

Sebastian

You will notice that in the first example posted by Razor C:\My Documents\testfile.txt is enclosed in double quotes which forces the processor to treat the entire path name as a single entity. Without he quotes the spaces become a delimiter. Hence the to many parameters.

In the second example the first six characters of My Documents, minus spaces are used plus ~1 to give the short file name of eight characters. You can't arbitrarily make up your own short name. You have to use the one generated by the system which follows a well defined set of rules which includes the elimination of spaces.

http://support.microsoft.com/kb/142982

Stuart


0

Response Number 4
Name: Sebastian42
Date: September 30, 2007 at 04:00:37 Pacific
Reply:

StuartS
Thanks for drawing my attention to that - it had escaped me ! I was a bit puzzled by that cryptic reply.

I AM aware of DOS's (?) habit of truncating long names at the sixth letter then, adding '~1'

Basty


0

Response Number 5
Name: StuartS
Date: September 30, 2007 at 04:44:48 Pacific
Reply:

>>I AM aware of DOS's (?) habit ... <<

It's not DOS's habit, its Window's that does it by design. DOS has no knowlege or understanding of long file names. That is why Windows has to truncate them.

Stuart


0

Related Posts

See More



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 Programming Forum Home


Sponsored links

Ads by Google


Results for: scripting 'My Documents'

Batch Copy My Documents www.computing.net/answers/programming/batch-copy-my-documents/15214.html

TugZip Script Editor www.computing.net/answers/programming/tugzip-script-editor/14603.html

Please Proof My Batch www.computing.net/answers/programming/please-proof-my-batch/15047.html