![]() |
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-19 00:38 |
47,814 topics / 349,908 posts / today 1 new / 48,259 members |
| DOS疑难解答 & 问题讨论 (解答室) » You mentioned content seems a bit incomplete. If it's "ghost前要求输入密码" which can be translated as "The password is required before using Ghost" |
| Printable Version 3,262 / 22 |
| Floor1 hdyue | Posted 2007-06-07 23:26 |
| 新手上路 Posts 8 Credits 18 | |
|
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! |
|
| Floor2 0451lym | Posted 2007-06-08 01:21 |
| 高级用户 Posts 357 Credits 760 | |
|
GHOST supports encrypted backups! So there's no need to make any encryption requirements anymore!
|
|
| Floor3 lianjiang2004 | Posted 2007-06-08 06:14 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
Originally posted by hdyue at 2007-6-7 23:26: set/p a=password: is only applicable to cmd, and choice command is needed for DOS. |
|
| Floor4 lianjiang2004 | Posted 2007-06-08 06:15 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
Originally posted by 0451lym at 2007-6-8 01:21: The purposes of the two passwords are different. In my opinion. |
|
| Floor5 htysm | Posted 2007-06-08 11:23 |
| 高级用户 Posts 415 Credits 866 | |
|
What the person above said is very clear. The CHOICE command is also very powerful.
|
|
| Floor6 yyuunnnn | Posted 2007-06-08 20:01 |
| 新手上路 Posts 5 Credits 12 | |
|
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?
|
|
| Floor7 hdyue | Posted 2007-06-09 00:42 |
| 新手上路 Posts 8 Credits 18 | |
|
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 |
|
| Floor8 lianjiang2004 | Posted 2007-06-09 07:58 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
|
The `choice` is an external command.
|
|
| Floor9 lianjiang2004 | Posted 2007-06-09 08:22 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
|
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%% |
|
| Floor10 hdyue | Posted 2007-06-09 17:37 |
| 新手上路 Posts 8 Credits 18 | |
|
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.
|
|
| Floor11 lianjiang2004 | Posted 2007-06-09 17:41 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
|
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.
|
|
| Floor12 hdyue | Posted 2007-06-09 17:44 |
| 新手上路 Posts 8 Credits 18 | |
|
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. |
|
| Floor13 lianjiang2004 | Posted 2007-06-09 17:50 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
|
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. |
|
| Floor14 hdyue | Posted 2007-06-09 18:06 |
| 新手上路 Posts 8 Credits 18 | |
|
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. |
|
| Floor15 lianjiang2004 | Posted 2007-06-09 18:31 |
| 金牌会员 Posts 1,884 Credits 3,946 | |
|
Post the code you wrote. Did you include the executable file of choice?
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |