How to go fullscreen in PowerShell - powershell

Is there a way of making powershell appear in fullscreen? Not only maximize it over the screen, but hiding the top-bar as well?
Also, since this is probably hard to do, how to maximize it according to current resolution?

Try typing the following command:
mode 300
after the window opens

Right click the top bar and select properties. Then depending on your screen resolution select the appropriate size. (under the layout tab).

ALT + ENTER will full screen the powershell window in Windows 10
If this doesn't work right click the title bar > properties > options and make sure "Use Legacy console" is unchecked:

The trick to using PS in a modern fashion is to use a different type of terminal program. I use ConEmu as it is open-source and free.
Not only will it allow you to run the screen maximised, you can have several tabs, clear-type fonts, custom colours et cetera.
Together with the free 'Source Code Pro' font, it makes for a very nice PS environment.
Hope this helps

Display Options -> Fullscreen, or ALT+ENTER should enter fullscreen mode.

You can create a shortcut with
"%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe " -NoExit -Command "mode 300"
The -NoExit option will keep the console open after running the startup command, and the
-Command option of course runs the command on console startup.
Besides, if you're not an administrator or you're running Windows 8 (hence apps run as not privileged by default) you can setup your shortcut to run Powershell as administrator always.
Source

If it would be sufficient to merely maximize your PowerShell window, you can simply add -WindowStyle Maximized to your PowerShell shortcut:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -WindowStyle Maximized

Related

Can't customize default Powershell colors and settings when running from Context Menu shortcut

I configured a custom font/size/color scheme for Powershell by right clicking on the title bar and selecting properties.
The settings persist if I open Powershell from the start menu search.
Unfortunately they don't when I invoke Powershell from a right click context menu:
Con someone possibly instruct me on how to make my changes permanent irrespective of how PS is launched?
Thank you very much for any assistance!

Differences between blue background and black background PowerShell

I'm wondering why the background of the PowerShell is different when I open it from Run (or Start) and from the shortcut on desktop PowerShell.exe. In the first case the background is blue, in the latter case it's black.
Are there other differences between the two windows of the PowerShell?
EDIT
EDIT 2: in the figure below you can see the powershell processes. Moreover, if I open powershell.exe directly from C:\Windows\System32\WindowsPowerShell\v1.0, the background is blue instead of black (remember that its link on desktop opens a black background powershell).
Regarding the below figure, both processes powershell.exe and Windows PowerShell are located in C:\Windows\System32\WindowsPowerShell\v1.0.
P.S.: the situation described here is the same on Windows 10 and 7.
EDIT 3
If I go in the folder C:\Windows\System32\WindowsPowerShell\v1.0 and I right click on powershell.exe, there isn't the tab Colours, but its link on Desktop has the tab Colours.
Are there other differences between the two windows of the PowerShell?
Probably yes but it's likely to be on the same level. (e.g. from your screenshot the blue console is wider so probably has a higher Width layout setting).
afaics it looks they're both the same powershell.exe with different host settings. But only you can confirm.
How to check if they're the same "PowerShell"
Open Task Manager > Details tab.
You should see 2 processes with name powershell.exe.
Right click > Properties and look at the Location
I suspect they're both C:\Windows\System32\WindowsPowerShell\v1.0
Why is one black and the other blue?
Right click on desktop shortcut > Properties > Colours
These settings are applied when you open PowerShell using this shortcut.
You can do the same for the Windows PowerShell shortcut in the start menu.
(You may have to right click > Open file location to get to the actual shortcut)
For Run > powershell.exe, it's using the settings in the registry as described here.
Edit: So running the powershell.exe directly uses the settings stored in the registry at path HKEY_CURRENT_USER\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe. Copying and pasting a shortcut does not copy these settings because they are not stored in the exe. I believe but am I not certain that shortcuts will use the settings in HKEY_CURRENT_USER\Console\ by default. You need to edit the properties to change the settings for the shortcut. You could edit them in the registry but this seems like a bad idea as it's not just used by PowerShell.
Related stuff
You can change the defaults in the Properties above.
Options, Font and Layout settings may also differ.
You can see the values for the current console (including run > powershell.exe) by clicking on the PowerShell logo in the top left and going to Properties
related links: $Host, Get-Host and (if using PSReadLine module) Get-PSReadLineOption, Set-PSReadLineOption

Background mode for vim in windows

I've recently started moving away from my regular editor to vim and I use powershell as my default shell. I noticed in the normal mode that pressing ctrl z allows to quickly go back to the terminal ( although in a very different mode, regular shortcuts like ctrl L to clear screen etc. weren't working ). After reading through some posts I got to know that this shortcut is meant to put vim in backgroud mode in linux and fg brings it back to the foreground. Since this doesn't work in powershell is there an alternative way to get the same functionality?
PS: Is there also any alternative to reach powershell prompt from within vim?
Thanks!
The terminal command can be used to reach a powershell prompt from within Vim.
:term powershell
This will open powershell in a new terminal window.
There are various ways to invoke a terminal. For example, :tab term powershell will open the terminal in a new tab. :term ++curwin powershell will open the terminal in the current window. See :help :term for more details.
Here is some more relevant information from a prior post:
Using :term will place you in Terminal-Job mode, where you can use
the terminal as expected.
Within Terminal-Job mode, pressing Ctrl-W N or Ctrl-\ Ctrl-N switches the mode to Terminal-Normal, which
allows the cursor to be moved and commands to be ran similarly to
Vim's Normal mode. To switch back to Terminal-Job mode, press i.

New to VSCode, can't disable sidebar

I am new to VSCode, long been a holdout with Powershell ISE. I am in a situation where I am doing more with PS7, so have no choice but to use it. The one thing that I cannot seem to find is a way to permanently disable the sidebar. Every time I run a script the stupid thing pops up, and I have to hit CTRL+B to close it. I have tried going into Powershell language specific settings, but the only option I see is sidebar.location.
Is there any way to permanently stop this from popping up?
Here is the solution:
go to settings
search for Debug: Open Debug
choose never open
Allow me just say this. I too use VSCode, Sapien's PS Studio, and the ISE more than the previous two, but also use PowerShell v7.
So, FYI... You do have a choice, You can use PowerShell v7 from the ISE. I do this every day. Well, it's a workaround to do so, but it works just fine.
Here is one of the ways to use PowerShell v7 in the ISE.
Using PowerShell Core 6 and 7 in the Windows PowerShell ISE
The other way I use it is just shelling/branching out to it as needed.
Yet, your question is really a duplicate of this Q&A.
Is there a shortcut to hide the sidebar in Visual Studio Code?
And these potential answers...
you can hide the activity bar by setting up your own keybinding
(code.visualstudio.com/docs/customization/keybindings) for
workbench.action.toggleActivityBarVisibility
and or
In the VS code version 1.43, you can hide or show the side menu or
activity bar by going under the 'VIEW' tab in the nav bar in the top
margin of VS CODE(called the 'Menu Bar'). Go to View => Appearance,
there you can check or uncheck different nav bars to show/hide each
one.
If you have the top bar (Menu Bar) currently hidden press 'alt' key to
bring it back then follow above instructions to check it to keep it
there permanently if desired.
The thing to remember though is, that sidebar is your file/project explorer and as such critical for normal development. It's how you get to all your files. Sure, you can still get to them using F1 and type a name, but that's kind of painful, vs scrolling to find what you need or opening multiple files in a project at once.

Windows Powershell and Command Prompt Issue on Windows 10 OS

I have two queries that needs to be resolved.
How can I resize Windows Powershell to a considerable size in Windows 10? I have already tried using the Properties options and via ** Layout**.
But the moment I re-launch it, the window size goes to an in-proportionate size. (Please check the image attached for this query)
P.S - I also browsed Stack-overflow and found this link - [https://superuser.com/questions/68013/how-can-i-set-the-powershell-default-window-size-in-windows-7] but wasn't able to eliminate the issue. :(
Image - 1: In-proportionate size of Windows Powershell
Other than query #1, I also want to know - when I try to open cmd window in a particular folder, I am not able to see the option reading open cmd window here in the context sensitive menu. For quick reference, I am also attaching one image for this query.
Image - 2: No option to open Command Prompt via context-sensitive menu.
P.S: I am getting the option to open Windows Powershell in the above image
I earnestly request the experts here to guide me on these two queries so that I can use both Windows Powershell and Command Prompt without worrying about the size of the window every time.
I look forward to some quick guidance.
Regards.
You can set it in the properties on Powershell window.
After,
When you reopen Powershell, these settings will be saved. Tune Window Position values as well as needed.
For your 2nd issue, read on this link - https://fossbytes.com/powershell-replaces-command-prompt-windows/
If you aren’t ready to accept this change and ditch Command Prompt,
you can opt out of the WIN+X change. To do this, open Settings >
Personalization > Taskbar. Now, turn the “Replace Command Prompt with
Windows PowerShell in the menu when I right-click the Start button or
press Windows key+X” option to “Off”.
As for this...
open cmd window here in the context sensitive
Option:
You can just select any directory and click the Explorer search bar and type cmd or powershell or pwsh (v6 if you have it installed) and it will start in that directory; As long as you don't have directory configured in you PowerShell profile.
You can add thing to the context menu using the Registry editor
See instructions here:
Add the Command Prompt to the Windows Explorer Right-Click Menu
A hidden functionality in Windows allows you to right click on a directory, and select “Command Prompt Here” from the menu.
https://www.howtogeek.com/howto/windows/add-the-command-prompt-to-the-windows-explorer-right-click-menu
Just as you can for PowerShell
Add PowerShell to Windows Explorer Context Menu in Windows 10
Ever since the days of Windows Vista, it was possible to use Windows Explorer’s context menu to quickly open a command prompt window to a specific location by holding the shift key and right-clicking a folder. The “Open Command Prompt Here” appeared, allowing you to open the command prompt in the folder of your choice.
https://www.petri.com/add-powershell-windows-explorer-context-menu-windows-10
BTW, you can add anything you wish to your SendTo menu as well, just by copying the short cut there, and then that too will show up in the explore context menu for use.
As far as your PowerShell Window being overly large/small. Of course the is not the default and something / someone did that. I seen that, but never had it happen to me.
Have you made a lot of customizations?
Is this only happen in your logged on session, vs other users of the system?
So, are you saying also, you cannot resize the Window using your mouse to another size?
Try this first.
Exit the console host.
Open the PowerShell_ISE
Reset the defaults there using these commands
$PSise.Options.RestoreDefaults()
$PSise.Options.RestoreDefaultConsoleTokenColors()
$PSise.Options.RestoreDefaultTokenColors()
$PSise.Options.RestoreDefaultXMLTokenColors()
Next start the console host from the ISE by clicking the console host icon in the toolbar.
Try and work the properties from there, then close and reopen the console host form the ISE to see if the settings stayed.
Then open the console host from whatever shortcut you normally use and see if the changes remained.
If that does not reposition / resize the console windows then this is Windows proper causing this. Similar to a Window being off screen that you can't get to.
Then right click an open space on the taskbar and select Cascade windows.
If that does not work use the move option from the Taskbar.
Use Shift+Tab to select the console Windows.
Shift+RightClick the taskbar icon of the Window and select move.
The close and check again.
Lastly, if you have not done a lot of customizations, you can grab the default PowerShell regkey from another user / profile and import that into your registry.
If you don't have another default logon to use, just create one, check PowerShell state and the get that regkey to use.
Last thing, I meant to add, if none of the above works and you don't want to take the RegKey route. Create a PowerShell console profile and add this code to it. This of course will run each time you start you console using your profile. Of course adjust as needed,
$ConsoleSettings = (Get-Host).ui.rawui
$ScreenBufferSettings = $ConsoleSettings.buffersize
$ScreenBufferSettings.height = 50
$ScreenBufferSettings.width = 120
# $ConsoleSettings.buffersize = $ScreenBufferSettings
$ScreenSizeSettings = $ConsoleSettings.windowsize
$ScreenSizeSettings.height = 50
$ScreenSizeSettings.width = 120
$ConsoleSettings.windowsize = $ScreenSizeSettings