1
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?

Windows カスタムプロトコルの定義

Posted at

定義サンプル

explorer://プロトコルを定義してエクスプローラで開く設定を追加する例

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\explorer]
@="URL:Custom Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\explorer\shell]

[HKEY_CLASSES_ROOT\explorer\shell\open]

[HKEY_CLASSES_ROOT\explorer\shell\open\command]
@="powershell.exe -Command \"[System.Uri]::UnescapeDataString(\\\"%1\\\") | foreach-object { Start-Process -FilePath C:\\Windows\\explorer.exe -ArgumentList $_.TrimStart(\\\"explorer://\\\").TrimEnd(\\\"/\\\") }\""


メモ

  • commandに対するパラメータは%1で取得可能
  • パラメータにはプロトコル名を含んだ文字列が格納されている
    • cmd.exeを使った文字列置換はややこしかったのでPowerShellを利用してプロトコル名を除去するようにした
1
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
1
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?