这是一个java程序代码,运行记事本程序并粘贴存储在该程序本身中的特定文本......
我想知道您是否可以向我解释一下 的String vbs值,以及中的File file和。如果您这么慷慨,请向我解释整个代码。("cscript //NoLogo " + file.getPath())Process p
我是 Java 初学者,不完全是,但如果你想从 0 到 10 进行判断,我会是 1.5/10
import java.io.File;
import java.io.FileWriter;
import javax.swing.JTextField;
public class PasteToNotepad {
public static void main(String[] args) throws Exception {
String text = "Some text for testing.";
JTextField textField = new JTextField(text);
textField.setSelectionStart(0);
textField.setSelectionEnd(text.length() - 1);
textField.copy();
String vbs = ""
+ "Set WshShell = WScript.CreateObject(\"WScript.Shell\")\n"
+ "WshShell.Run \"notepad\", 9\n"
+ "WScript.Sleep 500\n"
+ "WshShell.SendKeys \"^V\"";
File file …Run Code Online (Sandbox Code Playgroud)