简体   繁体   中英

How Set-Alias an alias that launches new process of Powershell in new window?

I'm wondering if there's a way to create an alias that quickly executes the following:

Invoke-Item C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe

I haven't been able to come up with a better way to launch??

  1. Make this file:

     C:\\Users\\<yourusername>\\Documents\\WindowsPowerShell\\Microsoft.Powershell_Profile.ps1 
  2. Put the following code in it:

     Function Start-Powershell { Start-Process powershell.exe } 
  3. Open a new Powershell window.

  4. Type Start-Powershell

You can name 'Start-Powershell' (name of the Function) whatever you like. This is your new "Alias" which works in your user environment and with auto-completion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM