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?
Steve KnightConnect With a Mentor IT 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]
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?
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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]Connect With a Mentor 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.
All Courses

From novice to tech pro — start learning today.