Reputation: 1751
My program allows the user to open a file directly with it.
To do so, I've created a registry key that open the program with the path of the file as first parameters.
so this is my registry key :
C:\Users\path_to\program.exe %1
Here, %1
is the specified path.
In simple path, like C:\Users\path\path\file.png
it's works; perfectly.
But when I chose to open a special path (with spaces, for example) I've got something like that : C:\Users\path\DOCUME~\BROKEN~\path_ok~\FILE~1
-> BROKEN~
is a path with spaces in it, normaly it's like broken path test
.
Any idea why ?
Thanks
Upvotes: 0
Views: 102
Reputation: 32
The path with tildas (~) is a valid path to your file. You can try openng the file with that path and you will see that it works.
Windows used to limit each path component to 8 characters and not allow spaces in path components. When these restrictions were first lifted, most program could not handle the new path names, so Windows would also assign an old-form path name to each file that had spaces or path components longer than 8 characters. The path with tildas that you see is such old-form path.
Of course most software now, can handle regular paths, but Windows still provides maintains the old-form paths (even Windows 10).
You can tell Windows that you support new paths if your register your program with
C:\Users\path_to\program.exe "%1"
instead of
C:\Users\path_to\program.exe %1
Upvotes: 1