나는 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
가 C:\Users\Dell\Desktop\New folder
PowerShell 스크립트 인 경우, 예를 들어
아래에 주어진
그러나 source directory/$ScriptDir
에 공백이있는 경우, 그것은 MSI 옵션 오류로 중단
가 나는 경로를 $ScriptDir
을 찾기 위해 스크립트의 끝에 에코 추가하고 그것은 나를 더 혼란하게 에코 결과 아래에 제공했다.
C:\Users\Dell\Desktop\New folder
공간이있을 때 msiexec.exe가 인수를 실행할 수없는 이유를 잘 모릅니다.
내가 도울 수 있도록 도와주세요. 이유가 무엇일까요? $ ScriptDir에 공백이 있어도 어떻게이 문제를 해결할 수 있습니까?
정말 재미있었습니다 :) 이스케이프 된 따옴표 ("")를 사용하는 방법을 배웠습니다. – user879