Function RelativeFileName(strPath, strFile) 'Returns a full unquoted path & file name for strFile. 'strFile is evaluated relative to the strPath location '(which is typically hta.CommandLine). 'If strFile starts with a backslash, the returned 'path will be in the drive root. Dim strFolder, strFilePath Dim fs 'As Scripting.FileSystemObject Set fs = CreateObject("Scripting.FileSystemObject") strFolder = strPath strFolder = Replace(strFolder, """", "") If Left(strFile, 1) = "\" Then strFolder = Left(strFolder, InStr(strFolder, "\")) Else strFolder = Left(strFolder, InStrRev(strFolder, "\")) End If strFilePath = fs.BuildPath(strFolder, strFile) strFilePath = fs.GetAbsolutePathName(strFilePath) ' 'Add quotes ' If Left(strFilePath, 1) <> """" Then strFilePath = """" & strFilePath ' If Right(strFilePath, 1) <> """" Then strFilePath = strFilePath & """" 'Remove quotes If Left(strFilePath, 1) = """" Then strFilePath = Mid(strFilePath, 2) If Right(strFilePath, 1) = """" Then strFilePath = Left(strFilePath, Len(strFilePath) - 1) RelativeFileName = strFilePath End Function