Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
Help us understand the problem. What is going on with this article?

PowerShellでファイル作成監視ワンライナー

More than 1 year has passed since last update.

何度も使うと意外と覚えられます

監視登録

$ Register-ObjectEvent -InputObject (New-Object System.IO.FileSystemWatcher("$HOME/Desktop")) -SourceIdentifier "test" -EventName Created {(New-Object -ComObject wscript.shell).popup("ファイル:" + $EventArgs.FullPath.toString() + "が配置されました。")}

デスクトップに新しいファイルが配置、作成されるとダイアログが出ます。
image.png

監視解除

$ Unregister-Event -SourceIdentifier "test"
sakkuntyo
UbuntuとNodejsをよく使います。 今はAzureに触れています。
https://sakkuntyo.github.io
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away