Monday, October 20, 2008

Path too long error

Just reinstalled Windows recently on my desktop system and last night I went looking around for an easier to manage SVN server for Windows and that's how I found VisualSVN server, which seems to be what I was looking for. While late and tired (blaming yourself for being a dumb**s is never the first option) I setup the app to store the repositories in the same folder where I had the original repository and then started importing the old repository in the same place with the same name, SVN_ROOT - I know, what are the odds for that happening again to someone else, right? statistics show that if something stupid is possible to do, someone else will most likely do it again, and then this post will prove very useful :-) Basically VisualSVN worked for a few good minutes in a loop and created a deep structure like this...



... which btw, you can't delete cause most Microsoft tools are compiled with MAX_PATH = 260 chars - Microsoft KB 177665. What to do? Tried a few tools, spent a half an hour on the net and luckly I found this post on David Cumps' blog - big thanks to James C-S and Kenny for a clever solution using Robocopy with /MIR (or /PURGE) parameters to basically mirror a blank folder on top of the folder you want to remove - in my case:

MKDIR D:\empty
ROBOCOPY D:\empty D:\SVN_ROOT\SVN_ROOT /MIR
RMDIR D:\SVN_ROOT\SVN_ROOT
I believe robocopy is included with Vista and Windows 2008 Server - for XP and 2003 Server, you find it as part of the Windows 2003 Resource Kit Tools.

Friday, October 10, 2008

How to run your application as a Windows service

http://www.nick.rozanski.org.uk/software

SVC.EXE

Synopsis. SVC.EXE is a simple Windows NT command-line program to manage NT services. Services can be listed, and individual services can be displayed, installed, modified or removed. It includes facilities to define service dependencies. The program prompts for all needed information from stdin. For most prompts, typing ? will display a help message.

WARNING - YOU ARE ADVISED TO BACK UP YOUR REGISTRY BEFORE RUNNING THIS PROGRAM. (Although I have never encountered any problems while using it.)

You can read more about it here.

SRVSTART.EXE

Synopsis. SRVSTART.EXE is a Win32 executable and DLL which allows you to run commands as if they were Windows NT services. It also has some features to enhance the running of ordinary console commands (prompting for parameters etc). The DLL can be used on its own to build a service without having to write any service management code.


SRVSTART.EXE operates in one of two modes.

  • It can be used to run an ordinary command (executable program batch file). In this command mode, SRVSTART.EXE can prompt the user for the values of command-line parameters such as passwords.
  • It can be used to run an executable program in the context of a Windows NT service (service mode). SRVSTART.EXE will itself handle all of the interactions with the NT Service Control Manager (SCM). It is not necessary for the program to include any service management code.

You can read more about SRVSTART.EXE here and there is a Quick-Start Guide and FAQ here.