Opening a file with an unknown extension.

Hi Experts
we have an archiving system that stores files in the following format
within the system it logs the relevent file to the relevent extension so we know that file is a TIF file.
The question is how can I get windows to open file as a TIF with-out create a temorary file?
LVL 14
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
if the .xxx is always the same, and it will always be .tif, you can attach that extension .xxx to the same app as the .tif.
is the above assumption true or not?
Steve KnightIT ConsultancyCommented:
Unless what Guy says is true then presumably you must use the archiving system to extract the relevant file, temporarily rename/copy the file or similar.  You could have something like a shortcut to this batch file on desktop which you can drag a file onto it, it will create temp file called by original name but tif on the end, launch it then ask if to delete it.


@echo off
if "%~1"=="" (
  echo Drag a file to this icon and it will open as if a TIF file
  exit /b
set filename="%temp%\%~f1.tif"
copy /y "%~1"  "%filename%"
start /w "" %filename%
echo Press Return to delete the temporary file, anything else or close the window to leave it
set answer=Yes
set /p answer=
if "%answer%"=="Yes" del "%Filename%"

Open in new window

[Edit: corrected typo]

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aditya AroraNetwork & Hardware Commented:
Right click on a file then go to Its properties and then click on change and then select the viewer/program in which you open the TIF file >apply and then OK
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

daveslaterAuthor Commented:
the extension will always be different - it is use base62 to calculate the file name.
00000000.aa1 might be TIF
00000000.aa2 might be pdf
00000000.aa3 might be outlook message
00000000.aa4 might be tif

so the possible number of suffixes will be about 35000

Guy Hengel [angelIII / a3]Billing EngineerCommented:
sorry to say, but with windows explorer alone you won't be able to solve this.
Steve KnightIT ConsultancyCommented:
Well with batch file like I said you can have it open file renaming it one specified BUT it won't know what the file is to rename it, you'd have to decide.

Is there an API available for this archive app that can be called, e.g. from VBScript to retrieve a specific file for you?

daveslaterAuthor Commented:
I have come up with a sort of solution
basically the application builds the path and passes it to a batch file.
this batch file then creates a link with the correct extension then it STARTS the link and then delets the link.

rem set files name
set LinkFile=%TEMP%\%~2
set ActFile=%~1

rem make sure the link does not exist
del %LinkFile%
mklink %LinkFile% %ActFile%

rem Run the default application
start %LinkFile%

rem delate for a few mill secs to let the application launch
Ping -n 1 -w 10
rem tidy up
del %LinkFile%
exit \b

Open in new window

Steve KnightIT ConsultancyCommented:
Good idea if it works for you.  Not sure that always works but if it does for you great.

Surely the trouble here is that the application involved then has a file called open in it?

daveslaterAuthor Commented:
Thanks for the input Guys&Girls it helped me with the final fudge knowing what windows can and can not do.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.