Skip to content

Instantly share code, notes, and snippets.

@ebith
Created August 29, 2014 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebith/e62b4f189b881f4c606e to your computer and use it in GitHub Desktop.
Save ebith/e62b4f189b881f4c606e to your computer and use it in GitHub Desktop.
5秒後に同階層以下のショートカットファイル(*.lnk)を起動するPowerShellスクリプト
Sleep 5
Set-Location (Split-Path ( & { $MyInvocation.ScriptName } ) -Parent)
Get-ChildItem -Recurse -include '*.lnk' -exclude 'startup.ps1.lnk' | ForEach-Object {
Invoke-Item $_.FullName
}
@ebith
Copy link
Author

ebith commented Aug 29, 2014

Windowsの初期設定ではps1ファイルがメモ帳に関連付けられているので、
実際使うには適当なショートカットを作った上でリンク先
"PowerShell -WindowStyle Hidden -ExecutionPolicy RemoteSigned C:\usr\app\Startup\startup.ps1"
などとする必要がある。

また、実行時の大きさを"最小化"にしてもタスクバーに一瞬出てしまう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment