【问题标题】:How to identify user input help (/?) in batch file如何在批处理文件中识别用户输入帮助(/?)
【发布时间】:2015-08-29 18:57:42
【问题描述】:

通常在大多数批处理命令中,它使用/? 来获取特定命令的描述或帮助。 那么有没有办法通过输入/? 作为参数来识别用户正在寻求帮助(mybatchfilename /?

我试过IF %1==/? goto Help。但似乎? 在批处理命令中有特殊含义。

有什么帮助吗?

【问题讨论】:

    标签: windows batch-file cmd command-line-arguments


    【解决方案1】:

    如果没有选择开关,我在这里显示帮助。最后一行还显示了如何测试特定参数(/ud,但您可以将其更改为 -?/?

    If not "%1"=="" goto main
    
    echo   Filter.bat
    
    echo   ==========
    echo     The Filter program is a vbs file for searching, replacing, extracting, and 
    echo     trimming console output and text files.
    echo.
    echo     Filter.bat makes Filter.vbs easily usable from the command line. It 
    echo     controls unicode/ansi support and debugging.
    echo.
    echo       Type Filter /? for more information.
    echo.
    
    cscript //nologo "C:\Users\David Candy\Desktop\Filter.vbs" menu
    Goto :EOF
    
    :Main
    
    Rem /ud Unicode and Debug
    
    If %1==/ud FOR /F "tokens=1*" %%i IN ("%*") DO cscript "C:\Users\David Candy\Desktop\Filter.vbs" //nologo //u //x %%j&Goto :EOF
    

    【讨论】:

      猜你喜欢
      • 2011-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多