Skip to content

Instantly share code, notes, and snippets.

@davidmyersdev
Last active November 12, 2022 20:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidmyersdev/1a1473ea36906c8f6830a17701e7fd21 to your computer and use it in GitHub Desktop.
Save davidmyersdev/1a1473ea36906c8f6830a17701e7fd21 to your computer and use it in GitHub Desktop.
Launch Atom from the Windows Subsystem for Linux (WSL)
#!/bin/bash
# only convert the path if one is provided
if [ ! -z $1 ]
then
linuxPath="$(realpath $1)"
windowsPath="$(wslpath -w $linuxPath)"
fi
# avoid the UNC path warning
cd /mnt/c/Windows
# launch atom on Windows
cmd.exe /c "atom $windowsPath"
@drosanda
Copy link

Hi, i've just your tutorial but I've got an error

/usr/local/bin/atom: line 14: cmd.exe: command not found

@davidmyersdev
Copy link
Author

Hey there, @drosanda. Does it work if you use the full /c/Windows/System32/cmd.exe path instead of just cmd.exe inside this script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment