Powershell フォルダ存在確認・作成

Out-Null : フォルダ作成時のメッセージを非表示

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$FolderPath = "C:\Temp\"
# フォルダが存在しない場合は作成
if (-not (Test-Path $FolderPath)) {New-Item -Path $LogFilePath -ItemType "directory" | Out-Null}
$FolderPath = "C:\Temp\" # フォルダが存在しない場合は作成 if (-not (Test-Path $FolderPath)) {New-Item -Path $LogFilePath -ItemType "directory" | Out-Null}
$FolderPath = "C:\Temp\"

# フォルダが存在しない場合は作成
if (-not (Test-Path $FolderPath)) {New-Item -Path $LogFilePath -ItemType "directory" | Out-Null}