中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-11 08:56
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Help: Batch script to create a new folder
Printable Version  3,023 / 18
Floor1 eech Posted 2006-11-11 11:35
高级用户 Posts 346 Credits 906
Every time I create a new folder, I always have to right-click on the desktop, select "New - Folder". It would be great if there was such a batch script. I don't know if it's just a fantasy. Please, experts, give me an answer. I'm looking forward to it.

Like this would be fine.

Now everyone understands what I mean. The shortcut of my batch file can only create a new folder in the root directory of drive F after I click it. Because I added its shortcut to the left in the root directory of drive F. How can I create it in any folder, like "variables or something?" Hehe. I'm a newbie. It's really hard to explain clearly.

[ Last edited by eech on 2006-11-12 at 12:44 AM ]
Floor2 lxmxn Posted 2006-11-11 14:38
版主 Posts 4,938 Credits 11,386
```
md
```
Floor3 namejm Posted 2006-11-11 20:52
荣誉版主 Posts 1,737 Credits 5,226 From 成都
Hehe, lxmxn ignored the situation where the folder name has spaces. It would be even better if it were `md "folder name"`.
Floor4 ccwan Posted 2006-11-11 23:22
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Strive for excellence. Don't let small issues pass.
Floor5 maya0su Posted 2006-11-12 00:06
中级用户 Posts 131 Credits 241
I think this is more perfect
md c:\docume~1\%username%\Desktop\"%date%"
Or
md c:\docume~1\"all users"\Desktop\"%date%"

It's even more perfect. Not only does it create a folder, but the folder's name is also the current date and the day of the week
(PS: On some machines, the day of the week may not be displayed)


When there is such a question
The %userprofile% variable can enter C:\Documents and Settings\%username%\ when you CD %userprofile%
But this variable cannot be referenced when creating a new folder. Why?
Hope an expert can explain.... Looking forward to it....
Floor6 namejm Posted 2006-11-12 00:16
荣誉版主 Posts 1,737 Credits 5,226 From 成都
When creating a new folder, you can't reference the %userprofile% variable? No way. Either you didn't enclose it in quotes, or your folder name contains illegal characters and the creation fails, causing you to mistakenly think that you can't reference the %userprofile% variable.
Floor7 eech Posted 2006-11-12 00:22
高级用户 Posts 346 Credits 906
Wow, I really admire you all. There's really something here. Hehe
Floor8 eech Posted 2006-11-12 00:23
高级用户 Posts 346 Credits 906
Great experts, there is a problem. What I want is to be able to create a new folder in any place and directory.
Floor9 ccwan Posted 2006-11-12 00:26
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Where should I put the batch file so that I can create a folder in the current path. Unless you want to create it under each folder, it seems like a virus ^_^
Floor10 eech Posted 2006-11-12 00:29
高级用户 Posts 346 Credits 906
Friends, let's voice my concerns. What I hope for is to place the shortcut of the newly created folder in the Quick Launch bar.

For example, if I'm on the E drive, then when I click this batch file, where is the shortcut newly created?

Can it be done to newly create a folder in my current directory?

[ Last edited by eech on 2006-11-12 at 12:34 AM ]
Floor11 ccwan Posted 2006-11-12 00:35
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Originally posted by eech at 2006-11-12 00:29:
Friends, let me express my concerns. What I hope is to place the shortcut of the newly created folder in the Quick Launch bar.

For example, if I am on drive E, then clicking this batch file, where will a new shortcut be created..



I'm confused.
What is the difference in convenience between placing the shortcut of the newly created folder in the Quick Launch bar and right-clicking on the desktop - New - Folder?

"The new folder has to be right-clicked on the desktop every time to create a new one. If there is this batch file, it would be great. I don't know if it's a fantasy. Please ask experts to answer. Looking forward to it"
Is the above your requirement?
Floor12 ccwan Posted 2006-11-12 00:36
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Your picture came just in time! I just posted it and it arrived right away. Hehe
Floor13 eech Posted 2006-11-12 00:36
高级用户 Posts 346 Credits 906
Then where should I put my batch file?
Floor14 ccwan Posted 2006-11-12 00:39
金牌会员 Posts 1,160 Credits 2,725 From 河北廊坊
Your Windows XP has this function! Why do you still do that?
Floor15 maya0su Posted 2006-11-13 04:21
中级用户 Posts 131 Credits 241
RE:namejm
For the %userprofile% I did forget to add "", which led to the problem of not being able to create a new folder.
Thank you for your reminder, which made me understand that the role of "" is indeed great!
Hehe...
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023