2016-11-23 8 views
-1

Win + R을 누르거나 "skype.exe"작업을 입력하는 것과 같이 skype를 시작하려면 Windows Form에서 Button을 클릭하면됩니다.리소스에서 프로세스를 시작하는 방법은 무엇입니까?

버튼을 클릭하여 skype를 시작하고 싶지만 매번 충돌합니다.

private void button5_Click(object sender, EventArgs e) 
    { 
     Process X = new Process(); 
     X.StartInfo.FileName = "Skype.exe";   
     X.Start(); 
     //Process.Start(Properties.Resources.lul); ||lul is a batch file in the resources which should after running start skype but it doesn´t work :/  
    } 
+0

은 자원의 경우, 당신이 어딘가에 일시적으로 저장해야거야, 다음 그것을 실행하고, 필요하다면 다시 삭제하십시오. 'Process.Start'는 경로를 필요로하고 당신의 자원 파일은 유효한 경로가 아닙니다. – ThePerplexedOne

+0

예외가 무엇인지 지정하십시오. 그리고 나는 그것이 자원이나 스카이프와 관련이 있다고 생각하지 않습니다. –

+0

Win + R을 누르거나 "skype.exe"작업을 입력하는 것과 같이 Skype를 시작하려면 Windows Form에서 Button을 클릭 할 때 발생합니다. –

답변

-1

FileName은 exe의 이름 일뿐만 아니라 그 파일의 경로입니다. 여기 가 standard microsoft example입니다 :

public static void Main() 
    { 
     Process myProcess = new Process(); 

     try 
     { 
      myProcess.StartInfo.UseShellExecute = false; 
      // You can start any process, HelloWorld is a do-nothing example. 
      myProcess.StartInfo.FileName = "C:\\HelloWorld.exe"; 
      myProcess.StartInfo.CreateNoWindow = true; 
      myProcess.Start(); 
      // This code assumes the process you are starting will terminate itself. 
      // Given that is is started without a window so you cannot terminate it 
      // on the desktop, it must terminate itself or you can do it programmatically 
      // from this application using the Kill method. 
     } 
     catch (Exception e) 
     { 
      Console.WriteLine(e.Message); 
     } 
    } 
0

그래 마침내 나는 그것을 얻을 내 자신의 -.- 내가

private void button5_Click(object sender, EventArgs e) 
    { 
     Process.Start("C:\\Program Files (x86)\\Skype\\Phone\\Skype.exe"); 
    }