2013-04-18 1 views
0

그래서 제가 이루고자하는 것은 항상 시작하는 것입니다. 네이티브 os 버전의 cscript.exe. 그래서 스크립트가 실행될 때 syswow64 regestry/files로 리다이렉트되지 않고 올바른 시스템 파일에 접근 할 수 있습니다.32 비트 서비스를 사용하여 64 비트 버전의 cscript를 시작하십시오.

따라서 msdn 문서에 따르면 실제 시스템 폴더를 얻으려면 64 비트 시스템에서 32 비트 응용 프로그램을 실행할 때 sysnative를 사용할 수 있습니다. 그러나 스크립트는 seam을 사용하여 cscript.exe 파일을 찾습니다. 그래서 질문은 내가 뭘 잘못하고 있는거야? 나는 바보 같은 가정을하고 있을지도 모르기 때문에 주로 파이썬 녀석이다.

는 32 비트 서비스로 컴파일됩니다, 그래서는이

을 중요한 경우

으로 VisualStudio 2010을 실행하는 (이론적으로) 모든 Windows 운영 체제에 배포 할 수 아니면 내가 완전히 다시 전면으로 문제에 접근하고있다? Basicly 질문에

Public Class Service1 

Protected Overrides Sub OnStart(ByVal args() As String) 
    ' Add code here to start your service. This method should set things 
    ' in motion so your service can do its work. 
    'Prvents windows from redirecting us to the wow64 folder instead of system32. 

    ' Don' run if settings file is gone 
    If My.Computer.FileSystem.FileExists("C:\Settings.vbs") Then 

     'If we are running in wow64(32bit windows files) mode switch to native 64 bit vbscript 
     If My.Computer.FileSystem.DirectoryExists("%systemroot%\sys­native") Then 
      Process.Start("%systemroot%\sys­native\cscript.exe", "C:\Main.vbs") 
     Else 
      Process.Start("%systemroot%\system32\cscript.exe", "C:\Main.vbs") 

     End If 



    End If 
End Sub 

Protected Overrides Sub OnStop() 
    ' Add code here to perform any tear-down necessary to stop your service. 
End Sub 

End Class 

, 나는 64 비트 모드가 아닌 32 비트에서 실행에서 cscript 수 있도록 단지 정말이 줄을 수행하는 방법이다.

Process.Start를 ("에 % systemroot % \ system32 \ cscript.exe를", "C : \ Main.vbs") C로 변경됩니다

: \ 윈도우 \ SysWOW64와 64 비트에서 프로그램을 실행할 때 체계.

그러나 32 비트 시스템에서는 C : \ Windows \ system32로 유지됩니다.

나는이 시도 : http://msdn.microsoft.com/en-us/library/windows/desktop/aa365744%28v=vs.85%29.aspx

을하지만 그것이 작동하는 방법을 알아낼 솔기를 기울인다. 비주얼 베이직 응용 프로그램

답변

0

대답

저기

옵션 완전 추론 희미한

수입 System.IO 모듈 Module1의 하위 홈페이지()에서 엄격한

옵션에서 F 문자열 = ""만약 IntPtr.Size으로 = 4 Then f = Path.Combine (Environment.ExpandEnvironmentVariables ("% windir %"), "sysnative") MsgBox ("X86에서 실행 중") Else f = Environment.GetFolderPath (Environment.SpecialFolder.System) MsgBox ("실행 중 X64 ") End If Dim wscript As String = Path.Combine (f,"wscript.exe ") Dim psi = 새 ProcessStartInfo psi.FileName = wscript psi.Arguments = Path.Combine (Environ ment.GetFolderPath (Environment.SpecialFolder.DesktopDirectory), "CheckPlatform.vbs") 새로운 프로세스 p.StartInfo = PSI의 p.Start 희미한 P() 종료 하위 엔드 모듈

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/48bc23b5-798f-4cea-ae33-060a0d66506b

관련 문제