Board logo

标题: [其他] EditV32 - 输入显示为星号 (*) [打印本页]

作者: tmplinshi    时间: 2011-7-3 10:41     标题: EditV32 - 输入显示为星号 (*)

==========================
http://bcn.bathome.net/s/tool/index.html?key=EditV32
http://www.westmesatech.com/editv.html
==========================
  1. @echo off
  2. EditV32.exe -m -p "输入密码: " pass
  3. echo 你输入的密码是: %pass%
  4. pause
复制代码
EditVar/EditV32/EditV64 2.2
(C) 2006-2010 by Bill Stewart ([email]bstewart@iname.com[/email])

Description:

EditVar/EditV32/EditV64 is intended for use in shell scripts (aka batch files).
It provides the ability to interactively edit an environment variable's value.
It is provided in three versions:

*   EDITVAR.EXE - real-mode MS-DOS version; works in MS-DOS and in Windows
    9x/Me COMMAND.COM sessions

*   EditV32.exe - Windows x86 (32-bit) console program; requires Windows NT 4.0
    or later; does not work on Windows 9x/Me

*   EditV64.exe - Windows x64 (64-bit) console program

In this documentation, EditVar refers to any version of the program.

EditVar works by obtaining the an environment variable's value (if it exists)
and presents it on the screen for editing. If you make changes to the variable,
EditVar writes the variable back to the environment.

MS-DOS      The MS-DOS version locates the current program's parent environment
            (i.e., the environment block of the program that called it), and
            sets the variable in the parent environment. This procedure is
            specific to MS-DOS and does not work in Windows NT 4.0 or later.

Windows     The Windows x86 and x64 versions obtain the process id of the
x86/x64     parent process (i.e., the program that started EditV32.exe or
            EditV64.exe), and they use Windows API calls to set the variable in
            the environment for the parent process. Note that the x86 version
            (EditV32.exe) will not work on Windows 9x/Me because the Win32 API
            calls it uses do not exist on Win9x/Me, so it will not execute in
            that environment. EditV32.exe requires Windows NT 4.0 or later.

            Note that this behavior is markedly different from most other
            Windows environment modification tools. Most other tools make
            changes to the registry entries that the command shell (usually
            Cmd.exe) reads when it starts. With most of these other tools, if
            you make changes to the registry, the current Cmd.exe session won't
            see them, even if the tool broadcasts the change to Windows.
            EditV32.exe and EditV64.exe don't work this way; they can add
            variables to the Cmd.exe session that started it, as if you used
            the Set command at the prompt.

Cmd.exe in Windows 2000 and later provides the Set /p command to allow user
input into an environment variable, but EditVar provides a richer set of
features:

*   It allows you to edit a variable, not just set one.

*   It can limit the length of the typed variable.

*   It can provide masked input for simple password security.

*   It can limit typed input to numbers only.

*   It offers a timeout feature.

*   It can "escape" reserved shell characters in variables it creates (see
    below for more information).

*   It provides several useful exit codes.

*   The real mode MS-DOS version can be used on MS-DOS bootable media.

For these reasons, EditVar may be preferable to Set /p except in environments
where third-party executables are prohibited.

Usage:

EditVar [-b] [-e] [-l len] [-m] [-n] [-o] [-p prompt] [-t n] [-u] var

Arguments:

-b          Place the cursor at the beginning of the input line (instead of the
            end).

-e          Do not insert shell escape characters before reserved shell
            characters in the environment variable's contents. (Windows x86/x64
            only)

-l len      Limits input to 'len' characters. In MS-DOS, the limit is 255
            characters; In Windows x86/x64, the limit is 2047 characters.

-m          Masked input: Displays '*' for typed characters.

-n          Restricts input to numbers only (0-9).

-o          Starts the line editor in overtype mode instead of insert mode.

-p prompt   Specifies a prompt for the user. If it contains spaces or tabs,
            enclose it in quotes (").

-t n        Assume Enter was pressed if nothing typed within 'n' seconds.

-u          Forces entered characters to uppercase.

var         The environment variable's name (required). This name can be up to
            127 characters long. If the variable name contains spaces, enclose
            it in quotes.

Note that EditVar has only one required command-line argument: The name of the
environment variable you want to edit. All other arguments are optional.

Note: You must place the environment variable name last on the command line
after all other arguments. All other arguments may appear in any order.

If the /? argument is present and is first on the command line, the program
will display a short usage message.

Exit Codes:

1       The command line contains an error
2       Nothing was typed on the input line
3       The environment variable's contents was not changed
4       The user pressed Ctrl-C to abort input
8       Insufficient space in environment to store variable (MS-DOS only)
126     Wrong operating system version or platform

Notes:

*   The Line Editor

    The Line editor uses the following keyboard commands:

    Keystroke           Effect
    ---------------------------------------------------------------------------
    Home                Beginning of input line
    End                 End of input line
    Left Arrow          Left one character
    Right Arrow         Right one character
    Ctrl-Left Arrow     Left one word
    Ctrl-Right Arrow    Right one word
    Ctrl-Home           Delete from cursor position to beginning of input line
    Ctrl-End            Delete from cursor position to the end of input line
    Esc                 Delete the entire input line
    Ctrl-U or Ctrl-Z    Undo (restore the line's original contents)
    Insert              Toggle insert mode
    Backspace           Delete character to left of cursor
    Delete              Delete current character
    Ctrl-C              Abort input

    There is no visual indication of insert or overtype mode. The line editor
    defaults to insert mode unless the -o argument exists on the command line.

*   MS-DOS Version Notes

    *   You can use the MS-DOS version on Windows 9x/Me. It also works in
        real mode DOS (for example, a DOS diskette).

    *   The MS-DOS version does not work (and won't run) on Windows NT 4.0 or
        later.

    *   You can't use any of the following characters in an environment
        variable: < > |

    *   An environment variable's contents can be up to 255 characters long.

    *   If there is not enough space in the environment block to store the
        variable, EditVar.exe will return an exit code of 8.

*   Windows x86 (32-bit) Version Notes

    *   The Windows x86 (32-bit) version does not work (and won't run) on
        Windows 9x/Me. Windows NT 4.0 or later is required.

    *   The Windows x86 version (EditV32.exe) runs, but does not work, in x64
        versions of Windows; it will not set the environment variable. You must
        use EditV64.exe in x64 versions of Windows. You can check the value of
        the PROCESSOR_ARCHITECTURE environment variable to decide which version
        of EditVar you need.

*   Windows x86/x64 Version Notes

    *   The Windows x86 and x64 versions "escape" reserved shell characters in
        the variable they write to the environment. The following characters
        are reserved shell characters:

        ( ) < > ^ & |

        If any of these characters exist in the variable, EditVar will insert
        the shell escape character (^) before each reserved character. The
        variable will be truncated, if necessary, to accommodate the inserted
        escape character(s).

        Note that if you limit input to one character (-l 1) and you type a
        single reserved shell character, EditVar will not save it to the
        environment and will instead return an exit code of 2.

        You can bypass this behavior with the -e argument.

    *   If EditVar fails to set the environment variable in the target process,
        it will display the Windows error message for the last Windows error it
        encountered, and its exit code will equal the last Windows error.

Examples:

1.  editv32 -p "Enter your user name: " NAME

    EditVar will display the following prompt:

    Enter your user name:

    It will then place the contents of the NAME variable on the input line for
    editing.

2.  editv32 -b -l 1 -o -p "Are you sure? " -u YN

    If the variable YN exists, it will appear after the following prompt:

    Are you sure?

    EditVar will place the cursor at the beginning of the input (-b), limit
    input to 1 character (-l 1), and input will be forced to uppercase (-u). In
    addition, the line editor will start in overtype mode (-o).

作者: garyng    时间: 2011-10-11 15:11

这个似乎有同样的功能~
(装载s11ss大大的~)
  1. @echo off&setlocal&pushd %tmp%        %Hide password by displaying *        {s11ss 2007-12-16}%
  2. <"%~f0" more +10|debug>nul&move t "t.com"
  3. echo The length of the password should not bigger than 32!&echo Press any key to continue...&pause>nul&cls
  4. t
  5. echo exit|cmd /kprompt d20:0 20$_q$_|debug>t
  6. for /f "skip=2 tokens=*" %%a in (t) do set t=%%a&call set t=%%t:~61,16%%&call set s=%%s%%%%t%%
  7. for /f "skip=2 tokens=2" %%a in (t) do set/a l=0x%%a&goto :t
  8. :t
  9. cls&echo The password is:&call echo.%%s:~1,%l%%%
  10. del t t.com&popd&echo.&echo Press any key to exit...&pause>nul&goto :eof
  11. e0100 BB 00 B8 8E C3 BF 00 00 BE 00 00 B4 00 CD 16 80
  12. e0110 FC 0E 75 0E 83 FE 00 74 F2 4E 4F 4F 26 C6 05 20
  13. e0120 EB E9 80 FC 1C 74 1C 3C 20 72 E0 26 C6 05 2A 8C
  14. e0130 C2 BB 00 00 8E C3 26 88 84 01 02 8E C2 83 C7 02
  15. e0140 46 EB C8 BB 00 00 8E C3 8B C6 26 A2 00 02 B8 00
  16. e0150 4C CD 21
  17. rcx
  18. 53
  19. n t
  20. w
  21. q
复制代码

作者: facyhu    时间: 2013-5-14 14:19

谢谢lz 分享 就是不怎么会用
作者: facyhu    时间: 2013-5-14 14:49

  1. @echo off
  2. set ci=3
  3. :1
  4. echo 注意: 三次输入错误将退出。
  5. echo.
  6. set /p mima=请输入密码:
  7. if \"%mima%\"==\"123\" goto home
  8. set /a ci-=1
  9. if \"%ci%\"==\"0\" cls&echo.&echo 超出限制次数。&echo.&echo.&exit
  10. cls&echo.&echo 你还有 %ci% 次机会&echo.&goto 1
  11. :home
  12. echo 密码正确
  13. pause >nul
  14. exit
复制代码
版主能告诉我怎么把这个软件运用到这段代码中吗?
作者: LJY4.0    时间: 2022-5-5 09:54

本帖最后由 LJY4.0 于 2022-5-5 09:56 编辑

回复 5# facyhu
    @echo off
set ci=3
:1
echo 注意: 三次输入错误将退出。
echo.
EditV32.exe -m -p "输入密码: " mima
if \"%mima%\"==\"123\" goto home
set /a ci-=1
if \"%ci%\"==\"0\" cls&echo.&echo 超出限制次数。&echo.&echo.&exit
cls&echo.&echo 你还有 %ci% 次机会&echo.&goto 1
:home
echo 密码正确
pause >nul
exit
作者: Zhou.    时间: 2022-5-9 18:48

Error 216: 该版本的 "EditV32.exe" 与你运行的 Windows 版本不兼容。请查看计算机的系统信息,然后联系软件发布者。




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2