How do I invoke Atom from the command line and open a file in the current directory

I have seen many references to this issue dating all the way back to 2014, but no solutions that work for me across platforms (Linux and Windows)

How do I invoke Atom from the command line and pass it the name of a local file to edit?

When I do this in Windows, even if the file already exists in the current directory, Atom insists on creating a new file in the installation directory.

I have tried prefixing the filename with “.” but that does not work.

FWIW, passing the entire pathspec works but is very annoying for long paths.

What am I missing?

/mbs

Hi mbs!

I don’t have a linux VM handy, but I was able to get this to work correctly on windows just now. Can you give us some more information to help troubleshoot this issue? Are you on windows 10? Are you using CMD.exe, Powershell.exe, or the new windows terminal?

My first thought is you may be doing something like atom ./README.md in CMD, which only supports backslashes in path names.

My second thought is there may be a package you have installed that’s preventing the default behavior from working. I actually had to use atom --safe .\README.md to get it to work as I expected.

1 Like

Thank you for getting back to me calebmeyer.

Based on your reply I tried with a vanilla cmd.exe and atom works as expected … opening any file I pass on the command line, whether preceded with forward or backward ‘dot-slash’.

My default console is “ConEmu” and that would appear to be where the problem lies. I will need to investigate this further. There must be something I have configured in ConEmu that is causing the issue.

I will post my results and any resolution on the issue when I get a chance.

Thanks for replying …

1 Like