China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-11 09:48
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Help: Batch script to create a new folder View 3,026 Replies 18
Original Poster Posted 2006-11-11 11:35 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
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 ]
Floor 2 Posted 2006-11-11 14:38 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
```
md
```
Floor 3 Posted 2006-11-11 20:52 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
Hehe, lxmxn ignored the situation where the folder name has spaces. It would be even better if it were `md "folder name"`.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 4 Posted 2006-11-11 23:22 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Strive for excellence. Don't let small issues pass.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 5 Posted 2006-11-12 00:06 ·  中国 山西 运城 移动
中级用户
★★
Credits 241
Posts 131
Joined 2005-09-28 19:01
20-year member
UID 42920
Gender Male
Status Offline
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....
房东说:这娃是个好孩子!
Floor 6 Posted 2006-11-12 00:16 ·  中国 广东 佛山 广东睿江科技有限公司
荣誉版主
★★★★
batch fan
Credits 5,226
Posts 1,737
Joined 2006-03-10 00:38
20-year member
UID 51697
From 成都
Status Offline
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.
尺有所短,寸有所长,学好CMD没商量。
考虑问题复杂化,解决问题简洁化。
Floor 7 Posted 2006-11-12 00:22 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Wow, I really admire you all. There's really something here. Hehe
Floor 8 Posted 2006-11-12 00:23 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Great experts, there is a problem. What I want is to be able to create a new folder in any place and directory.
Floor 9 Posted 2006-11-12 00:26 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
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 ^_^
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 10 Posted 2006-11-12 00:29 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
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 ]
Floor 11 Posted 2006-11-12 00:35 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
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?
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 12 Posted 2006-11-12 00:36 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Your picture came just in time! I just posted it and it arrived right away. Hehe
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 13 Posted 2006-11-12 00:36 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 906
Posts 346
Joined 2006-07-10 09:58
20-year member
UID 58334
Gender Male
Status Offline
Then where should I put my batch file?
Floor 14 Posted 2006-11-12 00:39 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Your Windows XP has this function! Why do you still do that?
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 15 Posted 2006-11-13 04:21 ·  中国 北京 鹏博士BGP
中级用户
★★
Credits 241
Posts 131
Joined 2005-09-28 19:01
20-year member
UID 42920
Gender Male
Status Offline
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...
房东说:这娃是个好孩子!
Forum Jump: