###前提・実現したいこと
バッチファイルにて64bitか32bitを判定し、Program Files配下にファイルをコピーしたい。
なお、Windows10ではProgram Files配下にファイルをコピーする場合、管理者権限が必要になるため、powershellにて管理者権限で実行をしています。
###発生している問題・エラーメッセージ
powershellの行のみ実行した場合、管理者権限をコピーすることができていますが、
64bitか32bitかの判定を入れると動作しません。
###該当のソースコード
if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "Start-Process -FilePath xcopy.exe -ArgumentList '/Y "%~dp0sample.vbs" "%ProgramFiles(x86)%"' -Verb runas -Wait -WindowStyle hidden"
timeout 1
) else if "%PROCESSOR_ARCHITECTURE%" == "IA64" (
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "Start-Process -FilePath xcopy.exe -ArgumentList '/Y "%~dp0sample.vbs" "%ProgramFiles(x86)%"' -Verb runas -Wait -WindowStyle hidden"
timeout 1
) else (
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "Start-Process -FilePath xcopy.exe -ArgumentList '/Y "%~dp0sample.vbs" "%ProgramFiles%"' -Verb runas -Wait -WindowStyle hidden"
timeout 1
)

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/12/27 05:22