我正在使用javascript启动notepad.exe
并使用以下脚本将参数传递给它。它会启动notepad.exe
,但会提示Hello World.txt does not exists. Do you want to create?
传递参数并使用notepad.exe
Hello World
的任何想法/建议
function passParam()
{
try{
//get brwosers details
var isIE = /*@cc_on!@*/false || !!document.documentMode;
if(isIE == true)
{
var oShell = new ActiveXObject("Shell.Application");
var filePath = "C:\\Windows";
var fileName = "notepad.exe";
var commandParms = "Hello World!";
oShell.ShellExecute(fileName,commandParms,filePath,"open","1");
return;
}
alert("Please use only IE to launch navigator.");
}
catch(e){
alert("Error:"+e.message);}
}
答案 0 :(得分:0)
notepad.exe
的命令行参数是要打开的文件名,而不是记事本的初始内容。您必须将文件写入磁盘并打开指向它的记事本。