Thomas Sampson

Leave a comment

Creating a new Windows Service

Sometimes it’s enough to add a program or script to the startup folder or scheduled a boot-time task, however if you need to setup a fully fledged Windows Service, the freeware NSSM (Non-Sucking Service Manager) tool can be used to quickly and easily install or remove Windows Services from the command line.

Creating a new Windows Service
The following command will pop-up a nice UI for you to select which program/script you want to run and allow you to tweak additional settings such as Automatic/Manual startup etc:

nssm install "YourNewServiceName"

Removing a Windows Service
The following command permanently un-registers and removes a Windows Service by name:

nssm remove "YourServiceName"

Leave a comment

Command Line Aliases/Macros


Entering long winded commands with many parameters, paths and redirection in the shell/terminal can be time consuming, repetitive and prone to human error. Luckily on both Windows and on Linux you can provide simple abbreviations for long commands.


On Windows the DOSKEY command (provided by default with the operating system) is pretty versatile and can be used to easily configure macros and command abbreviations. DOSKEY is actually resident during all Windows command line sessions and is the underlying system responsible for maintaining the command history (which can be navigate with the updown/pgup/pgdown keys). Below I have listed some example usages of DOSKEY;

# Note: The $G character is a special doskey escape character for the
#       redirect character '>' which allows it to be specified as part of
#       the command without redirecting the doskey command itself.

doskey /history                                       # Show history of all previously run commands
doskey /reinstall                                     # Clear command history
doskey here=explorer .                                # Add 'here' macro to open an explorer window at the current location
doskey desktop=cd "%USERPROFILE%\Desktop"             # Add 'desktop' macro which takes you to the current user's desktop
doskey mp3list=dir %CD%\*.mp3 /S /O:N $G mp3list.txt  # Add 'mp3list' macro to recursively and alphabetically list all .mp3
                                                      # files below the current directory, inside mp3list.txt

Note: Any macros configured using doskey are only active for the active command line session. To create macros which persist between sessions consider placing all macro creation commands in a batch script, you then have two options:

  1. Create a shortcut which opens the command line and runs your batch script immediately (shortcut location = %comspec% /k %path_to_script%)
  2. Use an alternative command line environment such as Console2 which can be configured to automatically run your batch script on start-up.


On Unix-esque systems it’s pretty much the same kind of setup using the alias command. Some example usages are listed below;

# Note: All alias entries are wrapped in single quotes so there is no requirement for special alias
#       escape characters for piping / redirecting streams

alias here='nautilus ${PWD}'                          # Add 'here' macro to open a nautilus window at the current location
type here                                             # Prints the expanded version of the 'here' macro
unalias here                                          # Unregister the 'here' alias
alias blog='firefox'  # Add a 'blog' alias to open your blog in firefox
alias dumpenv='export -p | grep "/" > env.txt'        # Dump all bash environment variables containing a path to 'paths.txt'

Note: As with DOSKEY on Windows, any macros configured using ‘alias’ are only active for the active bash shell session. The easiest way to make aliases persist between bash sessions is to add all of your alias commands to the bashrc shell configuration file located in your home directory (~/.bashrc ). This script is executed whenever you open a bash shell and can be used to automatically register aliases for all bash sessions.


Microsoft DOSKEY Documentation
10 Handy Bash Aliases
Hak5 Linux Temrinal 101 – Create Your Own Commands
30 Handy Bash Shell Aliases For Linux/Unix/MacOSX

Leave a comment

Small dissapointment in Vista

After making the leap into the world of Windows Vista (via purchase of a new tablet pc) I have been very impressed as a whole and especially its vast improvement on networking! However I was let down by the apparent removal of some advanced tools which myself and other power users are used to. While developing an application I wanted to configure filetypes of a certain extention to open specifically in my program but with extra parameters (command line) and to configure how they were presented in in the context menu when right clicked in windows explorer.

This was a simple enough proceedure in XP and was found in the “file types” tab of the “folder options” area. However after research and much wasted time I discovered that this functionality to edit the advanced properties of file types does not exist within Vista, or atleast does not appear to exist with any managable UI.

It is therefore dissapointing that the only way to achieve this advanced manipulation over file types is to download non-Microsoft software named

Creative Element Power Tools.

This software re-enables full control over file types and their properties in addition to a wealth of file / UI enhancements. And NO SPYWARE WHATSOEVER! I expected some of the features to be restricted or require registration but all worked out of the box, such as

  • file comparison
  • deleting of “in-use” files
  • file date changing
  • file contents to clipboard etc

Did Microsoft suddenly decide that the end user did not require this functionality?? Or perhaps im completely wrong and this functionality is hidden somewhere deep inside the over simplified menus of the control panel?? In conclusion, should it really be up to third parties to provide features which appear to have been dropped with a new “more advanced” operating system?