Opening Atom via window command prompt in current folder


#1

I’m having trouble opening a file with atom in windows. Usually with editors you would just input the filename, and the application would open in the correct directory. This is not the case with atom.

I was hoping from the command line I could call:

atom inputfile.txt

but instead, opening a file requires me to type

atom c:/users/grant/documents/github/repo/inputfile.txt

obviously I don’t want to type an entire file path to open a file. Is there a way to do this in windows?


#2

@batjko Can you verify this?


#3

I’m afraid not.
Seems to be working fine for me:

  1. Created a file outside of atom
  2. Opened with atom [filename]
  3. Atom opens file in current folder

Win8, atom v116.

@Syntaf What’s your atom version? And what happens when you try to open the file without the path?


#4

I’m currently running version 0.115.0 , I’m using cup update to get the latest atom updates if that is correct.

From the command line if I type

C:\Users\Grant\Documents>atom runall.bat

This is how atom is opened:


it seem’s to just create a new runall.bat file in some location that is not the currently directory


#5

I knew it, there’s something fishy about the chocolatey package!
I bet my right arm this is because choco does weird things with any apps it installs.

A lot of Windows-related issue reports seem to be with choc installations, which I cannot replicate and the only difference seems to be that I tend to build atom every new version instead of using chocolatey.

Edit: Rephrased.


#6

Would you recommend I build atom without the chocolatey package until this issue is fixed?


#7

I wouldn’t go that far. Choco is still the recommended method for Windows and it works fine for all intents and purposes, barring one or two weird things happening. I think we need to confirm that suspicion first before one could recommend to change the official approach.

However, if you do decide to try building it, I’d like to know whether you see a difference.


#8

I agree with @batjko, I’d rather see the Chocolatey version fixed rather than the Windows support backslide because everyone abandons it and builds themselves.


#9

I filed a bug that covers this atom/atom#2879. The issue is mostly fixed, see the bug for more detail. But basically run cup then cup atom -f to forcibly reinstall atom and regenerate the shim that passes the argument to atom from the command line.


AutoHotkey SyntaxHighlight for ATOM
#10

“atom .” seems to work fine for me. Just FYI, I’m running Windows 7 and git bash.


#11

“atom .” is not working since last night. i dont know whats happen. windows 10


#12

I am getting the same issue shown here after several updates for themes were installed Atom Material UI & Syntax


#13

This is likely a different issue, because original was about chocolatey which is not used anymore.

Anywais what you get is the newly built into window linux console.

Replace atom . by atom.cmd .

Basically you can see the problem by going into
C:\Users\[yourname]\AppData\Local\atom\bin

That folder has both atom file for unix and osX, and atom.cmd file for windows. By typing only atom the default binding pointed to the rigth file on each platform.

Now that windows support emulating a linux shell, it get confused.


Alternative solution, go into that folder and delete the atom file, so only cmd remains


#14

Jean, thanks in advance for quickly answer. There’s a way to fix it?


#15

Just given you two. Use the extension atom.cmd or delete the file that is called simply atom, at this path C:\Users\[yourname]\AppData\Local\atom\bin

Basically the file I suggest you to delete has the following content

#!/bin/sh
"$(dirname "$0")/../app-1.8.0-beta4/resources/cli/atom.sh" "$@"
echo

So it serve the purpose of having a single path in bin that alwais point to the lastest version (in my case app-1.8.0-beta4). Cmd file serve the same purpose.

More long term I guess need to modify how squirel deploy things.


#16

Thank you.


#17

Thanks @jeancroy that helped me too.
I’ve created
alias atom='atom.cmd'
in my .bashrc and that’s working for me.