Last active
April 16, 2021 06:14
-
-
Save ytez/f0fabcb66383d548898988612dfd810b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # %USERPROFILE%\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 | |
| # 自動ログ保存 | |
| $logdir = "C:\PowerShellLog" | |
| $fileName = (Get-Date).ToString("yyyyMMdd_HHmmss") + "_ps.log" | |
| $logfile = join-path $logdir $filename | |
| # ログディレクトリが存在する場合、ログ取得を開始 | |
| if ( Test-Path $logdir ) { | |
| Start-Transcript $logfile -append | |
| } else { | |
| Write-Host ("No such directory : " + $logdir) | |
| } | |
| #--- タイトルを変更する | |
| $a = (Get-Host).UI.RawUI | |
| $a.WindowTitle = 'MyPS' | |
| #--- 開始ディレクトリの指定 | |
| # Set-Location "D:\" | |
| #--- 実行ポリシー確認 | |
| Write-Host "ExecutionPolicy: $(Get-ExecutionPolicy)" -ForegroundColor "Yellow" | |
| #--- プロンプト | |
| function Prompt { | |
| $cwd = $executionContext.SessionState.Path.CurrentLocation | |
| (Get-Host).UI.RawUI.WindowTitle = Split-Path $cwd -Leaf | |
| "PS $cwd`n$('>' * ($nestedPromptLevel + 1)) "; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| start powershell.exe -ExecutionPolicy RemoteSigned %* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment