How to modify %PATH% with Custom AppStream App Block?

0

I've created a Custom App Block with Windows, including a setup.ps1 (PowerShell script) to mount my custom virtual disk to M: drive.

I modified the path, Windows environment variable, with this code below, and the output logs (in S3) indicate that the path was changed (I used Write-Host to see the updated path). However, when I stream the application, the path is not changed.


$jre = "W:\jre\bin"
$p = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + [IO.Path]::PathSeparator + $jre
[System.Environment]::SetEnvironmentVariable("Path", $p, "Machine")

$p = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
Write-Host $p
# result
#C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Amazon\cfn-bootstrap\;C:\Program Files\Amazon\Photon\ConsoleImageBuilder\;C:\Program Files\Amazon\Photon\AppBlockManager\CLI\;W:\jre\bin

Workaround

My workaround is copying a 'shim' batch file from the mounted virtual drive into a directory that is already in the path:

C:\Users\PhotonUser\AppData\Local\Microsoft\WindowsApps 
KarlT
질문됨 7달 전218회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠