New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bypass the personal and system profiles if the Shift
key is hold down.
#20435
Comments
I don't understand how this can be implemented with all the variety of launch methods. For example, I run the pwsh profile in the Windows Terminal with I believe that end-users can run |
It not supposed to be a solution for any CLI (as e.g. #8072).
Maybe you have a point here (the Shift control key might not be the best choice), but in the idea, you might do a |
I was going to post "You can put this in your profile to skip it if shift is held down" but you have already found that :-) Anyone can run pwsh -noprofile - some of us even create shortcuts for that (I have one in terminal) but it would save enough people a few seconds often enough that I'd add it |
in a session you can relaunch pwsh but for your usecase would this in windows be of use? (been reviewed but if we can get more yes'es then it can become something that you get outta the box for free) #18148 |
In what session? What if I can't open any new
$Profile.PSObject.Properties | Where-Object value -Like *profile.ps1 | ForEach-Object {
Rename-Item $_.Value "$($_.Value).Bak" -Force -ErrorAction SilentlyContinue
}
These instructions will probably get a lot more complicated (OS/Console/Terminal specific and taking specific configurations in consideration) when there isn't any |
Summary of the new feature / enhancement
PowerShell startup problems are often caused by the
$Profile
script as e.g.: Powershell 7 Blank, yet troubleshooting requires to open a different (none-PowerShell) prompt or playing with the shortcuts of the Operating System.Probably the easiest way (from Windows) is
Start
-->Run
-->pwsh -NoProfile
.For an end-user, this isn't always that obvious as the
$Profile
script might also cause less clear issues (e.g. different host colors than expected). Besides, instructions might be limited to theRun with PowerShell
context-menu or a locked-down system with a single custom shortcut.Proposed technical implementation details (optional)
Bypass the personal and system profiles while holding down the Shift (or any other control) key.
By adding the following code in the top of my
$Profile
, I simulated this propose.But as other (unwanted) scripts might simply replace the complete
$Profile
script, it should actually be managed by the PowerShell engine.The text was updated successfully, but these errors were encountered: