0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

powershell > Desktopにファイルがあるかどうかの確認 > 変数の使用例 / Desktopなどのパスの取り方 / if文 / Test-Path文

Last updated at Posted at 2016-01-11
動作確認
Windows 8.1 pro (64bit)

デスクトップにファイル(findFile.ps1)があるかどうかの確認

findFile.ps1
$dsktp = [Environment]::GetFolderPath('Desktop')
echo $dsktp

if (Test-Path $dsktp\findFile.ps1) {
    echo "found"
} else {
    echo "not found"
}
実行結果
PS > powershell /c .\\findFile.ps1
found

以下を覚えた

  • 変数の使い方
  • Desktopなどのパスの取り方
  • if文
  • Test-Path文
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?