2

I'm running the latest Windows Subsystem for Linux Build 14986 (Ubuntu 16.04 - Xenial), and I want the ability to open up Window 10 applications directly from bash prompt by typing a command.

Also, it would be great if I could open up Linux files the same way (vice versa) w/ Visual Studio Code (Windows Application). Is this possible now w/ WSL Interoperability? This new feature was released in Build 14951, but I'm unsure of it's full capability.


Example

Typing code . inside the bash prompt would open up the www folder in my default editor (Visual Studio Code).

enter image description here

  • What exactly is the question here? The blog post says you can, but you tried and you couldn't? – muru Jan 7 '17 at 6:05
  • Hi @muru, I'm a 1 week old newb with bash coming from a Windows world, so please forgive my ignorance. I did attempt this (before I upgraded to Interop)..To make a long story short, this is my 6th or 7th install. I asked the question here to get pro advice. I'm not sure if a command already exists, or if I should create a custom script, or make an alias, or something better. I've watched the video that I linked, but haven't read completely through the blog yet (that's next). – Oneezy Jan 7 '17 at 8:47
  • That .. still doesn't make things clear - advice for what? Command/script/alias for what? – muru Jan 7 '17 at 8:48
  • I'm asking: how to create a command to open my default code editor? This 2-minute video explains exactly what I'm wanting to do..but this is for OSX: youtube.com/watch?v=UF7X6KJ6vBA – Oneezy Jan 7 '17 at 10:14
  • can you run notepad from WSL? – muru Jan 7 '17 at 10:21
0

I use Atom as my code editor. Typing atom somefile.py opens the Python file in Atom regardless of whether or not I type it in Windows or Linux on the subsystem.

It sounds like you want this same functionality, but instead of typing atom, you want to have your own custom command.

This can be done with aliases. For example, if I type alias code='atom $1' into the Linux bash, and then type code somefile.py, it opens in Atom.

These aliases will disappear once you close the bash window, so most people instead put them in a file called ~/.bashrc which is automatically run when you open a new Linux bash window, so your command will be ready to use all the time.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.