I was writing a Word document and wanted syntax highlighting for my PowerShell scripts. It turns out that ISE (Integrated Scripting Environment) has an extension for copying text with color (and for copying text with color as HTML). Just do the following:
- Install the PowerShellPack.msi file from here.
- Open ISE and your .ps1 PowerShell file.
- In the bottom third of the window, enter the following PowerShell command:
- Import-Module PowerShellPack
- You will now see an Add-ons menu in ISE; it may have already been there.
- Highlight the PowerShell code you wish to copy and choose Add-ons, IsePack, Edit, Copy-Colored from the menu.
- Now switch to Word and paste in your PowerShell code with full syntax highlighting.
- You can also use Copy-ColoredAsHtml to put syntax-highlighted HTML into your clipboard.
- Note that Ctrl-Shift-C will perform the Copy-Colored function and Ctrl-Alt-Shift-C will perform the Copy-ColoredAsHtml function.
This information came from “How to Insert Formatted Windows PowerShell Code on TechNet Wiki (en-US)“.
I always used to download the md5sum.exe and sha1sum.exe files when I needed to generate a file’s hash in Windows. I just discovered that certutil.exe, included with Windows 7 and Windows Server 2008 R2, will do this for you (I’m not sure if it was included in earlier versions of Windows). Just use the following commands to generate the appropriate hash:
- MD5: certutil -hashfile C:\Windows\notepad.exe MD5
- SHA1: certutil -hashfile C:\Windows\notepad.exe SHA1
- SHA256: certutil -hashfile C:\Windows\notepad.exe SHA256
- SHA512: certutil -hashfile C:\Windows\notepad.exe SHA512
Note that it defaults to SHA1 if you do not specify a hashing algorithm.
I found this solution on the getpaint.net web site:
- I use the Bucket (fill) with a full transparent color.
- Set the foreground to white and fully transparent, i.e. RGB all = 255, Transparency – Alpha = 0
- Set the background to white and not transparent, i.e. RGB all = 255, Transparency – Alpha = 255
- You have to change the tool parameters from “Normal blend” to “Overwrite” in advance, or you won’t see any effect.
- Tool = Bucket Fill
- Flood Mode = Contiguous
- Fill = Solid Color
- Tolerance = 17%
- Antialiasing = Enabled
- You can access the parameters after choosing the bucket. Press the little chemical bottle icon, in the right to the fill tolerance slider.
When you plan to install the Windows 7/2008 R2 SDK, the SDK needs to be installed before VS2010 SP1. Here is the recommended install order:
1. Visual Studio 2010
2. Windows SDK 7.1
3. Visual Studio 2010 SP1
4. Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
Here is the link to the blog post about this: http://blogs.msdn.com/b/vcblog/archive/2011/03/31/10148110.aspx