How can I run cmd from batch file and add text to line without executing?

前端 未结 4 1265
慢半拍i
慢半拍i 2020-12-04 03:46

I want to make file.bat that should run my jar only when user press enter. Bat must run and does\'t execute anything without user press enter. In cmd should be printed:

4条回答
  •  被撕碎了的回忆
    2020-12-04 04:23

    Excuse me. I think that the real goal of this question is: "How to prefill the cmd.exe command-line input with an editable string", so the user may just press Enter key to execute the prefilled input, or edit it in any desired way. I copied the method below from this post:

    @if (@CodeSection == @Batch) @then
    
    @echo off
    rem Enter the prefill value in the keyboard buffer
    CScript //nologo //E:JScript "%~F0" "java -jar crawler-1.0.jar"
    goto :EOF
    
    @end
    
    WScript.CreateObject("WScript.Shell").SendKeys(WScript.Arguments(0));
    

提交回复
热议问题