Skip to content

Instantly share code, notes, and snippets.

@rohinomiya
Created December 20, 2013 16:55
Show Gist options
  • Save rohinomiya/8057819 to your computer and use it in GitHub Desktop.
Save rohinomiya/8057819 to your computer and use it in GitHub Desktop.
CPU (32bit / 64bit) に応じて別のアプリを起動する ref: http://qiita.com/rohinomiya/items/80f70b384acc4f0176ab
; Function: 32bit環境か64bit環境かを判別し、異なるEXEを実行する
; NOTICE: 32bit環境でビルドしてください
#NoEnv
SetWorkingDir %A_ScriptDir%
GetNativeSystemInfo() ; OS の種類を取得
{
VarSetCapacity(si,44)
DllCall("GetNativeSystemInfo", "uint", &si)
if ErrorLevel
return -1
arc := NumGet(si,0,"ushort")
return arc
}
Is64bitCPU()
{
arc := GetNativeSystemInfo()
return (arc = 9 or arc = 6)
}
Is32bitCPU()
{
arc := GetNativeSystemInfo()
return (arc = 0)
}
; CPUの種類で、実行するパスを変更する
if(Is32bitCPU())
command := "..\vim32\gvim.exe"
else if(Is64bitCPU())
command := "..\vim64\gvim.exe"
else
{
msgbox, unknown CPU
ExitApp
}
; コマンドライン引数を引き渡す
loop, %0%
{
arg := %A_Index%
if( InStr(arg," ") > 0 )
arg="%arg%"
command=%command% %arg%
}
run, %command%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment