public class starter public shared sub new(args as string()) '首先,建立进程启动信息的结构 dim pinfo as new processstartinfo(); pinfo.useshellexecute = true; dim i as integer for i = 0 to args.length-1 if file.exists(args[i]) then pinfo.filename = args[i]; '启动进程 dim p as process = process.start(pinfo); end if next end sub end class 编译starter.vb 执行starter test.bmp test.xls 将分别打开mspaint.exe execel.exe 文中瑕弊联系[email protected]
附原c#源码:
using system; using system.io; using system.diagnostics;
public class starter { public static void main(string[] args) { //首先,建立进程启动信息的结构 processstartinfo pinfo = new processstartinfo(); pinfo.useshellexecute = true; for ( int i = 0; i < args.length; i++ ) { if (file.exists(args[i])) { pinfo.filename = args[i]; //启动进程 process p = process.start(pinfo); } } } } 编译starter.cs 执行starter test.bmp test.xls 将分别打开mspaint.exe execel.exe