vb.net进程目录 vbnet doevent

请问VBnet 如何调用程序目录(相对路径)下的exe文件把g.exe放到工程的bin/Debug/目录里面调用时用:
Private Sub Command1_Click()dim N as Object
N=Shell(Application.StartupPath"\g.exe")
End Sub
试试,有问题在追问
vb.net运行所在目录的应用程序并加参数可试试下面的方法:
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 + ",";
【vb.net进程目录 vbnet doevent】}
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中用button打开程序运行的根目录这个就是你要的了!希望你能用!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim AppPath As String = Directory.GetCurrentDirectory() '获取应用程序的当前工作目录
Process.Start(AppPath) '打开当前目录
End Sub
忘了说,这个要引用命名空间!
把Imports System.IO写到代码最上边就好了!
关于vb.net进程目录和vbnet doevent的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读