Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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);


Problem:

I can´t use rs var into {0}.


C#
Process.Start("shutdown" , " /s /m \\{0} /t 30", rs);


system says: No overload for method 'Start' takes '3 'arguments.
Posted

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 />
 
Share this answer
 
v2
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

VB
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900