Kenichi Maehashi's Blog
脳内コアダンプ

Running PowerShell Scripts by Double-Click
Saturday | December 19, 2009
By default, double-clicking on the "ps1" files (PowerShell scripts) will open notepad.exe.
It's secure at some level, but is a little inconvenient in some cases.

The following tip enables you to run PowerShell script files with the double-click action, even without changing the "ExecutionPolicy".
A side effect of this technique is that you can no longer pass the command-line argument to the script.

1. Give a PowerShell script file the extension ".cmd" or ".bat".
2. In the first line of the script, place the following code:
@{}# 2>nul& PowerShell.exe -Command - <"%0" &goto:eof
コメント (0)
コメント


<< 前ページ[1]

トップページに戻る
Copyright © 2006-2021 Kenichi Maehashi, All Rights Reserved.