189 8069 5689

vb点虐 带参exe的简单介绍

vb点虐 运行所在目录的应用程序并加参数

可试试下面的方法:

在郫都等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站建设、网站制作 网站设计制作按需网站制作,公司网站建设,企业网站建设,高端网站设计,全网整合营销推广,成都外贸网站建设,郫都网站建设费用合理。

1.可接收参数的外部程序

/// summary

/// 可接收参数的外部程序主函数

/// /summary

static class Program

{

/// summary

/// The main entry point for the application.

/// /summary

[STAThread]

static void Main(string[] paras)

{

string temp = "";

foreach (string str in paras)

{

temp += str + ",";

}

MessageBox.Show(temp);

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Application.Run(new Form1());

}

}

2.启动外部程序的方法(给外部程序加参数)

/// summary

/// 调用外部程序窗体

/// /summary

public partial class Invokeprogram : Form

{

public Invokeprogram()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

System.Diagnostics.Process proc = new System.Diagnostics.Process();

proc.StartInfo.CreateNoWindow = true;

proc.StartInfo.UseShellExecute = false;

proc.StartInfo.RedirectStandardOutput = true;

proc.StartInfo.FileName = Application.StartupPath + "\\WindowsFormsApplication1.exe";

proc.StartInfo.Arguments = "-steam -game cstrike"; //传入启动参数

proc.Start();

//string output = proc.StandardOutput.ReadToEnd();

// MessageBox.Show(output);

}

}

VB.NET中,如何调用外部EXE文件,同时带参数的

Shell "notepad.exe c:\1.txt", vbNormalFocus

i=Shell( "notepad.exe c:\1.txt", vbNormalFocus)得到返回值

VB点虐 调用exe问题

你可以用VB.NET中内建的Shell函数或调用System.Diagnostics命名空间中Process类的Start静态方法来运行。将可执行文件的路径和运行参数以字符串型传送给方法的参数即可。

另:用Chr(34)代替英文的单引号,没有前后之分。

VB.NET 指定程序参数

Command 函数

给程序传递参数后,参数会保存在command函数中,通过处理command接受的参数字符串来来编写相应代码就行了

例如快捷方式为“D:\Test.exe -s”

程序写:

msgbox(command)

得到的结果为:“-s”


网站栏目:vb点虐 带参exe的简单介绍
网页网址:http://cdxtjz.cn/article/ddghcoo.html

其他资讯