WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

FileExist Unable to Locate an EXE


Question:

I have the following snippet:

fex = FileExist("POWERPNT.EXE")
IF fex ==@FALSE
MESSAGE("POWERPOINT Error:","The POWERPNT.EXE can't be found!")
Break
ENDIF
Run("POWERPNT.EXE","")
FileExist return a false and displays the error message. However, the file does exist and its spelling is correct. If I comment out the BREAK, the RUN statement does bring up Powerpoint. Clearly, the file exists, but why doesn't the FileExist function find it?

Answer:

FileExist is not that smart. It only looks in the current directory.

You can either use the FileSearcher extender function to seach the entire system for that exe.

or

Attempt to grab the path from the registry.



dapath = RegQueryValue(@RegMachine,"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\powerpnt.exe[]")




Article ID:   W16445
File Created: 2005:02:18:12:20:44
Last Updated: 2005:02:18:12:20:44