Develop/PowerShell

    [PowerShell] ps1 파일 실행 오류 : 이 시스템에서 스크립트를 실행할 수 없으므로 ~

    PowerShell ps1 실행 시 Policy 오류 Policy 선언 후 실행 # Powershell.exe -noprofile -executionpolicy bypass -file "[PS1 FILE PATH]" Powershell.exe -noprofile -executionpolicy bypass -file "./install_all.ps1"

    [PowerShell] ForEach문 활용

    PowerShell Foreach Array 생성 $removeAppxPackage = @( 'Microsoft.MicrosoftOfficeHub', 'Microsoft.MicrosoftSolitaireCollection', 'MicrosoftTeams', 'Microsoft.WindowsCamera', 'Microsoft.Getstarted', 'SpotifyAB.SpotifyMusic', 'Microsoft.ZuneMusic', 'Microsoft.ZuneVideo', 'Microsoft.BingNews', 'Microsoft.People', 'Microsoft.BingWeather' ) Foreach 실행 # foreach ( $item in [Array] ) { RUN COMMAND } forea..

    [PowerShell] 현재 경로 확인

    PowerShell 현재 경로 확인 pwd $nowPath = (pwd).Path Write-Host $nowPath # or $nowPath = ${pwd} Write-Host $nowPath # or Write-Host ${pwd}

    [PowerShell] 변수 설정 / 활용

    PowerShell 변수 설정 / 활용 PowerShell 변수 설정 $psVal=11 #Integer [int]$psInt=11 #Boolean (0: False / 1: True) [bool]$psBoolean=0 #String [string]$psString="ssd" PowerShell 변수 사용 [string]$dirPath="C:\vault" Get-Item $dirPath

    [PowerShell] 특정 폴더 용량 확인

    PowerShell 폴더 용량 확인 PowerShell Command # Target Directory : C:\vaults # $GetDir = Get-ChildItem [DIRECTORY_PATH] -recurse | Measure-Object -property length -sum $GetDir = Get-ChildItem C:\vaults -recurse | Measure-Object -property length -sum $GetDirSize = $GetDir.Sum Write-Host $GetDirSize PowerShell One line command # Target Directory : C:\vaults # $GetDirSize = (Get-ChildItem [DIRECTORY_PATH]..