使用RunProgram启动cmd.exe并执行命令我想使用 RunProgram 通过 cmd.exe 运行可执行文件,如 notepad.exe。
下面将返回正确的目录,但是当我将另一个命令添加到选项列表“notepad.exe”时,出现系统找不到指定路径的错误。
cmd1 = "/k cd /d " || "C:\Windows\System32";
RP = RunProgram(
Executable( "CMD.EXE"),
Options( {cmd1} ),
ReadFunction("text")
);我也多次看到这个错误,但并不完全理解它在说什么。 如何补救?
The external program was producing output when the RunProgram object was destroyed.
Use a JSL variable to hold the RunProgram object.
Optionally, send messages to the variable to manage the object's lifetime.
Re: 使用 RunProgram 启动 cmd.exe 并执行命令很好,谢谢。我不敢相信我从来没有注意到多个示例下拉列表。
Re: 使用 RunProgram 启动 cmd.exe 并执行命令您应该在“帮助”>“脚本索引”>“函数”>“运行程序”中查看示例 3。
附件是为第 9 章编写的脚本JSL Companion,JMP 脚本语言的应用,第二版.它包括多种读取多个命令的方法;一个程序的多个命令,或多个 DOS 命令。请参阅此脚本中的示例 #5,了解多个 dos 命令(cd、dir 等)。讨论说明从第 199 行开始,JSL 在第 253 到 287 行。
如果您只是想做笔记,在您的会话期间,这里有一个不需要运行程序的简单脚本。
Names Default to Here(1);
noteslst ={};
InsertInto(noteslst, char(AsDate(Today()))|| " Notes");
InsertInto(noteslst, "Hello, World!");
InsertInto(noteslst,"It's hot here, 99 degrees");
InsertInto(noteslst,"Time to cool off");
InsertInto(noteslst,"Good Bye");
xtxt = Concat Items(noteslst,"\!N");
Save Text File( "c:\temp\July23Notes.txt" , xtxt);