the script runs fine for me on both vista and xp. are you sure you only copied just the script?
' TARGETDRIVE-- This is an open drive letter where your USB drive can be persistently mounted on
' each computer on which you will use this script. In Foobar you will point your
' Library to this drive to set the absolute paths to your media.
' SUBDIR-- Your probably won't choose to change this value, but it would allow you to map a
' subdirectory of your USB drive as the root of TARGETDRIVE.
' FOOBARRELATIVEPATH-- This string is the relative path from the working directory of this script
' to the foobar executable. If you put this script in the directory containing the
' foobar folder, this should work fine.
'************************************************************
Const TARGETDRIVE = "U:"
Const SUBDIR = "\"
Const FOOBARRELATIVEPATH="foobar2000\foobar2000.exe"
'************************************************************
Dim WshShell, FSO, sCmd, sCurrDrive, iResult
Set WshShell= Wscript.Createobject("Wscript.Shell")
Set FSO= Wscript.Createobject("Scripting.FileSystemObject")
sCurrDrive = FSO.GetDriveName(Wscript.ScriptFullName)
'delete substituted drives on the target drive letter-- won't affect mounted or real drives.
WshShell.Run "%comspec% /c if exist " & TARGETDRIVE & " subst " & TARGETDRIVE & " /d", 0, True
'Substitute USB drive/directory as target drive
sCmd = "%comspec% /c subst " & TARGETDRIVE & " """ & sCurrDrive & SUBDIR & """"
iResult = WshShell.Run(sCmd, 0, True)
If iResult > 0 Then
iResult = MsgBox("Error creating substitute drive " & TARGETDRIVE & ", launch Foobar?", vbYesNo + vbInformation, "Drive Substitution")
If iResult = vbNo Then Wscript.Quit
End If
' Run Foobar, and then delete subst drive letter when it exits
' (the two are done as one command line, so that Wscript can exit leaving behind only a
' hidden Cmd window to delete the drive letter when the program exits- much less memory.)
sCmd = "%comspec% /c """ & FOOBARRELATIVEPATH & """&&subst " & TARGETDRIVE & " /d"
WshShell.Run sCmd, 0, False