PowerShellでtouchファンクションを作ってみた †LinuxなどUNIXコマンドのtouchコマンドをPowerShellでtouchファンクションを作ってみました。 関連記事 †touchファンクション †サンプルスクリプト †touchのサンプルスクリプトになります。 Function touch($file) { If (Test-Path $file) { (Get-Item $file).LastWriteTime = Get-Date } Else { Out-File -encoding Default $file } } 実行結果 †touchによる空ファイル作成とファイルの日時変更のスクリーンショットです。 touchファンクションによる空ファイルの作成 †touchファンクションによるファイル書き込み日時の変更 †以上、PowerShellでtouchファンクションを作ってみたでした。 |