Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - How to launch the pretty PowerShell command line from VS?

Reply
 
Old 11-12-2006   #1 (permalink)
Joannes Vermorel


 
 

How to launch the pretty PowerShell command line from VS?

I am developing a .Net library containing custom CmdLets. I have set
PowerShell.exe as being the program to be launched when F5 is hit.

This behavior is nice and convenient to test the CmdLets, yet, the
PowerShell appears in the old looking cmd.exe windows (as opposed to the new
PowerShell window).

Is there any way to get the new PowerShell interface associated to a VS
project?

Thanks in advance,
Joannès
http://www.peoplewords.com


My System SpecsSystem Spec
Old 11-12-2006   #2 (permalink)
gaurhoth


 
 

Re: How to launch the pretty PowerShell command line from VS?

The powershell window is the result of a few settings on the shortcut that launches powershell. While you can change the color of the screen from your powershell profile, I don't know of any way to change things such enabling Quick edit mode which are done by the powershell shortcut. To see where these settings are, right click on the PowerShell icon and choose "Properties".

Easiest way to change the colors for any session of Powershell is to set it in your profile.

Create or edit the powershell profile file with command like:

PS ps:\> notepad $profile

and add the following line:

cmd.exe /c color 1f


"Joannes Vermorel" <JoannesVermorel@discussions.microsoft.com> wrote in message news:C350EC65-54B2-448E-9AC4-971BFB04B936@microsoft.com...
>I am developing a .Net library containing custom CmdLets. I have set
> PowerShell.exe as being the program to be launched when F5 is hit.
>
> This behavior is nice and convenient to test the CmdLets, yet, the
> PowerShell appears in the old looking cmd.exe windows (as opposed to the new
> PowerShell window).
>
> Is there any way to get the new PowerShell interface associated to a VS
> project?
>
> Thanks in advance,
> Joannès
> http://www.peoplewords.com
>

My System SpecsSystem Spec
Old 11-12-2006   #3 (permalink)
Andrew Watt [MVP]


 
 

Re: How to launch the pretty PowerShell command line from VS?

You might want to experiment with the following commands in the
profile(s if launching directly from PowerShell.exe):

$bufferSize = new-object System.Management.Automation.Host.Size 120,60
$host.UI.RawUI.BufferSize = $bufferSize
$host.UI.RawUI.WindowSize = $bufferSize

Run after the console launches it changes buffer size and window size.
I haven't tested it in a profile file but it might be worth a try.

Andrew Watt MVP

On Sun, 12 Nov 2006 15:34:53 -0500, "gaurhoth" <gaurhoth@yahoo.com>
wrote:

>The powershell window is the result of a few settings on the shortcut that launches powershell. While you can change the color of the screen from your powershell profile, I don't know of any way to change things such enabling Quick edit mode which are done by the powershell shortcut. To see where these settings are, right click on the PowerShell icon and choose "Properties".
>
>Easiest way to change the colors for any session of Powershell is to set it in your profile.
>
>Create or edit the powershell profile file with command like:
>
>PS ps:\> notepad $profile
>
>and add the following line:
>
>cmd.exe /c color 1f
>
>
>"Joannes Vermorel" <JoannesVermorel@discussions.microsoft.com> wrote in message news:C350EC65-54B2-448E-9AC4-971BFB04B936@microsoft.com...
>>I am developing a .Net library containing custom CmdLets. I have set
>> PowerShell.exe as being the program to be launched when F5 is hit.
>>
>> This behavior is nice and convenient to test the CmdLets, yet, the
>> PowerShell appears in the old looking cmd.exe windows (as opposed to the new
>> PowerShell window).
>>
>> Is there any way to get the new PowerShell interface associated to a VS
>> project?
>>
>> Thanks in advance,
>> Joannès
>> http://www.peoplewords.com
>>

My System SpecsSystem Spec
Old 11-12-2006   #4 (permalink)
dreeschkind


 
 

Re: How to launch the pretty PowerShell command line from VS?

Things like Quick edit mode are stored in the registry for all console apps
and AFAIK can also be overridden for each console app separately. See the
property "QuickEdit" under "HKCU:\Console" and under the various sub-keys.
You can use the following two scripts as a template to set all those values
automatically from PowerShell. (You will need to restart the console app.)

###################
# name: get-quickedit.ps1
# use: get-quickedit
###################
$ConsoleSettings = "HKCU:\Console"
Write-Host "Current QuickEdit setting: $([boolean][int](Get-ItemProperty
-Path $ConsoleSettings -Name QuickEdit).QuickEdit)"
###################

###################
# name: set-quickedit.ps1
# use: set-quickedit.ps1 $true
###################
$ConsoleSettings = "HKCU:\Console"
Set-ItemProperty -Path $ConsoleSettings -Name QuickEdit -Value
$([int]$Args[0])
###################

Note that this sets the default value for console apps. Therefore it should
work only if you run PowerShell.exe from the Start menu using the Run...
command (or from another app). It does not affect the settings that are
stored in the PowerShell shortcut.

--
greetings
dreeschkind

"gaurhoth" wrote:

> The powershell window is the result of a few settings on the shortcut that launches powershell. While you can change the color of the screen from your powershell profile, I don't know of any way to change things such enabling Quick edit mode which are done by the powershell shortcut. To see where these settings are, right click on the PowerShell icon and choose "Properties".
>
> Easiest way to change the colors for any session of Powershell is to set it in your profile.
>
> Create or edit the powershell profile file with command like:
>
> PS ps:\> notepad $profile
>
> and add the following line:
>
> cmd.exe /c color 1f
>
>
> "Joannes Vermorel" <JoannesVermorel@discussions.microsoft.com> wrote in message news:C350EC65-54B2-448E-9AC4-971BFB04B936@microsoft.com...
> >I am developing a .Net library containing custom CmdLets. I have set
> > PowerShell.exe as being the program to be launched when F5 is hit.
> >
> > This behavior is nice and convenient to test the CmdLets, yet, the
> > PowerShell appears in the old looking cmd.exe windows (as opposed to the new
> > PowerShell window).
> >
> > Is there any way to get the new PowerShell interface associated to a VS
> > project?
> >
> > Thanks in advance,
> > Joannès
> > http://www.peoplewords

My System SpecsSystem Spec
Old 11-13-2006   #5 (permalink)
Joannes Vermorel


 
 

Re: How to launch the pretty PowerShell command line from VS?

> You might want to experiment with the following commands in the
> profile(s if launching directly from PowerShell.exe):
>
> $bufferSize = new-object System.Management.Automation.Host.Size 120,60
> $host.UI.RawUI.BufferSize = $bufferSize
> $host.UI.RawUI.WindowSize = $bufferSize


Thanks a lot. This command, added to the profile, does a part of trick. Yet,
I still do not get the usual cut-and-paste behavior of PowerShell: it's still
the old right-click and then "paste here", instead of the new behavior
(simply right-click).

Joannes
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
How to pass the name of a PowerShell script as a command line para PowerShell
Documenting the command line that UAC attempts to launch Vista security
PowerShell command line quotation parsing quirk - can it be fixed? PowerShell
Running a Command line script from within powershell. PowerShell
Powershell.exe command-line syntax PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46