Force Firefox not to change file extension? - firefox

Is it possible to force Firefox not to change the file extension of a file the user downloads? Currently I have the problem that I have a .reg file to download, but Firefox, even though in the Download dialog it says "Text file (*.reg)", saves it as a .reg.txt file, which is highly annoying. How to fix this?

You could try to do the following things:
1.) https://support.mozilla.org/en-US/kb/change-firefox-behavior-when-open-file
Maybe extension (in your case .reg) is associated with Notepad and you could changed it in Options/Applications
a) Click the menu button and choose Options.
b) Select the Applications panel.
c) The Applications panel will display. Select the type of file for which you want to change the default action.
2.) https://bugzilla.mozilla.org/show_bug.cgi?id=511624
This is an old bug, but if you use the affected version of firefox...
When you right click on a link to a batch file and click save as, it will allow you to save it, but it automatically adds .txt to the end of the filename without informing you.
You are unable to save it as .bat
Reproducible: Always
Steps to Reproduce:
1.Right click on a batch file link
2.Click save as
3.Save it
Actual Results:
filename is file.bat.txt

Seems to be a Firefox on Windows bug. My coworker was implementing download of .reg files and I use Firefox, I tested for him and got a .reg.txt. Just renaming it after download was sufficient to make the .reg work, but I got curious if that would happen on Linux also.
Grabbed my laptop where I have Ubuntu installed and the file was downloaded with the correct extension (just didn't run because .reg is a windows extension, it did open in the text editor). It was not automatically renamed as a .txt.

Related

How to change a file's extension to something else?

I downloaded an .R file from a zoom chat on desktop to open in Rstudio later.
Well, the .R extension was not part of the name, so I changed the name to something.pdf (of course by mistake).
The icon now looks like a pdf. I replaced the .pdf with .R. But the icon still is a PDF file and Rstudio does not recognize it as an R file.
How can I can change it back to its .R format?
edit. thanks for pointing this out. I am on a windows 10 machine. and the file is on desktop.
Troubleshoot for Windows
You may be trying to add multiple file extensions, which does not allow the file to be ready correctly.
A quick google search.
How do I reveal file extensions?
For Windows 8-10
Start Windows Explorer, you can do this by opening up any folder.
Click the View menu.
Check the box next to "File name Extensions"
Then make sure you have my_file.R as opposed to my_file.R.R.pdf.

Correct the file associations in the registry in windows 7 when a program is deleted

I have a windows 7 operating system and had installed Rstudio in the my documents folder (by just unzipping the .zip file) as I don´t have admin rights to my computer.
I then manually associated the file endings .Rproj .R and .Rmd with rstudio.exe by:
right-clicking on a file with that ending
selecting "Open with..."
Clicking on "Browse"
Going to the "bin" folder within my RStudio installation and selecting "rstudio.exe"
This worked fine, and the files opened automatically in RStudio when I double-clicked on them.
Over the following months, I updated RStudio twice but did not delete the old versions. Then I noticed that the files were always opening in the oldest version of RStudio (the first one that I had installed).
I decided to clean up, and deleted the two older versions.
At this point, the file associations dissappeared (as expected, since I had just deleted the program they had been associated with).
To associated them to the latest version of RStudio, I repeated the manual steps above, but hit a snag: after selecting rstudio.exe by clicking on the "browse" button within the dialogue box, the program did not appear as an option in the main dialogue box and I could not associate the file with it.
I searched for a solution here and elsewhere but was unable to find one with a complete set of steps that fixed my problem. I did note that this problem is by no means unique to Rstudio, and I suppose can happen to any file endings that have been associated with a program that you have deleted (as opposed to uninstalled?).
I had a suspicion that the path to the old version of Rstudio was stuck in the registry somewhere, but trying various iterations of assoc .Rproj in the command-line didn´t help me:
C:\Users\myusername>assoc .Rproj
File association not found for extension .Rproj
C:\Users\myusername>assoc .Rproj = rstudio
Access is denied.
Also, RStudio was not available in the Default Programs list (accessed from the start menu) and the affected file endings were not listed under File associations either.
I eventually found the solution using windows regedit - but since there doesn´t seem to be a post with the complete steps for this, I have posted it as an answer here, in case anyone else faces the same issue. I had to do this the point and click way, so would be grateful if anyone could provide a solution in the command-line interface, or provide some insight into why I got that "Access is denied" message (which occured even when I tried logging in with a temporary admin account).
It turns out I was right - the old file path was still associated to the file endings in the registry. I was unable to access or edit it from the windows command line prompt, but using the windows regedit program worked, as follows:
Go to the start button, type regedit and click on the regedit program icon to open it.
On the left-hand side menu in regedit, click on the arrow to expand the folder HKEY_CLASSES_ROOT
Scroll down the list to look for the file endings that have become unassociated (in my case this was .R, .Rproj and .Rmd)
Click on one of the unassociated file endings to see what details are recorded for it (these will appear in the right-hand panel of regedit).
See what it says under the Data column for your file ending (in my case, for .R it said “R_auto_file”).
This value (e.g. “R_auto_file”) is the key used to point to the program that will be used to open the file.
Now scroll further down the left-hand menu in regedit, past the zs and keep going until you find a sub-folder with the same name as the key you just identified.
Click on the arrow next to this sub-folder (e.g. “R_auto_file”) to expand it and expand the sub-folders within it (shell and open) until you get to command.
Click on command to view the details in the right-hand panel.
Right-click on the icon that says Default under the column Name in the right-hand panel and select Modify… from the menu that appears.
In the dialogue box that appears, under Value data: you will see an editable file path to the program being used to open the file.
This file path will probably be pointing to the old version of the program that you deleted.
Edit the file path so that it points to the new program, and click ok to save the changes.
Repeat steps 3 – 13 for all file types that have become unassociated.
Restart the computer for the changes to take effect.
You should now see that the files have the program icon next to them and open with the correct version when you double-click on them.
I had a similar issue with RStudio on Windows:
After installing RStudio with the installer I have updated to a newer version via the downloadable ZIP file and installed it into another folder.
Since then a double-click on .Rproj opened the old RStudio instead of the new one despite I tried to reassign the extension with the new RStudio.exe file
My solution was to change this registry entry via a Console:
reg add HKEY_USERS\<Windows SID>_Classes\Applications\rstudio.exe\shell\open\command /f /ve /d "\"C:\Users\Public\RStudio\bin\rstudio.exe\" \"%1\""
Please replace the in the code snippet above with your personal windows user ID. You can get your SID with
whoami /user
A SID looks like this:
S-1-8-21-667978445-1323479522-1885766523-895239
BTW: You could also use good old regedit to change the path (no local admin rights required!)

Get file paste directory on Windows and Mac

I'm trying to spy on the target directory when a user pastes a file. Let's say I copy/cut a file from somewhere on my computer. Then I paste it into another place. I want to be able to know the paste target directory programmatically.
Some questions on Stackoverflow mentioned using a global hook on Windows to be notified when a paste operation happens. But it doesn't give you the paste directory.
On Mac, file drag and drop has a promised delay feature. I'm not sure about normal file copy and paste.
Kind of get stuck now. Any suggestion would be appreciated.

Opening a file with not installed program

I have a .blend file which I want to open using blender but the problem is this :
I downloaded blender from its website in a compressed file (zip file) so I can open it directly without installing
Blender program works fine and I can open my file from the program itself using open in file menu but I want to open .blend files from outside by double clicking which gives me open with window to choose a program and I choose blender from browse but it always choose another program
How can I fix this problem ?
Unzip the program so that it enters itself into the registry. Once you done that, you can right click on your .blend file. Go to Open With, and Choose Default program. From there, navigate your drive to the .exe for Blender.
From then on, it will be registered as the default for that filetype.

How do I configure TortoiseHg to open a file in the right program based on its extension?

I'm using TortoiseHg v2.2.1 with Mercurial 1.9 in WindowsXP. How do I configure TortoiseHg to view a file based on the application Windows has associated with its extension?
For example, if I have a .docx file in the repository and I'm looking at its revision history, I'd like View at revision... to open the selected revision in MS Word. Likewise for other binary file types like ppt and xls, which I can't view using the default text editor or kdiff3.
Can I leverage that Windows already knows what program to use to open certain types of files or will I have to manually configure each file type of interest within the Tortoise config files?
I've found several SVN scripts in the TortoiseHg\diff-scripts folder that look like they solve a similar problem for diffing binaries rather than simply viewing them, but those don't seem to be activated and I'm not sure what if anything I need to mod in the MergePatterns.rc or Mercurial.ini files to make this all work.
To make "View at Revision" use whatever program is associated with the file's extension, try this trick: In the "Global Settings" in the "TortoiseHg" section, enter start "" as "Visual Editor". Note the empty "". This is necessary so that start will not use the file name, which gets passed in quotes by TortoiseHg, as the window title.

Resources