【问题标题】:Working with batch files might need some help (; [closed]使用批处理文件可能需要一些帮助 (; [关闭]
【发布时间】:2017-07-23 23:16:34
【问题描述】:

我为技术支持诈骗制作了一个简单的批处理脚本,但我希望它在诈骗者运行 dir /s 或 tree /s 时也运行它,我该怎么做?

【问题讨论】:

  • 您希望如何区分诈骗者和非诈骗者?
  • 我用了一个 adfly rip off 来找到一个假的弹出窗口
  • 不知道你想要完成什么。您需要更好地描述您的任务并提供您已经在使用的代码。否则这个问题将被关闭。
  • 内置命令不能被覆盖(AFAIK),相反,您需要让它们使用 fake 控制台,您可以基于 CMD++ - mirum.weebly.com/cmd
  • @SamDenty - 您不需要覆盖命令,只需监视 dirtree 的命令历史记录。不过,仍然无法批量处理。

标签: batch-file tree directory


【解决方案1】:

基于CMD++,此batch-file 将像正常的命令提示符一样工作,直到treedir 作为命令输入。让它在startup of CMD by using a solution like this上运行

脚本:

@echo off
call :Variables
:CMD
:::::::::::::::::::::::::::::::::::::::::
:: CMD++ - http://mirum.weebly.com/cmd ::
:::::::::::::::::::::::::::::::::::::::::
:NormalMode
    color 07
    title C:\WINDOWS\system32\cmd.exe
    echo Microsoft Windows [Version 10.0.14986]
    echo (c) 2016 Microsoft Corporation. All rights reserved.
    goto :cmdCommand
:cmdCommand
    echo.
:cmdCommand2
    set "cmdCommand="
    %echo% C:\Users\%username%&set /p "cmdCommand=>"
    if not defined CmdCommand (goto :CmdCommand2)
    set "CMDCmd=%cmdCommand:"=%"
    call :commands
goto :cmdCommand
:commands
    if /i "%CMDCmd:~0,3%"=="dir" goto :execute
    if /i "%CMDCmd:~0,4%"=="tree" goto :execute
    %cmdCommand%
    goto :cmdCommand
:Variables
    set "cmd++=goto cmdCommand"
    set "echo=<nul set /p ="
goto :EOF

:execute
    echo They entered 'dir' or 'tree'
    pause
goto :EOF

示例输出:

Microsoft Windows [版本 10.0.14986]
(c) 2016 年微软公司。保留所有权利。

C:\Users\samde>echo hello world
你好世界

C:\Users\samde>暂停
按任意键继续 。 . .

C:\Users\samde>树
他们输入了“目录”或“树”
按任意键继续 。 . .

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-02
    • 1970-01-01
    • 1970-01-01
    • 2018-06-15
    相关资源
    最近更新 更多