Jun 29 2016

Launch Mac apps with command-line parameters from Windows running under Parallels

I love running Windows using Parallels Desktop on my MacBook Pro (yes, those of you who know me well are aware that it wasn’t that long ago that I was amongst the Mac clueless).  Parallels makes it easy to associate your files with Mac applications running on your host.  If you want to launch a Mac app from the command line, either PowerShell or cmd.exe, you just need to look in the following directory for the app to launch:

"C:\Users\rob\AppData\Roaming\Parallels\Shared Applications"

Note that you will need to replace my username (i.e. rob) in the path above with whatever account you are logged into in your Windows VM.

So, if I want to run the Sublime Text editor installed on my Mac host, I can just run the following from PowerShell:

& "C:\Users\rob\AppData\Roaming\Parallels\Shared Applications\Sublime Text (Mac).exe"

However, when I tried to pass a command-line parameter to this app, I couldn’t get it to work.  I was trying to pass the file that I wanted to open in Sublime Text from the command line, but Sublime always opened to a blank document.

Thanks to the fine folks at Parallels Support on Twitter, I got the solution: You must pass the full path to the file, not the relative path. It worked!

Now I had one more problem.  From PowerShell, I typically pass the relative path of a file (if I pass any path at all) to apps at the command line.  So, I needed to find a way to pass either the relative path to the file or the full path, if I already have it available.  So, I wrote a PowerShell function:

function s { & "C:\Users\rob\AppData\Roaming\Parallels\Shared Applications\Sublime Text (Mac).exe" (Get-Item $args[0]).FullName }

So, now I can run either of the following PowerShell commands to open a file in Sublime Text:

cd C:\Users\rob\Documents
s file.txt


s C:\Users\rob\Documents\file.txt

This means that I don’t have to install apps that I already own on my Mac in my Windows VM, as well.  This will save me from having to configure each of these apps twice.  This makes setting up new VMs really easy as well since they will just leverage my Mac’s configured apps.  Woohoo!


Dec 24 2012

The site is back online

After a problem with the web site about six months ago, I have recreated the Tardis Technologies blog.  Unfortunately, the WordPress database format changed a little bit, so I need to do some work to get it back in a format for posting.  The first post is back online.  I hope to get the rest of the old content online soon.


Mar 08 2012

Want to add color to PowerShell code in your docs?

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:

  1. Install the PowerShellPack.msi file from here.
  2. Open ISE and your .ps1 PowerShell file.
  3. In the bottom third of the window, enter the following PowerShell command:
    1. Import-Module PowerShellPack
  4. You will now see an Add-ons menu in ISE; it may have already been there.
  5. Highlight the PowerShell code you wish to copy and choose Add-ons, IsePack, Edit, Copy-Colored from the menu.
  6. Now switch to Word and paste in your PowerShell code with full syntax highlighting.
  7. You can also use Copy-ColoredAsHtml to put syntax-highlighted HTML into your clipboard.
  8. 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)“.

Jan 13 2012

File Hashing Is Built Into Windows

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.

Dec 05 2011

Making Image Backgrounds Transparent with Paint.Net

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
    • Overwrite
  • You can access the parameters after choosing the bucket. Press the little chemical bottle icon, in the right to the fill tolerance slider.

Older posts «