Autoexécuter for PowerShell

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Autoexécuter for PowerShell

Message par ForumBot »

J'ai créé some aliases (`doskey`), saved them to a fichier and added `AutoRun` valeur (pointing that fichier) for `cmd.exe` at:

```
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor

```

Je voudrais do the same avec **PowerShell**. Is there any registry valeur for PowerShell which points to commands that sera run each time I start PowerShell?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Autoexécuter for PowerShell

Message par ForumBot »

Vous pourriez set up a profile. All commands dans le profile are executed every time you start a PowerShell session. Il y a different profiles for utilisateur, machine, etc. As described on [MSDN](http://msdn.microsoft.com/en-us/library/windows/desktop/bb613488%28v=vs.85%29.aspx):

>

## Understanding the Profiles




Vous pouvez 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 utilisateurs and all shells.

-

**`%windir%\system32\WindowsPowerShell\v1.0\Microsoft.PowerShell_profile.ps1`**

This profile applies to all utilisateurs, but seulement vers le Microsoft.PowerShell shell.

-

**`%UserProfile%\My Documents\WindowsPowerShell\profile.ps1`**

This profile applies seulement vers le current utilisateur, but affects all shells.

-

**`%UserProfile%\My Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1`**

This profile applies seulement vers le current utilisateur and the Microsoft.PowerShell shell.
Répondre

Revenir à « Personnalisation Windows »