Make Directory with space

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
atamo
Posts: 15
Joined: 17 May 2010 09:14

Make Directory with space

#1 Post by atamo » 11 Apr 2011 12:26

Hy

I need to copy some file in a subfolder of Program Files ,but because Program Files contain a space can't create the directory.

Code: Select all

md c:\Program Files\ProgramName

 or

md %ProgramFiles%\ProgramName


Create a new folder with Program's name but I need to make a directory in Program Files :?

Any ideea ???
Last edited by atamo on 11 Apr 2011 12:54, edited 1 time in total.

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Make Directory with space

#2 Post by !k » 11 Apr 2011 12:34

cmd/? wrote:The special characters that require quotes are:
<space>
&()[]{}^=;!'+,`~

atamo
Posts: 15
Joined: 17 May 2010 09:14

Re: Make Directory with space

#3 Post by atamo » 11 Apr 2011 12:48

Thank's , I forget it..... :oops:


but

Code: Select all

MD %programfiles%\Folder

why don't work ?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Make Directory with space

#4 Post by aGerman » 11 Apr 2011 13:29

Because %programfiles% expands to the real path. It could contain something like C:\Program Files and as you can see there is a space again.

Try

Code: Select all

MD "%programfiles%\Folder"

as suggested before.

Regards
aGerman

atamo
Posts: 15
Joined: 17 May 2010 09:14

Re: Make Directory with space

#5 Post by atamo » 11 Apr 2011 13:41

you're right, thanks for detailed explanation , :mrgreen:

scienceguru1.bat
Posts: 44
Joined: 01 Jan 2011 20:54

Re: Make Directory with space

#6 Post by scienceguru1.bat » 29 Apr 2011 13:50

is there a way to do this with the %date% variable used? i didn't have any luck with it.

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Make Directory with space

#7 Post by !k » 29 Apr 2011 20:35

md "%date:/= %"
/ is your delimiter in date format
also : and \ not allowed in names

Post Reply