Category Archives: Scripting

Powershell: Get an indented process tree

      No Comments on Powershell: Get an indented process tree

In PowerShell, there is the Get-Process cmdlet. However, this does not return the ParentProcessId property, so it is unsuitable for displaying an indented process tree, which you, for instance, could send by email. Luckily, there is the Get-WMIObject cmdlet that can return the ParentProcessId. How to get a Process Tree… Read more »

Reading the Windows Registry from PowerShell

Reading the Windows registry from PowerShell can be a bit cumbersome, when all you wanted to retrieve is the value of an item under a key, at least with PowerShell version before v5. The Get-ItemProperty can be used to enumerate the items and their values under a registry key, but… Read more »

Useful PowerShell functions and snippets

This post contains a few (short) useful PowerShell functions and snippets, that you can include in projects and/or your profile, and some which showcase some peculiar solutions to problems in PowerShell. This one is for use in your profile, so you can see in Alt-Tab which Powershell console is running… Read more »

Sharing Clementine song status in Empathy

      No Comments on Sharing Clementine song status in Empathy

Found this handy python script for sharing Clementine song status in Empathy….. regrettably it did not work on my Ubuntu 12.10 desktop installation…. Apparently you have to add a line (see the second line) about the character encoding nowadays….. so just to make it easier for other people… here’s the… Read more »

CMD.exe recursion in batch: Deleting empty subdirectories

This article addresses one specific use case for recursion in batch: Recursively looping through a directory (also called a folder) and its sub directories. Normally, this is a pain, and it took me a while to come up with an algorithm that works. For recursion to work correctly, you need:… Read more »

Cmd.exe: Workaround for “if not exist *.*” and other uses for the FOR command

One of the annoying things in Windows XP/2003 and later, is that the construct

does not work as expected if c:\test is empty. This seems to be due to the fact that Windows regards the “.” and “..” file entries as valid files (even though, technically they are directories),… Read more »