如何从批处理文件运行cmd并将文本添加到行而不执行? [英] How can I run cmd from batch file and add text to line without executing?

查看:582
本文介绍了如何从批处理文件运行cmd并将文本添加到行而不执行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使file.bat应该运行我的jar只有当用户按enter键。
蝙蝠必须运行,不执行任何操作,没有用户按enter键。
在cmd中应打印:

  java -jar crawler-1.0.jar 



该用户的一个部分可以更改this.text



这是?

解决方案

对不起。我认为这个问题的真正目标是:如何预填充cmd.exe命令行输入一个可编辑的字符串,所以用户可以只是按Enter键执行预填充的输入,或以任何所需的方式编辑。我复制了以下方法从此帖

  @if(@CodeSection == @Batch)@then 

@echo off
rem输入键盘缓冲区中的预填充值
CScript // nologo // E:JScript%〜F0java -jar crawler-1.0.jar
goto:EOF

@end

WScript.CreateObject(WScript.Shell)。SendKeys(WScript.Arguments(0));


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:

java -jar crawler-1.0.jar

A part from that user could change this.text

How can I do this?

解决方案

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));

这篇关于如何从批处理文件运行cmd并将文本添加到行而不执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆