schizoid04
schizoid04

Reputation: 914

Shell Open Command sends file path with white space removed

I'm trying to register an application I've built as a default program for a file that it works with.

I've updated the registry keys as necessary, and have even been able to get it to work once...

However now I'm noticing it's sending a few different command arguments, where at first (when it prompted me for which item to open with), it just sent one.

Currently, it sends the following arguments:

-Path for the EXE being launched

-File being opened

-\Control[File name without path]

My app is looking at that second argument, and trying to open it. The problem is it doesn't contain any spaces that existed in my file path.

For example, it's sending a file location of C:\Program Files (x86)\ as C:\ProgramFiles(x86).

So when I then check if the file exists, or try to read from that path, it doesn't exist, as it doesn't contain the necessary specifics.

Upvotes: 1

Views: 627

Answers (1)

schizoid04
schizoid04

Reputation: 914

I found out the reason was that my registry key was calling "Program To Execute.exe" %1 , when it needed to have quotes around the %1 bit.

After putting in the quotes around the commandline argument, it began working correctly.

Upvotes: 1

Related Questions