Opening from cmd


#1

Is it possible to open an atom text editor file through cmd or PowerShell?


#2

Yes, the command is simply atom.


#3

Yep and with powershell you can open the current folder using
PS> atom (pwd)


#4

Yes, and with a cmd window you can open the current folder with atom . (grin)


#5

Sure can. :smile:

Run the following line in PowerShell and you can use atom without parameters to open the current working directory (saves to $profile so it will do this for every powershell session):

echo "function atom (`$path = (pwd)) { &atom.exe `$path }" | add-content -Encoding UTF8 $profile

Allows you to specify a path parameter as well.


#6

I’ve never learned powershell. Using objects in a shell always seemed like overkill.

I use this cmd file. It doesn’t provide a permanent solution like yours. I have to run this every time I open a cmd window for Atom but I don’t do that often. I leave the cmd windows open for days.

doskey a=atom .
doskey ad=atom --dev .
doskey as=atom --safe .

Now I just type a, ad, or as. Easy peasy.


#7

The latest atom installer (with auto-update) puts atom.exe in a versioned folder. Can we revive this thread?

Anyone written the PowerShell to walk the version folder to get the latest atom.exe path?


#8

@yzorg I have it in my powershell profile to get the highest atom version folder and alias the atom & apm commands

Theres a load in there for git too but its the middle block that deals with atom.


Atom on Windows creates a folder for each version and keeps them
#9

Doesn’t it also put atom.cmd into a non-versioned bin folder? That’s the last I saw.


#10

atom.cmd is in the versioned folders resources/cli directory so its not much help without something to work out what the highest atom version is.


#11

I have this file:

C:\Users\my_user_name\AppData\Local\atom\bin\atom.cmd

I’m running Atom 0.186.0. Has this file been removed since? Atom is checking for updates right now, I will now in a few minutes.


#12

That bin folder does not exist on my machine here, I started at 0.186.0 and am now running 0.187.0

I’d check what the contents of atom.cmd to see what its actually doing.


#13

The atom.cmd in the non-versioned folder just runs the atom.cmd in the versioned folder. The key here is that whenever Atom is updated, the atom.cmd in the non-versioned folder is updated to point to the new version.

I used the installer to install Atom. I guess the zip file might not have that extra bit of functionality.


#14

Mine was installed via the installer from the atom.io home page seems odd to me that I don’t have it and that yours would continue to update almost like they are being backwards compatible with the old way but there is no new way.


#15

My home PC has atom coming from 0.177.0 and it does have the bin folder. So it would appear that the bin folder isn’t in recent versions of atom…


#16

this issue could be related:


#17

Unfortunately, this doesn’t seem to be the answer 100% of the time. I had to uninstall Atom recently and I"m currently trying to re-install it, but I’m having the “no bin” issues again, even after trying the method I posted.