2011-07-27 3 views

답변

6

Installer 클래스를 확장하고 Committed 이벤트를 무시해야합니다.

여기는 example입니다. 희망을 당신이 C에서 #. 박쥐 파일을 실행하는 방법을 찾을 수있을 것입니다 #.

[RunInstaller(true)] 
public class ServiceInstaller : Installer 
{ 
    string strServiceName = "MyServiceName"; 

    public ServiceInstaller() 
    { 
     // ............. 

     this.Committed += new InstallEventHandler(ServiceInstaller_Committed); 
    } 

    void ServiceInstaller_Committed(object sender, InstallEventArgs e) 
    { 
     // Run your batch file 
    } 
} 

Custom Install Action이 또 다른 옵션입니다. Here은 비슷한 스레드입니다.

1

cmd.exe을 사용하여 배치 파일을 실행할 수 있습니다. 어쨌든 배치 파일을 실행합니다.

시작 방법 : cmd.exe /c <path-to-batch>\batchfile.bat.

+0

- 2010 설치 프로그램에서 - cmd.exe의 원본 경로를 변경할 수있는 방법이 없습니다. cmd.exe의 xp 위치가 c : \ winnt \ system32에 있지만 Windows 7이 c : \ windows \ system32 나는 뒤죽박죽이다 – pithhelmet

+0

@pithhelmet'% comspec %'환경 변수는'cmd.exe'의 전체 경로를 저장합니다. '% windir %'는 Windows 디렉토리를 가리키며,'% windir % \ system32 \ cmd.exe'는 정확하게'cmd.exe'를 가리 킵니다. Windows가'C :'드라이브에 없어도 작동합니다. 'system32'는'PATH' 환경 변수에 나열되어 있기 때문에'cmd.exe'에 대한 전체 경로를 생략 할 수 있습니다. –

관련 문제