Tag: process.start

使用c#在mac上启动外部进程

我成功使用System.Diagnostics.Process.Start()在Windows上启动外部单声道可执行文件。 然而它在mac上失败了。 我没有收到任何错误,根本没有任何错误发生。 我尝试以下方式: System.Diagnostics.Process.Start(“mono”, “/path/program.exe”); 我也试过像下面那样打开终端(也失败了): System.Diagnostics.Process.Start(“Terminal”); 我唯一能做的就是以下列方式启动终端: System.Diagnostics.Process.Start(“open”, “-a Terminal”); 有任何想法吗? 我真的很感激任何帮助。 谢谢!

Process.Start(链接)省略了部分链接

可能重复: 用查询字符串打开html文件 我正在使用c#编写一个简单的控制台应用程序,我正在尝试使用“name”参数打开本地html文件。 现在我正在使用const url(用于测试……):“file:/// D:/index.html?name = bob” 代码很简单: class Program { static void Main(string[] args) { string link = @”file:///D:/index.html?name=bob”; Process.Start(link); } } 但它打开浏览器的链接:“file:/// D:/index.html”。 有谁知道它为什么省略’name’参数以及如何解决它? 谢谢!

Process.Start()启动的应用程序没有得到参数

使用C#,我试图使用Process.Start()将命令行参数传递给新进程: string path = @”C:\Demo\Demo.exe”; string arguments = “one two three”; ProcessStartInfo startInfo = new ProcessStartInfo { FileName = path, Arguments = arguments }; var process = Process.Start(startInfo); 我的C应用程序Demo.exe只是回显命令行参数: int main( int argc, char *argv[] ) { int count=0; // Display each command-line argument. printf( “\nCommand-line arguments:\n” ); for( count = 0; count < argc; […]

如何将参数传递给exe?

我在我的服务器上使用psexec在另一台服务器上运行exe文件。 如何将参数传递给其他exe? 我在我的服务器上运行的exe是psexec,而后者必须运行位于另一个系统上的名为vmtoolsd.exe的exe。 如何将参数传递给vmtoolsd.exe? 另外,我在哪里通过它? 我会将它作为info.Arguments的一部分传递给我吗? 我试过了,但它没有用。 ProcessStartInfo info = new ProcessStartInfo(@”C:\Tools”); info.FileName = @”C:\Tools\psexec.exe”; info.Arguments = @”\\” + serverIP + @”C:\Program Files\VMware\VMwareTools\vmtoolsd.exe”; Process.Start(info); 另外,作为info.Arguments的一部分,我必须在vmtoolsd.exe的路径前加上IP地址,然后是驱动器路径?

Process.Start()没有启动.exe文件(手动运行时工作)

我有一个.exe文件,需要在创建文件后运行。 文件已成功创建,我之后使用以下代码运行.exe文件: ProcessStartInfo processInfo = new ProcessStartInfo(); processInfo.FileName = pathToMyExe; processInfo.ErrorDialog = true; processInfo.UseShellExecute = false; processInfo.RedirectStandardOutput = true; processInfo.RedirectStandardError = true; Process proc = Process.Start(processInfo); 我也试过一个简单的Process.Start(pathToMyExe); 但.exe文件未运行。 当我在Windows资源管理器上手动尝试pathToMyExe ,程序正确运行。 但不是通过该计划。 我看到的是光标转向等待几秒然后恢复正常。 所以也没有抛出exception。 什么阻止文件?

Process.Start()和PATH环境变量

我有以下简单的C#应用​​程序,它只是尝试启动“jconsole.exe”,它在我的机器上位于C:\ Programs \ jdk16 \ bin中。 using System; using System.Diagnostics; namespace dnet { public class dnet { static void Main( string[] args ) { try { Process.Start(“jconsole.exe”); Console.WriteLine(“Success!”); } catch (Exception e) { Console.WriteLine(“{0} Exception caught.”, e); } } } } 如果我的PATH环境变量设置为 c:\windows;c:\windows\sytem32;c:\programs\jdk16\bin 它完美地运作。 但是,如果PATH环境变量设置为 c:\windows;c:\windows\sytem32;c:\\programs\jdk16\bin (注意“c:”和“program”之间的两个反斜杠),它以win32exception失败。 System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file […]

在C#中以管理员权限启动流程

我必须使用System.Diagnostics.Process.Start()启动命令行程序并以管理员身份运行它。 此操作也将每天由计划任务运行。

在路径中使用带参数和空格的Process.Start

我见过类似的例子,但找不到与我的问题完全相同的东西。 我需要从C#运行这样的命令: C:\FOLDER\folder with spaces\OTHER_FOLDER\executable.exe p1=hardCodedv1 p2=v2 我在运行时设置v2,所以我需要能够在调用Process.Start之前修改C#中的字符串。 有谁知道如何处理这个,因为我的参数之间有空格?