关闭远程计算机C# [英] Shutdown remote computer C#
本文介绍了关闭远程计算机C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用C#远程关闭PC,但是当我设置参数时会出现问题:
Hi,
I´m trying to shutdown PC remotely using C#, but a problem occurs when i set parameters:
string rs;
Process.Start("shutdown" , " /s /m \\{0} /t 30", rs);
问题:
我无法在{0}中使用rs var.
Problem:
I can´t use rs var into {0}.
Process.Start("shutdown" , " /s /m \\{0} /t 30", rs);
系统说:方法开始"的重载不接受"3"个参数.
system says: No overload for method ''Start'' takes ''3 ''arguments.
推荐答案
是的,因为您试图将rs参数传递到开始中功能.
试试
Yes because you were trying to pass the rs argument into the start function.
Try
<br />
Process.Start(''shutdown'', String.Format("/s /m \\{0} /t 30", rs));<br />
Well让我们看一下MSDN for Process.Start
http://msdn.microsoft.com/en-us/library/system. diagnostics.process.start.aspx [ ^ ]
我同意您的编译器,没有提供带有3个参数的Start版本.
也许你需要看看
Wwell lets take a look at MSDN for Process.Start
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx[^]
I agree with your compiler, there are no versions of Start which take 3 arguments.
Perhaps you need to look at
Start(String, String, String, SecureString, String) Starts a process resource by specifying the name of an application, a set of command-line arguments, a user name, a password, and a domain and associates the resource with a new Process component.
Bryce
这篇关于关闭远程计算机C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文