Windows 10 How to open a file with a specific program from cmd

tinynja98

New Member
Joined
Jun 25, 2017
Hello, I am trying to open a file [FILE] with a program [PROGRAM]. I have a shortcut of those two on my desktop. When i drag and drop [FILE] on top of [PROGRAM], it works as expected, meaning that [FILE] gets openend correctly by using [PROGRAM] to open it (Similarly to how you would drop a ".txt" file on top of Notepad to edit it.) Now, when I tried in the terminal to write this start "[PROGRAM]" "[FILE]", the program gets opened as if I simply double clicked on it, meaning that [FILE] does not get opened with [PROGRAM].

What does dragging and dropping [FILE] on top of [PROGRAM] do more than the command I ran which makes it work? And how can I achieve the same result via command line?

EDIT: Creating a shortcut (.lnk file) on desktop to ""[PROGRAM]" "[FILE]"" works as I want it to.
EDIT2: I found a solution to my initial problem by doing something similar to my first edit, but if you know why the start "[PROGRAM]" "[FILE]" command didn't work, I would be very interested to know.
 
Last edited:
Well thanks for your reply it made me look a little deeper into this. After some research, I found that I should have used start "" "[PROGRAM]" "[FILE]" as the first quote is used as the title of the new cmd window that will get opened. Also, I realized that I was using PowerShell (never used it before, so I supposed it was the same thing as cmd :culpability:) when I did my tests before I posted this thread, and I tried with cmd.exe and it worked flawlessly with the command start "" "[PROGRAM]" "[FILE]". Powershell gives me an error when I try the last command.
 
Start is a CLI command in command prompt and Start is an alias for Start-Process in powershell. They don't quite accept the same arguments
 
Back
Top Bottom