Kenichi Maehashi's Blog

脳内コアダンプ

RSS
Category: Computer
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

Comments

Leave Yours...
Name:
E-mail / URL (optional):
Comment:
Are You Robot?: