Solved

Opening a file with an unknown extension.

Posted on 2014-01-23
9
452 Views
Last Modified: 2014-01-23
Hi Experts
we have an archiving system that stores files in the following format
xxxxxxxx.xxx
within the system it logs the relevent file to the relevent extension so we know that file
a12345678.abc is a TIF file.
The question is how can I get windows to open file
a12345678.abc as a TIF with-out create a temorary file?
0
Comment
Question by:daveslater
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
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?
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 250 total points
Comment Utility
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.

Steve

@echo off
if "%~1"=="" (
  echo Drag a file to this icon and it will open as if a TIF file
  pause 
  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]
0
 
LVL 6

Expert Comment

by:Aditya Arora
Comment Utility
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
1.JPG
2.JPG
3.JPG
0
 
LVL 14

Author Comment

by:daveslater
Comment Utility
Hi
the extension will always be different - it is use base62 to calculate the file name.
ie
file
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

Dave
0
Do email signature updates give you a headache?

Do you feel like you are constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 250 total points
Comment Utility
sorry to say, but with windows explorer alone you won't be able to solve this.
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
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?

Steve
0
 
LVL 14

Author Comment

by:daveslater
Comment Utility
Hi
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 10.1.256.251 -n 1 -w 10
rem tidy up
del %LinkFile%
exit \b

Open in new window

0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
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 32442442.abc open in it?

Steve
0
 
LVL 14

Author Closing Comment

by:daveslater
Comment Utility
Thanks for the input Guys&Girls it helped me with the final fudge knowing what windows can and can not do.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
The use of stolen credentials is a hot commodity this year allowing threat actors to move laterally within the network in order to avoid breach detection.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now