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-13 23:48
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » Old illness, new medicine: Entering Chinese directories in non-Chinese environments View 4,771 Replies 35
Original Poster Posted 2005-09-02 17:36 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
To All:

In a pure DOS environment without loading any Chinese character system or platform, how to enter a Chinese - named directory is an old problem. It may be encountered when using a boot disk to restore the system. If the directory where the Ghost image is located has a Chinese name, an ordinary Win98 boot disk definitely has no Chinese environment support. At this time, what should we do?

A classic and popular solution is to use dir>file, then edit file, keep the Chinese garbled part, then add cd space in front, save it as enter.bat, and then return to DOS, and then you can enter the Chinese - named directory by entering enter.

However, this is not the original intention of "old problem new medicine". My question is, how to enter a Chinese - named directory using only internal commands, so edit is ruthlessly abandoned.

The detailed description of the question is as follows:

1. There is only one directory named "Test" under the target disk D:. How to enter this directory at the command line using only DOS internal commands.

2. There are two directories under D:, named "Test" and "test" respectively, the rest are the same as 1;

3. There are two directories under D:, named "Test" and "Test 2" respectively, the rest are the same as 1;

4. There are two directories under D:, both with Chinese names, and only one directory contains a file named test.dat. How to enter this directory at the command line using only DOS internal commands;

5. There are three directories under D:, all with Chinese names, and only one directory contains a file named test.dat, the rest are the same as 4;

6. There are three directories under D:, named "Test 1", "Test 2", "Test 3" respectively. How to enter the "Test 2" directory at the command line using only DOS internal commands;

7. There are three directories under D:, named "Test One", "Test Two", "Test Three" respectively. How to enter the "Test Three" directory at the command line using only DOS internal commands;

Last: Realize the above requirements in a batch file. No external commands can be used in the batch file either.

[ Last edited by willsort on 2006 - 4 - 18 at 23:25 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 2 Posted 2005-09-04 18:42 ·  中国 安徽 宿州 电信
银牌会员
★★★
Credits 1,339
Posts 595
Joined 2004-05-26 00:00
22-year member
UID 25306
Gender Male
From 安徽 宿州
Status Offline
It is indeed a challenge. Learning...
Floor 3 Posted 2005-09-04 19:38 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
Hehe, debug + for + find, I estimate it can be solved, but there's no practical value.

I think researching this problem also has no great practical value. It's purely technical.
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 4 Posted 2005-09-04 19:54 ·  中国 山西 临汾 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re Climbing:

debug and find are both external commands, which are outside the scope of the problem.

As for the practicality of the problem, it is useful when encountering Chinese directories in the system entered with a simple DOS/Win98 boot disk (containing only the essential boot files). I have encountered many such situations in the past.

The difficulty of the problem should not be very great. I will start to add a few more sub - problems.

[ Last edited by willsort on 2005-9-4 at 20:32 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 5 Posted 2005-09-04 20:47 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
To be honest, I'm not very clear about which internal commands DOS has. Since I can't use debug and find, I'll just use prompt. I'll just wait for you to announce the answer to learn. Hehe
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 6 Posted 2005-09-04 21:10 ·  中国 山西 临汾 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re Climbing:

The internal commands of DOS are the commands supported internally by COMMAND.COM, which can be obtained by referring to the help documentation of MS-DOS. The internal commands used in this question will not be many, and there will not be very obscure usages. Probably just a few commands like dir/cd/copy, and some simple batch processing might be used. I didn't consider prompt.

In addition, it should be noted that the previous sub-questions are all independent of each other, there is no order, and there is no requirement to implement all of them. I only have a general idea myself, and except for the last sub-question, the others are all required to be implemented at the command line, which increases a lot of operational freedom.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 7 Posted 2005-09-04 23:13 ·  中国 山东 青岛 联通
中级用户
★★
Credits 232
Posts 53
Joined 2005-08-24 07:03
20-year member
UID 41889
Gender Male
From 中国
Status Offline
Originally posted by willsort at 2005-9-2 17:36:
To All:

In a pure DOS environment without loading any Chinese character system or platform, how to enter a Chinese directory is an old problem. It may be encountered when using a boot disk to restore the system. If Ghost...

I don't know what's wrong, my computer always has problems and doesn't behave. I did a test according to your old method and got this message:The filename,directory name,or volume label syntax is incorrect.The general meaning of this sentence is that the filename, directory name, or volume label syntax is incorrect. What is the reason for this?

[ Last edited by badcfqtd on 2005-9-4 at 23:15 ]
Floor 8 Posted 2005-09-05 12:41 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re badcfqtd:

Please post the detailed content of your enter.bat in detail
请贴出你的enter.bat的详细内容请以自然流畅的英文书面语呈现,保持专业、冷静且符合复古计算、DOS等技术相关主题的语气。请贴出你的enter.bat的详细内容
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 9 Posted 2005-09-05 17:14 ·  中国 山东 青岛 联通
中级用户
★★
Credits 232
Posts 53
Joined 2005-08-24 07:03
20-year member
UID 41889
Gender Male
From 中国
Status Offline
No, thank you. Actually, it really can't be used under MS-DOS. But the DOS711 I downloaded from our union doesn't have EDIT.EXE, which is why it always prompts an error command. However, copying the EDIT.EXE from WINXP over works, so I'll just make do with it.

[ Last edited by badcfqtd on 2005-9-5 at 18:01 ]
Floor 10 Posted 2005-09-06 19:31 ·  中国 山西 运城 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re All:

Let me first present my solution for question 1. Execute the following commands in sequence at the command line:


d:
cd \
copy con enter.bat
cd (Type Ctrl+Z or press the "F6" key, without parentheses)
dir /ad /b>>enter.bat
enter


[ Last edited by willsort on 2005-9-8 at 11:21 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 11 Posted 2005-09-08 10:24 ·  中国 重庆 电信
高级用户
★★
Credits 772
Posts 273
Joined 2004-10-23 00:00
21-year member
UID 32861
Gender Male
Status Offline
I will publish the methods for the following questions.
Since there is no DOS environment, please everyone test it.

Question 2:
attrib +h +s +a /d /s
attrib -s -h test
copy con 123.bat
::Enter "cd" + "space" and then press F6
dir /adhsa /b>>123.bat
call 123.bat

Question 3:
copy con 234.bat
::Enter set a= and then press F6
dir /ad /b>>234.bat
call 234.bat
del 234.bat
if exist %a%2 goto cd_
attrib +s +h +a /s /d *
attrib -s -h %a%
copy con 234.bat
::Enter "cd" + "space" and then press F6
dir /adsha /b *>>234.bat
call 234.bat

:cd_
cd %a%
pause

Question 4:
copy con 234.bat
::Enter set a= and then press F6
dir /ad /b>>234.bat
call 234.bat
del 234.bat
if exist %a%\test.dat goto cd_
attrib +s +h +a /s /d *
attrib -s -h %a%
copy con 234.bat
::Enter "cd" + "space" and then press F6
dir /adsha /b *>>234.bat
call 234.bat

:cd_
cd %a%
pause

Question 6:
copy con 234.bat
::Enter set a= and then press F6
dir /ad /b>>234.bat
call 234.bat
del 234.bat
attrib +h +r +a /s /d *
attrib -h -r -a %a%
copy con 234.bat
::Enter "cd" + "space" and then press F6
dir /adhar /b *>>234.bat
call 234.bat
pause
http://www.msfans.net/bbs/
Floor 12 Posted 2005-09-08 11:31 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re chenhui530:

Indeed different from my thinking, but the attrib there is an external command, which doesn't meet the topic restriction. And the goto command won't work in the command line either. If your solution is a batch file, then after the copy con statement, using cd or set won't get the effect you expect.

As for testing, you can do the same test in the Windows command line, as long as it's not a Chinese environment. In XP, you can start the command line with command, or after starting cmd, change the code page with chcp 437. The directory address can also be changed from the root of drive D to other subdirectories, as long as the solution doesn't depend on a special path.

Now present my solution for the second question (tested under MSDOS7.1):


d:
cd\
echo cd %1>callcd.bat
copy con enter.bat
callcd (Type Ctrl+Z or F6, without the parentheses)
dir /ad /o-n /b>>enter.bat
enter



───────────────── Moderator's Note ─────────────────
The red and underlined remarks in the post are currently deemed inappropriate. Please take note!
For specific discussion, refer to the replies in posts 22-26 of this topic
───────────────── Moderator's Note ─────────────────


[ Last edited by willsort on 2006-4-19 at 15:11 ]
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 13 Posted 2005-09-10 06:42 ·  中国 安徽 宿州 电信
银牌会员
★★★
Credits 1,339
Posts 595
Joined 2004-05-26 00:00
22-year member
UID 25306
Gender Male
From 安徽 宿州
Status Offline
Re comrade re:
Now it seems that the application of your scheme is still limited. Because under normal circumstances, there are N directories and N files on drive D:. But yours are only one directory, two directories, three directories.

[ Last edited by chujiafu on 2005-9-10 at 06:53 ]
Floor 14 Posted 2005-09-10 10:14 ·  中国 山西 运城 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re chujiafu:

Any complex problem is composed of simple parts. If we can solve these simple parts well, then any complex composition should not be difficult for us.

The one, two, and three directories specified in my question are just to simplify the complexity of the problem, but they have already covered many aspects of the problem. As long as we can apply what we have learned flexibly, we should be able to solve most practical application problems. Even if there are multiple directories and multiple files in the path, we can filter out the target we need through various methods.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 15 Posted 2005-09-16 10:05 ·  中国 山西 大同 中移铁通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re All:

Here is my solution for question 3:

d:
cd \
copy con enter.bat
cd (Type Ctrl+Z or press the "F6" key, excluding the parentheses)
dir ???? /ad /b>>enter.bat
enter
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: