View Full Version : system files


mazza
08-18-2006, 04:47 AM
I run a vb script that finds and delete files. This works fine as long as the directory is correct. The problem is that I have users who uses different language versions of windows.
The english version is C:\program files
The German is C:\programme
etc


Can I use s System directory name that replaces C:\program files in my path

This is my script.


Sub Main()

If My.Computer.FileSystem.FileExists("C:\Program Files\Compair service management\sqsv2.mdb") Then

'My.Computer.FileSystem.DeleteFile("C:\Program Files\Compair service management\sqsv2.mdb", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)

Else
MsgBox("Your SQS file is not in the default location. Please after the installation you must move SQSv2.MDB to the correct location. The system will install the update in c:\program files\compair service management\")
End If
If My.Computer.FileSystem.FileExists("C:\Program Files\Compair service management\sqsv2update.mdb") Then

My.Computer.FileSystem.DeleteFile("C:\Program Files\Compair service management\sqsv2update.mdb", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.ThrowException)
Else
MsgBox("Your SQS Update file is not in the default location. Please after the installation you must move SQSv2Update.MDB to the correct location. The system will install the update in c:\program files\compair service management\")
End If

End Sub

ghudson
09-08-2006, 05:20 AM
The Environ() function will give you want you want.

MsgBox Environ("ProgramFiles")

Search around for there are samples of all the Environ properties you can grab from the users computer.