更新时间:2023-11-17 08:10:10
您可以使用的 的Process.Start
方式:
的Process.Start(
@C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ ASPNET_REGIIS.EXE
@ - PDF格式连接字符串C:\\用户\\ XXX \\桌面\\连接字符串\\ DNN
);
如果你想在外壳更多的控制权,并能够捕捉到例如标准输出和错误,你可以使用的 过载
采取的ProcessStartInfo
:
VAR PSI =新的ProcessStartInfo(@C:\\ WINDOWS \\ Microsoft.NET \\框架\\ v4.0.30319 \\ ASPNET_REGIIS.EXE)
{
参数= @ - PDF格式连接字符串C:\\用户\\ XXX \\桌面\\连接字符串\\ DNN
UseShellExecute =假,
CreateNoWindow =真
};
的Process.Start(PSI);
I'm using this code run in windows command promt.. But I need this done programatically using c# code please help
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -pdf "connection Strings" "C:\Users\XXX\Desktop\connection string\DNN"
You may use the Process.Start
method:
Process.Start(
@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe",
@"-pdf ""connection Strings"" ""C:\Users\XXX\Desktop\connection string\DNN"""
);
or if you want more control over the shell and be able to capture for example the standard output and error you could use the overload
taking a ProcessStartInfo
:
var psi = new ProcessStartInfo(@"C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe")
{
Arguments = @"-pdf ""connection Strings"" ""C:\Users\XXX\Desktop\connection string\DNN""",
UseShellExecute = false,
CreateNoWindow = true
};
Process.Start(psi);