【问题标题】:How can I automate this code to input the computername from a txt. list?如何自动化此代码以从 txt 输入计算机名。列表?
【发布时间】:2021-08-03 23:23:23
【问题描述】:
sc \\computername  query box
sc \\computername  start box
sc \\computername  query crystal
sc \\computername  start crystal


taskkill /s computername  /im crystal.exe /f
taskkill /s computername  /im box.exe /f

【问题讨论】:

    标签: command-line command


    【解决方案1】:

    你可以试试这个:

    @echo off
    
    for /f "tokens=*" %%F in (list.txt) do (
        echo sc \\%%F  query box
        echo sc \\%%F  start box
        echo sc \\%%F  query crystal
        echo sc \\%%F  start crystal
    
    
        echo taskkill /s %%F  /im crystal.exe /f
        echo taskkill /s %%F  /im box.exe /f
    )
    pause
    

    【讨论】:

    • 将此命令写入批处理文件,例如notepad automate.cmd。保存文件并从记事本退出。比执行批处理文件。在命令提示符处写automate
    • 我在 CMD 中运行了这个,但出现错误你能告诉我如何使用它吗?抱歉,我是新手。
    猜你喜欢
    • 2020-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-09
    • 1970-01-01
    • 1970-01-01
    • 2016-07-15
    • 1970-01-01
    相关资源
    最近更新 更多