0

My computer: Windows 10 running WSL Ubuntu 18.04.

I want to open a windows app file (e.g. an Excel file) from within a WSL bash prompt.

I have made sure that excel.exe is in the $PATH.

But when I type:

excel.exe /mnt/c/Users/bob/Documents/temp/testfile.xlsx

A blank workbook opens, instead of the file I want.

How do I get excel to open the particular file?

I have read this but this returns the error:

Invalid switch - "/mnt".

I also want to make sure that the BASH window opens this file in the background, (not pausing until the Excel application is closed) so that I can continue to use the BASH prompt.

Tim
  • 165
  • 2
  • 9
  • Try to use Windows style paths in `cmd /c` command. – Biswapriyo Mar 29 '19 at 04:00
  • How did you add excel to the WSL path? I can find `EXCEL.EXE` in Office's Program Files, and `./EXCEL.EXE` works when in that dir, but no matter what I add to my path I can't seem to get just `EXCEL.EXE` to work – snazzybouche Dec 23 '19 at 05:10
  • Ah, solved that one myself. Created a symbolic link to the exe and dropped it – snazzybouche Dec 23 '19 at 06:12

2 Answers2

3

Copied verbatim from https://superuser.com/a/1600972/362088 :

A recent answer for WSL 2: Just do wslview /mnt/c/Users/bob/Documents/temp/testfile.xlsx.

This is a part of the wslu collection and was pre-installed in my Ubuntu.

Hawkeye Parker
  • 233
  • 1
  • 10
1

OK, after some help from @Biswapriyo and elsewhere, the answer seems to be:

start excel.exe "C:\path/to/file/in/directory.xlsx"

seems random to me, but there you go!

Tim
  • 165
  • 2
  • 9