Run association mysterious

Started by twright3, August 27, 2022, 03:12:41 PM

Previous topic - Next topic

twright3

If I double click on a .jpg file in Explore it runs the application I have specified. If in WinBatch I use:
Run(jpeg_file_path,"")
A different program is run. What "association" is Run using to pick this program? Why is it different from double clicking on a file?

td

The why is system specific so the question cannot be answered completely. The obvious explanation is that the Windows graphic shell (the process behind the window you are clicking) and WinBatch use different search algorithms for searching all the possible file association locations to identify which executable is responsible for loading the given file extension. Try the ShellExecute function instead.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Also, if you have a specific application you wish to use for your "jpeg_file_path" file, you could specify it in the Run function's first parameter and place the "jpeg_file_path" in the second parameter.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade