Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

md .bat command in XP when path has spaces?

Status
Not open for further replies.

Lunatic

Technical User
May 8, 2006
405
US
Okay, 1. I'm not a programmer. 2. The last time I played with .bat files was somewhere in the late 90's and even then it was pretty low key as I never did get my door game BBS up and running, so I'm pretty out of the loop.

In W95 and W98 I believe path names were truncated at 8 characters in the command prompt, so Program Files became Progra~1. However in XP it appears that it states Program Files.

Which leads to my problem. I'm trying to create a .bat file that will auto-run when a CD is inserted (not a problem) and make a folder on the user desktop, and then copy the files in.

I'm having serious problems though creating the folder on the desktop.

md c:\documents and settings\$username\folder creates a folder called documents, with a subfolder 'and' containing a subfolder 'settings'... etc.

Is there a way in XP to use the md command for a path name that includes spaces? Is there another way to accomplish this same task? Or am I SOL?

Thanks!

***************************************
Have a problem with my spelling or grammar? Please refer all complaints to my English teacher:
Ralphy "Me fail English? That's unpossible." Wiggum
 
Try putting the path inside quotation marks for folders/directories with spaces in them. I just tried this from a command prompt and it worked fine.

Lee
 
It doesn't create the folder in desired location. Its making the folder in the location the .bat file is at.

md C:\Documents and Settings\All Users\Desktop\test2
and
md "C:\Documents and Settings\All Users\Desktop\test2"

Return the same result. I placed the .bat file in:
C:\Documents and Settings\All Users\Desktop\1

And the folder was created in the "1" folder, rather than at the desktop.

****

I'm wondering if .bat support in XP simply isn't as advanced as the command prompt (I've noticed command prompt is far more robust than .bat files running)

Thanks!

***************************************
Have a problem with my spelling or grammar? Please refer all complaints to my English teacher:
Ralphy "Me fail English? That's unpossible." Wiggum
 
Actually that worked. I was leaving the .bat file open in an edit mode, which seemed to maean it used a previous version of the .bat file.

I closed the editing of the file and tried again and it worked.

Thanks!

***************************************
Have a problem with my spelling or grammar? Please refer all complaints to my English teacher:
Ralphy "Me fail English? That's unpossible." Wiggum
 
Are you trying to place it on the desktop of ALL USERS or JUST the CURRENT ACTIVE USER?

Lunatic said:
I'm having serious problems though creating the folder on the desktop.

md c:\documents and settings\$username\folder creates a folder called documents, with a subfolder 'and' containing a subfolder 'settings'... etc.

For the current active user, you should use the user's profile setting:

md "%userprofile%\desktop\My Test Box"

Since you haven't used DOS in a little while, at the command prompt you can type in SET and see the current enviromental settings available for use. But a word to the wise: If you don't know what one setting does; then don't use it! and stick to the ones you do know.

Good Luck,
--MiggyD

--> It's a bird! It's a plane! No, it's an OS update patch! Ahh!! <--
 
MiggyD,

Actually we issue laptops with sequential login IDs, so the 1st person is ID1, the second is ID2, ID3, etc. The accounts have admin rights.

So the end results is for the first laptop I'd want the install path to be:

c:\documents and settings\ID1\Desktop\folder

for the second
c:\documents and settings\ID2\Desktop\folder

----

Unfortunately these are all off-site staff with dial-up connections, so large release like this (probably close to 300 megs when all is said and done), is a viable option. We don't have access to the laptops, nor do they have the technical know-how (in some cases) to do much.

I was looking for a way to set up a CD so as soon as they pop it in the drive it creates a folder on their desktop and copies all the desired files over.

I think using the All Users folder will work, and with the quotation marks it seems to function as desired.

It isn't the most elegant option, but it works.

Thanks for the advice though, I have a new toy to look at (even if I don't ever use it).

***************************************
Have a problem with my spelling or grammar? Please refer all complaints to my English teacher:
Ralphy "Me fail English? That's unpossible." Wiggum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top