Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


windows:scripting:auto_run_a_script_when_openning_powershell

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
windows:scripting:auto_run_a_script_when_openning_powershell [2017/03/03 14:20]
tplecko created
windows:scripting:auto_run_a_script_when_openning_powershell [2017/08/10 13:00] (current)
Line 1: Line 1:
 +====== Auto run a script when openning Powershell ======
 +You can have four different profiles in Windows PowerShell. The profiles are listed in load order. The most specific profiles have precedence over less specific profiles where they apply.
  
 +  - %windir%\system32\WindowsPowerShell\v1.0\profile.ps1 \\ This profile applies to all users and all shells.
 +  - %windir%\system32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1 \\ This profile applies to all users, but only to the Microsoft.PowerShell shell.
 +  - %UserProfile%\My Documents\WindowsPowerShell\profile.ps1 \\ This profile applies only to the current user, but affects all shells.
 +  - %UserProfile%\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 \\ This profile applies only to the current user and the Microsoft.PowerShell shell.
 +
 +Example:
 +<​code>​
 +write-host -ForegroundColor Green "​PSRepo contents"​
 +dir C:\PSRepo | Foreach-Object {$_.BaseName} | format-wide
 +</​code>​
windows/scripting/auto_run_a_script_when_openning_powershell.txt · Last modified: 2017/08/10 13:00 (external edit)