12

Is there a command that exists that will open any application from PowerShell?

When typing in "notepad", this will open Microsoft Notepad. However, other applications do not seem to open this way.

JDavila
  • 409
  • 1
  • 7
  • 22

5 Answers5

19

Notepad runs in this way not because of any Powershell magic, but because notepad.exe exists in one of the directories specified in your $env:PATH environment variable. The system behaves the same as when using cmd.exe (Command Prompt) in this regard.

You can start any application by specifying the full path to its executable: C:\Program Files\FileZilla FTP Client\filezilla.exe. You can optionally use Start-Process with the EXE if you want to capture a reference to the executable to gain more control over it from Powershell.

Tom
  • 16,842
  • 17
  • 45
  • 54
alroc
  • 27,574
  • 6
  • 51
  • 97
  • Thanks @alroc, this works great, though is there something I could use to pipe the results? This might require another question to be posted. – JDavila Nov 11 '16 at 18:41
  • 1
    @JDavila that depends on what those "results" are, what the app is, and how the output is generated. You should open a new question. – alroc Nov 11 '16 at 19:50
  • Well, am trying to display results from a log, specifically, certain columns CSV format. – JDavila Nov 11 '16 at 22:11
  • You're not making it any clearer. Post a new question for this. – alroc Nov 12 '16 at 12:19
15
Start-Process -FilePath "path.exe"
Derlin
  • 9,572
  • 2
  • 32
  • 53
contrashadow
  • 191
  • 1
  • 5
8

I know this is an old thread, but if you are trying to open a file you can do it like this

& .\filename.ext

It will use the standard program to open the file

6

Start-Process is the commandlet you are looking for.

Derlin
  • 9,572
  • 2
  • 32
  • 53
4c74356b41
  • 69,186
  • 6
  • 100
  • 141
3

The simplest method that I know of is using the AppId of the application:

  1. Open powershell as Administrator

    enter image description here

  2. See all the App-IDs via this command

    Get-StartApps
    
  3. Note the AppID of app you want to open

    enter image description here

    in our case we have to open VoiceRecoder

  4. Finally, open Voice Recorder via AppId

    explorer shell:appsFolder\Microsoft.WindowsSoundRecorder_8wekyb3d8bbwe!App
    

AppIds are mostly the same between systems

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343