Set Atom as the Default Text Editor


#1

I’m trying to work out how to make Atom the default text editor on Windows 8.1. It doesn’t automatically show up as a program in the list, so i’m having difficulty finding a program file i can link that doesn’t expire every time Atom is updated. Help would be greatly appreciated!


Using Atom as the default text editor on Windows 8.1
Was: this has to be corrected for the next version 1.0.1 atom
#2

In the atom folder under %appdata%, next to the numbered folders for each version, there is also a bin folder which contains atom.cmd. This script gets updated to execute the most recent version of Atom, when you update Atom. So you can use it as the default editor.


#3

with the windows installer (downloaded today) there is no bin directory under %localappdata%/atom


#4

The location to atom.cmd is actually located in a folder relative to %appdata% called local.
So it would be located under C:\Users\username\AppData\Local\atom\bin\atom.cmd

I don’t see how this can be used as a default editor, though?


#5

I do “Open With” so that I can select from a list of apps, and then under the available apps there is atom.cmd. It doesn’t have a nice logo, but otherwise it works well. But it could be that I added atom.cmd once by clicking Browse and then navigating to the spot.


#6

This isn’t working for me in Window 7 using Atom 0.201.0. atom.cmd opens up a new instance of Atom each time and only opens with a blank untitled file - it doesn’t actually open the file I want to edit.

Any ideas? I want to move to Atom from Sublime Text but this issue makes it more of a hassle than it’s worth.


#7

atom.cmd makes an ugly command prompt appear every time it is opened; I would have liked a better solution.

Is there a way to assign Atom to all extension-less (or unknown extension) files? I’ve read that somewhere (using regedit) but I don’t know anymore.

Or, better, a way to make Windows MIME type-aware?


#8

That’s just not gonna happen :smiley:
Anyway, open regedit, go to HKEY_CLASSES_ROOT, add a key called something like allfiles, create a subkey called shell and a sub-subkey called open, and a sub-sub-subkey called command, whose value should be set to your atom’s executable path followed by "%1". You should now have something like
HKEY_CLASSES_ROOT -> allfiles --> shell ---> open ----> command [value: C:\Users\Francesco\AppData\Local\atom\app-0.207.0\atom.exe "%1"]
Then go to the key HKEY_CLASSES_ROOT/* and set its value to the name of the key you previously created. Reboot.

I haven’t tried personally, just doing it out of memory. Be careful not touching anything else…


#9

Should point out that with this you will need to update the version path after every update.


#10

Mmmh… Pointing to update.exe? Maybe there’s a way to pass arguments…


#11

yep @vladimirkrstic explained it in this post:
Double Icon when pinned

should be able to use:

local\atom\update.exe --processStart atom.exe


#12

Yeah but does it pass arguments to atom? If I call update.exe --processStart atom.exe myfile.c does it open the file? Cannot test it as of now, I’m away from my pc…


#13

To me it seems like the better option (aside from not using a version in the path) is to symbolic link the executable into the bin folder.

From the ~/AppData/Local/atom/bin directory ->

mklink atom.exe ..\app-1.0.0\atom.exe

Or if you are running the command via bash shell (msysgit) ->

cmd //c mklink atom.exe ..\\app-1.0.0\\atom.exe

This is working for me on Windows 8 and doesn’t seem any more difficult than creating the batch files.


#14

After playing around with this I found that my previous solution did not work after registering the link as the default app. I did however find an alternate solution that is working for me. Instead of creating a symbolic link to the atom.exe file, I created a symbolic link to the app-1.0.0 directory and referenced atom.exe within that directory. I think this should preserve the Windows default editor across versions so long as the installer updates the symbolic linked directory.

From the bin folder I used ->

mklink /D current ..\app-1.0.0

(or in bash) ->

cmd //c mklink //D current ..\\app-1.0.0

Then in Windows file explorer I set the default application as the one located at ~/AppData/Local/atom/bin/current/atom.exe and it is working well.


#15

The problem with this solution is that you have to change the link every time the app updates, as noted in the previous posts…


#16

@frabert - I don’t think this applies to the previous posts because with my proposal the end user would not have to update anything across releases so long as the atom installer adds the “current” symbolic directory link. From an installer perspective, this doesn’t seem to add any additional steps then the installer is already performing.

Currently, the atom.cmd file specifically points at the exact version ->

@echo off
"%~dp0\..\app-1.0.0\resources\cli\atom.cmd" %*

Every new release requires the Atom installer app to update this batch file to point to the current release directory. In my proposed method, the installer app would just need to adjust the linked “current” directory instead of updating batch files as it’s doing now.

Please let me know if I’m overlooking something.


#17

Sorry, I’m afraid I didn’t really get what you mean :frowning:
Are you proposing to change the installer behaviour? If not, I can’t see how creating a link pointing to the (now)current version could solve the problem…


#18

Yep, I’m proposing changing the behavior of the installer (should probably be in a GitHub issue / fork instead of here, but this is what comes up in Google).


#20

Oh, I see. The proposed solutions were all intended to be workarounds, so changing the installer would definitely solve the situation :slight_smile:


#21

I am using Atom 1.0.0 and i was trying to set atom as default text editor for css and js files. I couldn’t do it. Then i found a solution here using atom.cmd which was working but every time opening a cmd while opening a file. And the logo wasn’t good either. I have found the perfect solution for version 1.0.0.

Go to the “C:\Users\user\AppData\Local\atom” directory. Here for version 1.0.0 you will find a directory named “app-1.0.0” and inside it atom.exe file. Use this while trying to set atom as default text editor for some filetype.