Batch
How-to show a Message of the Day (MOTD) at the Windows Command Prompt
One of the features available under UNIX is the Message of the Day (MOTD). This is run every time you start a command prompt and displays the content of a file. In addition, the UNIX shells allow all sorts of stuff to be run and configured every time you start a new prompt using the .profile and .bashrc command files. Windows users don’t generally expect that kind of flexibility from their command prompts.
Cygwin BASH function to open the latest version of a document
One handy function I’ve added to .bashrc (so it is always available) under Cygwin (the LINUX command environment for Windows) works out the current working version of a document. It assumes that you keep copies that have a version number or date in the file name that will sort correctly. You can use it with an alias like this: If you name your documents sensibly such as “a-document-2009-07-20.doc” or “a-document-v01.01.doc”, then the latest version of the file will be opened in the default application
Speeding up Cygwin
Yesterday I mentioned my success with Cygwin. One issue I did have though was with the speed of startup. It was taking 15-20 seconds to start a BASH shell. It turns out that this was a PATH issue. I went through my Windows PATH and cleared out the clutter. Now it takes just around 3-4 seconds for a full BASH login and less still for just running a script. I now find myself using the BASH shell for all sorts of things and I’ve set up a number of alias’s to switch to folders I’m using a lot and to open common documents.
Windows command prompt vs PowerShell vs Cygwin for remote backup scripts
I’ve been struggling with trying to get a new backup routine working for my Laptop. I should point out that I have several complex requirements for backup so my needs are probably not average. However, it really shouldn’t be this hard! I need to use a combination of BZR (Bazaar) for document version control and RSYNC (for files that don’t need version control and for those folders that might contain files too big for version control systems – around 1/3 to 1/2 available memory).
Keeping Control: File and Folder Links for Windows Users
A good backup strategy for any computer involves keeping control of where stuff is stored. The fewer locations that contain files that change, the fewer locations have to be maintained. UNIX users have always had the ability to keep things wherever they wanted and then to LINK that information into the required location. Basically, links create a link or tunnel between one file or folder and another. Most of the time, you will not notice that you’ve entered a tunnel and you are not interested really.
Changing system environment variables from the Windows command line
There are several ways to change global or user environment variables manually in Windows. Most are well known so I wont repeat them here (e.g. in Vista or Windows 7, Control Panel/User Accounts, Change my environment variables). However, sometimes you want to do this from a command (aka script or batch) file. This is not as straightforwards as it might seem. That’s because if you simply set the variable – e.
How to get and use your local IP address in a Windows 7 (and Vista) batch command file
If, like me, you spend a lot of time on a variety of customer sites, you will probably be familiar with the issues around swapping networks. I’ve already blogged about the problems with Windows 7, Vista and Firefox proxy settings and I will do some more articles on getting on with problematic proxies later. However, I wanted to let people know how to get hold of your IP address from within a batch (command) file.
Shell script to Back up critical files (using RSYNC)
Following up from my article on backing up USB drives, this recipe backs up the critical files on my desktop to remote storage (a NAS device on my network). Note that PC2 is the desktop to be backed up, SLUG1 (192.168.1.2) is the NAS device and USER1 is the user id doing the backup. I have a similar script that runs on the NAS device which backs key files on that to a remote hosting service on a different continent!
Automatically Backing up a USB Drive with RSYNC (KDE)
USB Drives of all kinds need to be backed up and the best backup is an automatic one (it’s the only way to make sure that it gets done!). So here is one recipe for doing just that using RSYNC and some BASH scripting magic. I’ve split this into two files. You don’t have to do this of course and one may well be better for you. I used two because I can run the second one manually as well.