Note well that running cmd.exe via shell from VB6 will always run the 32-bit cmd.exe.
Thus, I've always been explicit in the version of cmd.exe that I shell to.Code:Option Explicit Private Sub Form_Load() Dim stCmd As String Dim objShell As Object Set objShell = CreateObject("Shell.Application") stCmd = "echo %PROCESSOR_ARCHITECTURE%" ' Results from running on my; ' Windows 10 X64 ' VB6 SP6 objShell.ShellExecute "C:\Windows\system32\cmd.exe", "/k " & stCmd, "", "runas", 1 'Returns x86 objShell.ShellExecute "C:\Windows\sysnative\cmd.exe", "/k " & stCmd, "", "runas", 1 'Returns AMD64 objShell.ShellExecute "C:\Windows\syswow64\cmd.exe", "/k " & stCmd, "", "runas", 1 'Returns x86 Set objShell = Nothing Unload Me End Sub
Joe
Ref: The 'Sysnative' folder in 64-bit Windows explained
Ref: How-to: Detecting 64 bit vs 32 bit




Reply With Quote
