file-association

Running Python script from command line opens script in the default text editor instead of executing script

懵懂的女人 提交于 2019-11-27 18:42:00
问题 I have files with .py extension associated with Python interpreter. However when I type name of such a file at the command line and press ENTER the file is being opened in the default text editor (Notepad++) instead of being run with the associated Python interpreter. Why? Z:\1>where python c:\Program Files\Python\2.7\python.exe Z:\1>reg query HKCR\.py /ve HKEY_CLASSES_ROOT\.py (Default) REG_SZ Python.File Z:\1>reg query HKCR\Python.File\shell\open\command /ve HKEY_CLASSES_ROOT\Python.File

Cross-platform way to open a file using Java 1.5

最后都变了- 提交于 2019-11-27 17:52:48
问题 I'm using Java 1.5 and I'd like to launch the associated application to open the file. I know that Java 1.6 introduced the Desktop API, but I need a solution for Java 1.5 . So far I found a way to do it in Windows: Runtime.getRuntime().exec(new String[]{ "rundll32", "url.dll,FileProtocolHandler", fileName }); Is there a cross-platform way to do it? Or at least a similar solution for Linux ? 回答1: +1 for this answer Additionally I would suggest the following implementation using polymorphism:

How to associate file type with MacOS X App without launching it first?

十年热恋 提交于 2019-11-27 15:38:46
I would like to associate the last installed version of my Mac OS X application with a certain type of file. A little experimentation shows that the info.plist file seems to be read and interpreted by the operating system when launching the application, not when dragging the application bundle to the disk. Apple's documentation on run-time configuration does not say much on that topic. Is there any way, using a simple .dmg image as installation medium, to make sure the system associates that particular file type with my newly installed app without having to launch it first? I should clarify

Associate file extension to python script, so that I can open the file by double click, in windows

穿精又带淫゛_ 提交于 2019-11-27 15:34:02
I want to do the following: Save numeric data in a CSV-like formatting, with a ".foo" extension; Associate the ".foo" file extension with some python script, which in turns opens the .foo file, reads its content, and plots something with a plotting library (matplotlib most probably). The use-case would be: double-click the file, and its respective plot pops up right away. I wonder how I should write a python script in order to do that. Besides, the windows "open with" dialog only allows me to choose executables (*.exe). If I choose "fooOpener.py", it doesn't work. This isn't really a

How do I get the icon associated with a file type?

前提是你 提交于 2019-11-27 14:11:05
I have a form that displays file information in a TabControl, and I'd like the pages to have the file's icon in their tab. How do I get the icon associated with a file type? I'd prefer solutions that don't involve looking things up in the registry, but if that's the only way then so be it. Bill the Lizard CodeProject has some classes you can download. First get the FileAssociationInfo , and from that get the ProgramAssociationInfo . The pai object can give you the icon. FileAssociationInfo fai = new FileAssociationInfo(".bob"); ProgramAssociationInfo pai = new ProgramAssociationInfo(fai.ProgID

How to get icon and description from file extension using Delphi?

假如想象 提交于 2019-11-27 11:58:37
问题 Basically I have a TcxGrid which will be listing various files names and I'd like to give further details based on the file extension, specifically it's description (e.g. for .PDF it's "Adobe Acrobat Document") and it's related icon. I notice there is a very similar question already but it's C# related and I'd like something Delphi based. Suggestions on where to look for this kind of info would be good and if there is a class similar to the one mentioned in the C# post above (obviously in

Add a new file association in Windows 7 [closed]

旧巷老猫 提交于 2019-11-27 11:35:29
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . With Windows XP I could use the Control Panel to add a new file extension, associate it with a program, and assign an icon to it. I did that using Folder Options in the Control Panel. Folder Options has a tab in it called "File Types". But Windows 7 Folder Options does not have that tab. And the suggested place

Utilising a file association in a Java application

℡╲_俬逩灬. 提交于 2019-11-27 09:35:11
I am in the process of writing a cross platform Swing based application in which I want to utilize a file association which has been registered with the OS. So iv got to the point where I can click on a file and my app loads, but what I need to know is how I can get my application to know where the file is that launched it and then query the contents. Is there something further I have to do with the file association registration? Or can Java do this for me? I'm not positive, but I'd expect that the name of the file you're processing by file click will end up in the arguments to your main()

Temporary file association for single cmd.exe session

丶灬走出姿态 提交于 2019-11-27 08:45:00
I need to set association for .py files to be executed with specific python version. But I need to make this association only for single cmd.exe session (parallel sessions should not be affected). Does Windows allow this? I suspect the answer is no, but I'd like to see some proof before throwing out the idea to get such feature into virtualenv . Piotr Dobrogost Sure you can. You were very close to answer in your comment to Jakob's answer - If it is possible to change file association with environment variables - it will help, but it doesn't seem possible. It is possible. All you have to do is

How to get recommended programs associated with file extension in C#

我怕爱的太早我们不能终老 提交于 2019-11-27 08:08:53
I want to get path to the programs that associated with file extension, preferably through Win32 API. List of programs that appears in "Open With" menu item List of programs that appears as recommended in "Open With..." dialog. UPD: Assume that i have office11 and office12 installed on my machine, default program for .xls is office 11. If look at HKEY_CLASSES_ROOT\Excel.Sheet.8\shell\Open\command there is a path to office11 excel.exe, but when i right click on file i can choose office12 in Open With menu item. So where is this association stored? I'm using C#. Thanks. I wrote a small routine: