develog

[powershell] 명령어 본문

카테고리 없음

[powershell] 명령어

냐옴 2019. 1. 31. 15:19

스크립트 파일 (test.ps1)

try {
    $currentDir = (Resolve-Path .\).Path
    Write-Host "- currentDir : " $currentDir
} finally {
    cd $currentDir


help 보기

get-help copy 


function (without param)

# 함수 정의

function fn1 {
    write-host "hello"
}


# 함수 실행

fn1


function (with param)

# 함수 정의

function fn2 {
    param([string]$a, [string] $b)
    write-host $a
    write-host $b
}


# 함수 실행

fn2 "aa" "bb"


comment

# single line comment


<#

    block

    comment

#> 


powershell prompt

PS C:\> 


경로 리턴

(Resolve-Path .\).Path

(Resolve-Path "../../").Path


copy

copy-item -force -recurse -verbose bak/* aa

copy -force -recurse bak/* aa


delete

remove-item -force -recurse -verbose aa/*

del -recurse aa/*



Comments