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-18 23:52
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » You mentioned content seems a bit incomplete. If it's "ghost前要求输入密码" which can be translated as "The password is required before using Ghost" View 3,257 Replies 22
Original Poster Posted 2007-06-07 23:26 ·  中国 福建 福州 电信
新手上路
Credits 18
Posts 8
Joined 2007-06-07 22:55
19-year member
UID 90618
Gender Male
Status Offline
An office public computer, I installed XP and DOS dual systems, and made an automatic GHOST batch file. It's too convenient, so the system is often entered into DOS to randomly GHOST restore. I want to require entering a password before GHOST restore <to confuse some people>. The batch code is as follows:
@echo off
set a=
set/p a=password:
if /i "%a%"=="123" goto aa
exit
::The following part replaces the GHOST command with parameters
:aa
echo Hello
pause

The above statements execute well under WINDOWS. But under DOS, the password input part is not executed. Please help, why? Do I need to load something first to execute the password input part under DOS?

Request a code that requires a password to execute GHOST. Thanks in advance!
Floor 2 Posted 2007-06-08 01:21 ·  中国 黑龙江 哈尔滨 电信
高级用户
★★★
Credits 760
Posts 357
Joined 2005-10-10 22:33
20-year member
UID 43332
Status Offline
GHOST supports encrypted backups! So there's no need to make any encryption requirements anymore!
Floor 3 Posted 2007-06-08 06:14 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Originally posted by hdyue at 2007-6-7 23:26:
An office public computer, I installed XP and DOS dual systems, and made an automatic GHOST batch file. It's too convenient, so the system is often entered into DOS by others to randomly GHOST restore. I want to ... before GHOST restore...

set/p a=password: is only applicable to cmd, and choice command is needed for DOS.
Windows 一键还原
http://www.yjhy.com
Floor 4 Posted 2007-06-08 06:15 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Originally posted by 0451lym at 2007-6-8 01:21:
GHOST supports encrypted backups!
So there's no need to have additional encryption requirements!

The purposes of the two passwords are different. In my opinion.
Windows 一键还原
http://www.yjhy.com
Floor 5 Posted 2007-06-08 11:23 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 866
Posts 415
Joined 2005-12-04 11:19
20-year member
UID 46459
Status Offline
What the person above said is very clear. The CHOICE command is also very powerful.
欢迎你到批处理爱好者联盟QQ群:18023953
Floor 6 Posted 2007-06-08 20:01 ·  中国 广西 桂林 电信
新手上路
Credits 12
Posts 5
Joined 2007-06-08 13:31
19-year member
UID 90662
Gender Male
Status Offline
Now there are still a few people in the office who know DOS? Don't you just have one menu to enter DOS only and one to enter the system?
Floor 7 Posted 2007-06-09 00:42 ·  中国 福建 福州 电信
新手上路
Credits 18
Posts 8
Joined 2007-06-07 22:55
19-year member
UID 90618
Gender Male
Status Offline
I understand what you said on the 2nd floor, but the password of GHOST is fixed. Can the password be changed? Tell me where to change it.

I don't quite understand what you said on the 3rd floor. Because I have also tried the following code. The effect is also that the password part is not executed, and it directly executes the :aa part.

@echo off
set choice=
set /p choice= password:
IF NOT "%Choice%"=="" SET Choice=%Choice:~0,1%
if /i "%choice%"=="h" goto aa
exit
::The following part replaces the GHOST command with parameters
:aa
echo Hello
pause
Floor 8 Posted 2007-06-09 07:58 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
The `choice` is an external command.
Windows 一键还原
http://www.yjhy.com
Floor 9 Posted 2007-06-09 08:22 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
It seems that choice can only input one character. Not ideal. For entering long passwords, it is suggested to use wbat. Found the instructions, you can take a look.
------------------------
:box Input Box Instructions

~[$Variable, Length, Parameter]~ This format means that the content entered in the input box will be copied to ~%%Variable%%~

Among them, ~Length~ and ~Parameter~ can be ignored

The ~Length~ indicates the maximum number of characters that can be entered. For example, ~[$Variable, 2]~ can only enter 2 characters

If ~Length~ is ignored, such as ~[$Variable ]~, the length at this time is the size of the square brackets

Parameters include
U Always display uppercase letters
P Password input box, displaying ***
! Must be entered and cannot be empty unless the window is closed by pressing ESC

Such as ~[$password, 9, P!]~

It means that a password with a maximum of 9 digits must be entered, and the entered value is stored in %%password%%
Windows 一键还原
http://www.yjhy.com
Floor 10 Posted 2007-06-09 17:37 ·  中国 福建 福州 电信
新手上路
Credits 18
Posts 8
Joined 2007-06-07 22:55
19-year member
UID 90618
Gender Male
Status Offline
The `choice` indeed can only input one character, but it can be defined in which position, which is not bad. The key issue is which internal command to use to implement password input. I can't tell which are internal commands and which are external commands. I have tried more than these two password statements, and as a result, the password statement part is not executed in pure DOS. I don't have requirements for password strength, as long as there is a password. Which expert can help? Thanks.
Floor 11 Posted 2007-06-09 17:41 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Simply put, commands that can be executed as long as there is command are internal commands, such as dir, copy, etc. Commands that need additional special files to be executed are external commands, such as format, fdisk, attrib, etc.
Windows 一键还原
http://www.yjhy.com
Floor 12 Posted 2007-06-09 17:44 ·  中国 福建 福州 电信
新手上路
Credits 18
Posts 8
Joined 2007-06-07 22:55
19-year member
UID 90618
Gender Male
Status Offline
lianjiang2004, hello!

Is my problem not achievable under pure DOS?

Can you help write one? I don't have requirements for password strength, as long as there is a password.
Floor 13 Posted 2007-06-09 17:50 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Using choice is purely for DOS.
Just checked a post, which also uses choice, but can achieve verifying multi-digit passwords. For reference.
-----------------------------------------
Save the following as a batch file. Then modify it as needed.
@echo off
:: Set the initial password, only lowercase letters and numbers are allowed
set pass=chenallqq368178720
:: Input password and verify
:pass
cls
echo.
echo.
echo. Please input your password!
echo.
echo. Password:%xxx%
choice /c:abcdefghijklmnopqrstuvwxyz1234567890 /N
if errorlevel 1 set chk=a
if errorlevel 2 set chk=b
if errorlevel 3 set chk=c
if errorlevel 4 set chk=d
if errorlevel 5 set chk=e
if errorlevel 6 set chk=f
if errorlevel 7 set chk=g
if errorlevel 8 set chk=h
if errorlevel 9 set chk=i
if errorlevel 10 set chk=j
if errorlevel 11 set chk=k
if errorlevel 12 set chk=l
if errorlevel 13 set chk=m
if errorlevel 14 set chk=n
if errorlevel 15 set chk=o
if errorlevel 16 set chk=p
if errorlevel 17 set chk=q
if errorlevel 18 set chk=r
if errorlevel 19 set chk=s
if errorlevel 20 set chk=t
if errorlevel 21 set chk=u
if errorlevel 22 set chk=v
if errorlevel 23 set chk=w
if errorlevel 24 set chk=x
if errorlevel 25 set chk=y
if errorlevel 26 set chk=z
if errorlevel 27 set chk=1
if errorlevel 28 set chk=2
if errorlevel 29 set chk=3
if errorlevel 30 set chk=4
if errorlevel 31 set chk=5
if errorlevel 32 set chk=6
if errorlevel 33 set chk=7
if errorlevel 34 set chk=8
if errorlevel 35 set chk=9
if errorlevel 36 set chk=0
set input=%input%%chk%
set xxx=%xxx%*
:: Password check, if correct then exit
if #%pass%==#%input% goto end
goto pass
:end
If you enter chenallqq368178720 in sequence when running, it will exit; otherwise...
This is a batch file for password verification, which can be modified to become a batch file for setting the password.
Windows 一键还原
http://www.yjhy.com
Floor 14 Posted 2007-06-09 18:06 ·  中国 福建 福州 电信
新手上路
Credits 18
Posts 8
Joined 2007-06-07 22:55
19-year member
UID 90618
Gender Male
Status Offline
lianjiang2004, hello! Thank you.

The code you provided I've also seen, but haven't tried. The reason is that the code I use is so simple, and it doesn't work after running, so I don't dare to try such a complex one, but I will try. Thank you.

I don't know if my question is clear. I mean, after the dual menu selection DOS appears, before running a batch processing for GHOST, I hope there is a simple password, that is, I don't want to be casually GHOST.

I used the choice command in the batch processing <see 7th floor>, when executing the batch processing also doesn't appear the password part, directly execute the subsequent statements, what reason makes the password statement be skipped past?

Help. Can give a complete statement, thanks.
Floor 15 Posted 2007-06-09 18:31 ·  中国 安徽 马鞍山 电信
金牌会员
★★★★
Credits 3,946
Posts 1,884
Joined 2006-01-20 13:00
20-year member
UID 49283
Gender Male
Status Offline
Post the code you wrote. Did you include the executable file of choice?
Windows 一键还原
http://www.yjhy.com
Forum Jump: