header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left
May 19

Written by: Tobias
5/19/2008 12:21 PM

In this blog, I cover features in PowerShell Plus. Feature #6: Pasting script and console content to a blog

if you wrote a cool script and would like to proudly show it off to others, you can. The PowerShell Plus editor supports color-coded script code transfer. All you need to do is launch the editor (press CTRL+E), load or write your script, then copy it and press CTRL+C. The editor actually copies the script in multiple formats to your clipboard, and if your blog editor supports HTML snippets, all you need to do is paste the code, and there you go with full color highlighting. Coincidentally, I have written a nice little script I'd like to share with you this way:

$helper = New-Object -COMObject WScript.Shell 
$desktop = [Environment]::GetFolderPath("Desktop"
$link = $helper.CreateShortcut("$desktop\launch PowerShell.lnk"
$link.TargetPath = ([wmi]"Win32_Process=$PID").ExecutablePath 
$link.IconLocation = $link.TargetPath + ',0' 
$link.Save()

This script creates a link on your desktop and launches PowerShell. It is a *very* liberal script so it does not care whether you use PowerShell Plus, powershell.exe, PowerGUI or yet another editor. The link will always automatically launch the powershell environment you used to create the link. And it also applies the correct icon to the link.

Now, if your blog editor happens to not support HTML snippet insert, you are still not out of luck. In this case, mark your script in the editor, then right-click on the selection. Choose "Copy as HTML source", and you get the HTML source code. Now it's up to you how you fiddle the source into your favorite HTML page.

But wait, what if I wanted to publish part of my real console output? Can I do that, too? Easily. Simply click the printer button in the PowerShell Plus console, or press CTRL+PRINT. PowerShell Plus copies the current console content in multiple formats to the clipboard. You get a bitmap as well as a fully-color coded HTML snippet. So if you ever wondered what my console looked like right now, here it is:


PowerShellPlus 1.0.4.2
(C) 2007-2008 Scriptinternals. All Rights Reserv



Globale Profile
PowerTab version 0.99 Beta 2 PowerShell TabExpan
sion library
/\/\o\/\/ 2007 http://thePowerShellGuy.com
PowerTab Tabexpansion additions enabled : True
33#

Enjoy!

Don't know PS+ yet? Go grab it: http://www.powershell.com/download/psp1.zip. Unzip, run. It's as easy as that. And it's free for non-commercial use. Enjoy!

Hungry for more? The latest (non-public) build is always available here: http://www.powershell.com/download/psp1new.zip. And the change log with the latest additions is available here: http://www.powershell.com/mantis/changelog_page.php.

 

 

$desktop

 

$helper

Tags:
 

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

Blogs
  
Search Blogs
  
Archives
  
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer