Notes
  • Introduction
  • 應用程式
    • Azure
      • Logic App
      • web app
    • Android
    • Bower
    • Curl
    • DNS
    • Docker
    • Fail2ban
    • Git
    • GitLab-CI
    • GitLab
    • GPG
    • Home Assistant
    • IIS
    • Line Bot
    • Ngrok
    • Npm
    • PowerShell
    • Redis
    • SSH
    • Synology
    • VS Code
    • Web
  • 程式語言
    • C#
      • 遠端偵錯-Remote Debugger
      • 預設值表
      • .Net Core
    • JavaScript
    • PowerShell
  • 作業系統
    • Mac OS
    • Windows 10
    • Raspberry Pi
    • Ubuntu
  • 其他
    • SSL
    • Tools
Powered by GitBook
On this page
  • ignore output
  • 取得最後執行狀態碼
  • 檔案操作
  • 使用指令添加環境變數
Edit on Git
  1. 應用程式

PowerShell

PreviousNpmNextRedis

Last updated 3 years ago

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')
使用指令添加環境變數