Google+

Type and Enter

How to increase Writing Space in Command Prompt and Powershell

increase Writing Space in Command Prompt and Powershell


Command prompt or PowerShell is widely used to run several commands for different platforms these days. Running ASP.NET commands has become a tough task. You would have experienced a situation where you get annoyed after opening the prompt and realize that there is a very little space for typing the commands. There won’t be even few words space to write the commands.
Steps to increase the writing space in Command Prompt:

There are two methods to increase Writing Space in Command Prompt and Powershell.

First Method:


Step 1:
Open Command prompt. This can be opened by clicking on the start menu and typing ‘cmd’ and pressing Enter.

Step 2:
In order to change the configuration of the Command prompt, type and run the following command.
Prompt $p$_$g

But unfortunately, this change is only active during the open session. But if you close and open the command prompt again, you will see that the space is again limited.

In order to leave the change permanently in command prompt, just follow a simple step.
Type and run the following command in the prompt:

SETX/M prompt $p$_$g

Second Method:


The second method is to directly insert the command in the registry. In this case’, follow the below steps:

Step 1:
Create an Autorun command called REG_EXPAND_SZ

Step 2:
Now, go to this path,
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\

Step 3:
Place the Autorun command created in Step 1 in the path mentioned in Step 2.
And again, unfortunately, this method does not save the settings as the prompt is closed. You can prolong the settings to last permanently by using Windows PowerShell Profiles.
In order to leave the settings stay permanently follow the below mentioned steps.

Step 1:
Go to start menu and type powershell_ise.exe and click on the powershell_ise.exe run command which is resulted in the search.

Step 2:
The powershell prompt is the function which formats the PowerShell prompt. You can verify the same by entering the following command and pressing the Enter key.
(Get-command prompt).Definition
As this is a function, you can get the source code using ‘Get-command prompt’.
Step 3:
If you get the source code using the above method, it is very easy to overwrite the original PowerShell function using the below lines of command.
function prompt
{
“PS $($executionContext.SessionState.Path.CurrentLocation)`n>”
}

In the above lines, “`n” is to create a new line in PowerShell.
If you run this command, you will see that the cursor is already in the next line.

To continue this state of increase in typing space, you must save the prompt function within the profile. Hence, to save the code in all user profile hosts of PowerShell works in the best way.
This file is not present in a computer by default. You can create it using PowerShell by running the following command.

new-item -ItemType file -Path $($profile.CurrentUserAllHosts) -Value $script –force
In order to open the created file using PowerShell, You must run the following command.
invoke-item $profile.CurrentUserAllHosts

Now, you must copy the function created in the previous step in the Profile file and save the changes.
You can automate the entire process mentioned above by running the following script.

$script = @’
function prompt
{
“PS $($executionContext.SessionState.Path.CurrentLocation)`n>”
}
‘@
new-item -ItemType file -Path $($profile.CurrentUserAllHosts) -Value $script -force
invoke-item $profile.CurrentUserAllHosts

Conclusion:

The above steps to increase the typing space are not required for users who use the new build of Windows 10. The Operating system developers have taken the stress on themselves to solve this issue. But other windows versions’ users must follow the above steps as the issue of limited typing space persists there.

No comments:

Post a comment