function chk(){ var wsh=new ActiveXObject("WScript.Shell"); wsh.run("explorer.exe ftp://192.168.2.72/ ") }
这样打开本地程序是不安全的方法。
Run 方法 在新过程中运行程序 object.Run(strCommand, [intWindowStyle], [bWaitOnReturn])
1、strCommand 要执行的程序的路径 例:Set objshell=CreateObject("Wscript.Shell") objshell.Run "notepad" 运行记事本 Set objshell=CreateObject("Wscript.Shell") objshell.Run """C:/Program Files/Internet Explorer/IEXPLORE.EXE""" 运行IE,因为路径中含有空格,所以用3个""
2、intWindowStyle 程序窗口的形式 0是在后台运行; 1表示正常运行; 2表示激活程序并且显示为最小化; 3表示激活程序并且显示为最大化; 一共有10个这样的参数,默认是1,正常运行
例:Set oShell=WScript.CreateObject("WScript.shell") oShell.Run "wmplayer.exe D:/1.MP3",0 后台打开某个音乐 Set oShell=WScript.CreateObject("WScript.shell") oShell.Run "notepad d:/i.txt",3 最大化打开某个文档
3、bWaitOnReturn 程序是等待还是继续执行,默认是继续执行 例:Set objShell = CreateObject("Wscript.Shell") objShell.Run "notepad" ,,true objShell.Run "calc" 等记事本关闭之后才打开计算器