'Locate a file and then opening the file using the command line in GitBash

I am new to GitBash. I am using GitBash in Windows 10. I started at the home directory and following are the commands/steps I have followed:

  1. ls.
  2. cd Documents.
  3. ls and found the docx file that I wanted to open.
  4. ran open and the name of the document with .docx and it came out bash

open: command not found.

I am trying to open that file so I can get to the file path. Thanks!



Solution 1:[1]

You have to perform below steps to add winword.exe path in the PATH variable and then will be able to open .docx files from gitbash.

  1. Set winword.exe file location path to PATH variable using:
PATH=$PATH:'/C/Program Files/Microsoft Office/root/Office16'

I'm using Microsoft Office 2016, so your path might differ based on the version of Microsoft office you are using.

  1. Run command to open the docx file
winword '/C/Users/Admin/Desktop/Test.docx'

Solution 2:[2]

use

start <filename>

Run command to open the docx file

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stud3nt
Solution 2 Anuj Garg