Jump to content


USB Installation AutoRun and Drive Letter Changing

  • Please log in to reply
1 reply to this topic

#1 page2pagepro



  • Member
  • Pip
  • 8 posts
  • Main OS: Windows XP

Posted 05 February 2010 - 09:27 AM


I how found that hard-coding Drive letter in config files (httpd.conf, ssl.conf, my.ini, php.ini, etc.) can lead to issues when you migrate a USB-key installation to another PC.

I work on projects on multiple PC's and wanted the system to recognize what relative path it was on, then adjust according.

My solution is as follows (If anyone has alternative and/or better solution, please share):
This is for Windows 9X, 2K and XP (Vista not verified)

Step 1: Install like normal
Step 2: Change references to %drive-letter%:/ to simply a backslash in 'main' config files
Step 3: Create Start.bat file in UniServer Folder on USB drive with following lines:
@echo off
pushd %~dp0
start %~dp0Start.exe
Step 4: Create autorun.inf in root of USB drive with following lines:
action=Start Uniform Server
Step 5: Done!

The reason we create the autorun.inf is to allow a custom auto-run.
The reason we use the batch file in lieu of the executable is that I've experienced that accessing the Start.exe directly from the autorun.inf is unsuccessful. I believe it may have to do with the way the CWD (current working directory) info is relayed to the executable from the autorun file. The batch file switches to current directory and 'pops' it back to normal. I realise this is kinda a hack, but I can dynamically change drive letter of the USB-key on any PC and with I insert the key, the autorun.inf works without a hiccup.

Thank you for your time!

#2 BobS


    Project Helper

  • Super Moderator
  • PipPipPip
  • 334 posts
  • Location:Santiago Chile
  • Interests:Retiring, computer systems, system design, model railroads....
  • Wiki ID: BobS
  • Main OS: Windows 7

Posted 19 April 2011 - 07:06 AM

Where you have "F:\UniServer", for example, just change that to "\UniServer".


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users