Using CLI, how to open a file with its default application?

Sakhil 1 Reputation point
2021-01-15T09:03:06.653+00:00

If you would like to open test.txt from the CLI with start test, it should open the file in notepad as its default program.

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-01-15T12:22:06.273+00:00

    Hi,

    Invoke-Item can perform the default action for you

    Invoke-Item test.txt  
    

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/invoke-item?view=powershell-7.1

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.