Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 928 Bytes

powershell.md

File metadata and controls

37 lines (25 loc) · 928 Bytes

ignore output

Add-Item > $null

Add-Item | Out-Null

取得最後執行狀態碼

$?

檔案操作

# 偵測檔案路徑存在
Test-Path "$DEPLOY_PATH\review\$CI_COMMIT_REF_NAME"

# 刪除檔案
Remove-Item "$DEPLOY_PATH\review\$CI_COMMIT_REF_NAME" -Recurse -Verbose -Force

# 複製檔案
Copy-Item -Path .\build\ -Destination "$DEPLOY_PATH\review\$CI_COMMIT_REF_NAME" -Recurse -Verbose -Force
[Environment]::SetEnvironmentVariable('Foo','Bar') # 使用者
[Environment]::SetEnvironmentVariable('Foo', 'Bar', 'Machine') # 系統
[Environment]::GetEnvironmentVariable('Foo')