Diriector_Doc
Diriector_Doc

Reputation: 610

"Open With" using CMD

Let's say I have a program that I want to open. I can open it using batch by running this:

@echo off
start "" "C:\Program.exe"

Is there a way to tell batch that I want to open the file using a program such as notepad? Something along the lines of this:

start "" "C:\Program.exe" >notepad.exe

Upvotes: 2

Views: 11029

Answers (3)

Ali F
Ali F

Reputation: 11

you can use openwith command:

...>openwith "C:program.exe"

this command opens "Open with" window and you can choose witch program "program.exe" should be opened or run with.

you can read more here in Microsoft docs about this command.

Upvotes: 1

Hareen Laks
Hareen Laks

Reputation: 1515

I used following code.

@echo off
start  notepad C:\Program.exe

Make sure to set the path to notepad.exe.

You must need double quotes only if you have spaces in the path to your file.

@echo off
start  notepad "C:\My Program.exe"

Upvotes: 0

Its Me
Its Me

Reputation: 56

Not sure, but you can use

@echo off
notepad.exe "C:\Program.exe"

You can use every program that supports "Open With" (every good program supports it) The File-Path will be passed to the program, so it knows your file.

Upvotes: 4

Related Questions