Category Archives: Scripting

Apply WhatIf to an entire script

      Comments Off on Apply WhatIf to an entire script

Yesterday, I needed to create a script that would allow me to stop a lot of services in one go, so I created a small one-liner script. However, as it could be dangerously easy to execute this by mistake, I decided to figure out how to apply WhatIf as a… Read more »

Powershell: Get an indented process tree

      Comments Off on Powershell: Get an indented process tree
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

      Comments Off on 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

      Comments Off on 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 »

Merging videos with mencoder

      Comments Off on Merging videos with mencoder
merging videos

In this article, I present an easy way to merge all video files in a directory using the Open Source tool mencoder (part of mplayer, the video player) using a batch file, suitable for Windows XP and later. The method below supports merging AVI, MPG, MP4, WMV and RM files.

Sharing Clementine song status in Empathy

      Comments Off on Sharing Clementine song status in Empathy
clementine song status 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: About Variables

      Comments Off on CMD.EXE: About Variables

In this article I will give some extra information on the usage of CMD.EXE variables in batch files. These variables are stored in the so-called Environment, hence the name Environment Variables. There are two environments on a Windows machine: The System and the User environment. When a variable is set… Read more »

CMD.exe recursion in batch: Deleting empty subdirectories

      Comments Off on 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

      Comments Off on 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 if not exist c:\test\*.* echo No files! 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… Read more »