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

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!)

Related

Open folder as project in PhpStorm

When I install PhpStorm from JetBrains Toolbox app I do not have an option to open folders as project when right clicking
Sadly JetBrains Toolbox App does not provide such functionality. Only standalone installer has an option to make them right now. You will have to either use that... or create such entries manually.
https://youtrack.jetbrains.com/issue/TBX-2478 -- watch this ticket (star/vote/comment) to get notified with any progress.
To add an entry to the Windows Explorer's right-click menu:
you can use FileTypesMan by NirSoft or a similar tool.
or create such entry manually, e.g. see this comment for a basic .bat file: https://youtrack.jetbrains.com/issue/IDEA-114307#comment=27-2125363 (at very least it lists Registry keys where to create such an entry).
I found this from Jet Brains :
Click Open on the Welcome screen or select File | Open from the main menu.
In the Select Path dialog, select the directory that contains the project to open.
Drag the desired project from your file chooser right to the Open Project dialog without locating it there. The respective file in the dialog will be found automatically.
Specify whether you want to open the project in a new window, close the current project and reuse the existing window, or open the new project in the same window with the current one. Refer to the Opening multiple projects section for details.
and for the command line you could use this :
<PhpStorm> <path_to_the_project folder>
See Open files from the command line for more information.

Installshield problem setting file permissions

in InstallShield 2011, I cannot modify file permissions under Application Data -> Files and Folders. Whenever I right click on items, it shows grayed out menu buttons. I can't even delete existing entries.
In a bat script later in the installer, I can't copy over certain files because I don't have the right permissions so the installer fails when trying to reference files in BackupFiles. For some reason all the other files get copied over just fine; I can't modify those file's permissions either. I read online that you have to click the "Properties" button in that context menu to change permissions.
My version is InstallShield 2011 Premiere Edition Version 17.
I don't understand why this is grayed out. The source files do not have any restrictions on them so it must be the installer doing something related to permissions.
That boxy orange overlay on the folders and files indicates that these are coming from a Dynamic File Link. Because these files aren't actually added to your project, not all configuration options are available. You might have to edit the permissions on the source files (before build), or change your project to statically include all or some of these files. Given the size of that tree, changing it all to static could be a bit tedious. Changing parts of it (by editing the link exclusions) might be a good middle ground.
Or you could better determine what's going wrong and see if you can address it in the batch file. Assuming this is InstallScript (rather than InstallScript MSI), the entire setup along with any processes it launches should be elevated. So I'm having a hard time guessing what could go wrong. Perhaps a read-only flag? Perhaps use a tool like process monitor to get more information on that, and see if you can add a call to attrib -r, or cacls, or whatever.

Restore deleted files in visual studio code in the code management menu

I am really devastated because I have accidentally deleted 3 of my files in Visual Studio Code. I did it through the Source Code Management menu on the left side. Now my question... Is there any possibility to restore the 3 files I deleted like this? I would appreciate any answer and maybe you want to know: I use Windows
:-(
I tried to look into the recycle bin of windows but it isn't there. :-(
vscode maintains a file-history using its latest TIMELINE view.
How to restore deleted git-untracked files in vscode:
Create the files with the same name at the same directory.
Go to TIMELINE on the File Explorer.
You can get the older versions of the files.
No, you cannot recover those files using VS Code or standard tools. They aren't put in the recycling bin (or your operating system's equivalent), they are removed using git cleanor git reset --hard. Condolences :-(
There are of course utilities for recovering deleted files that may or may not be successful, but that is outside the scope of this question.
I accidentally removed a file that wasn't even checked in to git. Google brought me here. The file wasn't in the Trash can either (Ubuntu 18.4 VS Code 1.31.1). Looking at the git output I can see that it used git clean -f to remove it by force).
Fortunately the file was still in the editor. Just press Ctrl+P and type the file name. It should show up in the list of files and if you open it, it says "FILE_NAME (deleted from disk)" on the tab. Just copy/paste the content to where it should be.
if you accidently click the delete menu option right below rename, as long as you don't panic and like restart your computer or something you can open that directory in the file explorer on your computer
and right click.
there should be options there to undo delete or whatever else you did to the directory.
Open VSCode's command menu, and type "Local History" and select "Local History: Find Entry to Restore." Then type the name of the file you deleted.
This has worked for me when "undo" in the file tree has not.
Super easy, and has saved me from despair.

How to refresh Sublime Text 3 workspace color schemes?

When you save a project, Sublime Text will create a .sublime-workspace file. In this file, there is an array of buffers, and for each buffer there is a color_scheme property. This is set to whatever color scheme was chosen when the buffers and workspace were created.
I recently changed my theme and color scheme in my user settings file. How can I refresh all of my project's workspaces so that way it uses my new color_scheme provided in my user preference file without needed to edit each project's workspace file one-by-one?
Expanding on the answer given by Tot you can do this for all views in all windows that are open by using a nested list comprehension (remember this is Python so we can be pretty flexible):
[ v.settings().erase("color_scheme") for views in [ w.views() for w in sublime.windows() ] for v in views ]
This way you don't have to run the command in each tab individually.
The only way I found to reset tabs to user's chosen color scheme is to enter this in the console :
view.settings().erase("color_scheme")
This will reset the color scheme of the selected tab - unfortunately you'll have to do it for each tab. But it's still quicker than closing and reopening the tab.
I only have this issue with Sublime Text 3 on Mac OS X.
Source : https://www.sublimetext.com/forum/viewtopic.php?f=3&t=19310
P.S. : If you've just updated your color scheme file, you'll sometimes have to execute this command twice. Just type the up arrow in the console to write the last command again.
Windows 10 AppData-related Solution
Please make sure that you are in a similar situation as me before trying this solution (see below). Steps:
Note the language and package that the Error loading colour scheme reports (my case was: markdown and MarkdownEditing).
Go to your AppData directory (type %AppData% in file explorer address bar).
Open directory Sublime Text 3, or whatever your version is.
Open the .sublime-settings file that matches the language from step 1.
Remove any lines that refer to the package you noted from step 1.
Remember that this file should be a properly formatted JSON file when you remove lines manually. Save this file and restart Sublime Text.
Background
I've decided to post here in case some of the python script solutions didn't work for you and your situation is similar to mine. I'm using GitHub to sync my Sublime Text AppData (Windows 10), in order to keep my workflow settings the same on multiple machines. Recently, I noticed that when I uninstalled a certain package on one of my machines, I accidentally merged some configuration files for that non-existent package on my other machine. This resulted in a persistent Error loading colour scheme, in particular for me when changing syntax to markdown (the package was MarkdownEditing for reference).

Force Firefox not to change file extension?

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.

Resources