Skip to content
nanakira edited this page Jan 8, 2017 · 5 revisions

Profile の管理

参考

PowerShell で Profile を利用して スクリプトの自動読み込みをしてみよう

自分用設定

dotfiles/PowerShell

$profile の場所の確認

> echo $profile

が、これは CurrentUserCurrentHost のもの。

PowerShell.exe と PowerShell_ise.exe に共通で適用するには CurrentUserAllHosts に適用される、profile.ps1 に記載する。

ps1 を読み込むための権限付与(初回のみ)

管理者権限で

> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

profile の作成

if (-not(Test-Path $profile.CurrentUserAllHosts))
{
    New-Item -Path $profile.CurrentUserAllHosts -ItemType file
}

で profile.ps1 が作成される。

$profile の再読み込み

> . $profile

Alias

Alias の追加

C:\Users(UserName)\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 に

Set-Alias subl "C:\Program Files\Sublime Text 3\sublime_text.exe"

Alias の一覧

> alias

Alias の確認

Get-Alias curl

Alias の削除

$profile に下記追加

del alias:curl
del alias:wget

Directory short cut

$profile に

$temp = "C:\temp"

Root に移動

> cd /

画面クリア

> Clear-Host

or

> cls
Clone this wiki locally