私はhttps://powerbi.microsoft.com/en-us/downloads/
からPowerbi 32 bit
と64 bit
MSIファイルをダウンロードし、スクリプトの下に作成しました。
$ScriptDir = (Split-Path $MyInvocation.MyCommand.Path)
$MSIArguments = @(
"/i"
"$ScriptDir\PBIDesktop.msi"
"/qn"
# "/norestart"
"ACCEPT_EULA=1"
)
$MSIArguments2 = @(
"/i"
"$ScriptDir\PBIDesktop_x64.msi"
"/qn"
# "/norestart"
"ACCEPT_EULA=1"
)
$architecture=gwmi win32_processor | select -first 1 | select addresswidth
if ($architecture.addresswidth -eq "64"){
Start-Process "msiexec.exe" -ArgumentList $MSIArguments2 -wait
}
elseif ($architecture.addresswidth -eq "32"){
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -wait
}
$ScriptDir
スクリプトは、source directory/$ScriptDir
にスペースがない場合にのみ完全に機能します。 たとえば、ソースディレクトリがc:/test
またはc:/test_test/test
の場合、完全に機能します。
しかしsource directory/$ScriptDir
にスペースが含まれている場合source directory/$ScriptDir
はC:\Users\Dell\Desktop\New folder
PowerShellスクリプトであれば、それは例えば
下記のMSIオプションのエラーでハングは、上記のメッセージ ..まだありませんインストール時にハングアップします。
私はパスに$ScriptDir
を見つけるために、スクリプトの最後にエコーを追加して、それは私がさらに混乱になり、エコー結果の下になります。
C:\Users\Dell\Desktop\New folder
スペースがあるときにmsiexec.exeが引数を実行できない理由がわかりません。
どうすればいいのですか? $ ScriptDirにスペースがあっても、これをどうやって動くように修正できますか?
これはとても楽しいものでした:)エスケープされた引用符( "")の使用方法を学びました。 – user879