2020-02-09から1日間の記事一覧
sample code # ファイルをコピー PS> Copy-Item -path "test1.txt" -destination "test1.txt.bak" # フォルダをコピー PS> Copy-Item -path "mydir" -Recurse -destination "mydir.bak"
sample code # ファイルを削除 Remove-Item -Path "aaa.txt" # フォルダを削除 Remove-Item -path "a1" -Recurse -Force
sample code # ディレクトリを作成 New-Item -ItemType Directory "mydir" # 再帰的にディレクトリを作成 New-Item -ItemType Directory "a1\a2\a3" # ファイルを作成 New-Item -ItemType File "test1.txt" # ファイルを作成+内容 New-Item -ItemType File "…
sample code $from = "xxxx@gmail.com" $to = "xxxx@gmail.com" $cc = "xxxx@gmail.com" $smtp = "smtp.gmail.com" $port = "587" $subject = "メール件名" $user = "xxxx@gmail.com" $password = "xxxxxxxxxxxxxxxxx" $pass = ConvertTo-SecureString $pass…
sample code PS> Test-Connection -ComputerName localhost -Count 10
参考 codezine.jp
sample code # 現在のロケーションを取得 PS> Get-Location # "d:\sandobox\ps" # 現在のロケーションに設定 PS> Set-Location "../" # "d:\sandobox"
sample code PS> Get-Date # 2020年2月9日 15:19:43 PS> Get-Date -Format "yyyy/MM/dd" # 2020/02/09 PS> [datetime]::Now.ToString("yyyy/MM/dd")
sample code # ファイルの存在確認 PS> Test-Path -path "./aaa.txt" -PathType Leaf # フォルダの存在確認 PS> Test-Path -path "./dir_aaa" -PathType Container
参考 cncn-us.hatenablog.com