LoginSignup
2
2

More than 5 years have passed since last update.

PowerShellのスクリプトを、実行権限がRestrictedのまま実行するためのおまじない

Last updated at Posted at 2015-11-06

おまじない

PowerShellを起動後、以下のコマンドを実行する

function call($path){
  $script = Get-Content $path
  Invoke-Expression("&{$script} $args")
}

使い方(例)

function call($path){
  $script = Get-Content $path
  Invoke-Expression("&{$script} $args")
}

call sample.ps1 minr
sample.ps1
param($name)
echo ('私の名前は' + $name + 'です')
結果
私の名前はminrです

まとめ

用法用量を守ってお使い下さい。

2
2
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
2
2