使用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.
回复:使用 RunProgram 啟動 cmd.exe 並執行命令很好,謝謝。我不敢相信我從來沒有註意到多個示例下拉列表。
回复:使用 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);