Search code examples
batch-fileregistry

Context menu not passing argument properly


I followed this post to create a right-click menu for my files. I have created a batch file which gets called along with the files being clicked as its argument. In the registry I have created and entry like this:

enter image description here

However, when a file contains spaces in the file path, the argument gets truncated. The batch file is works fine when the arguments are passed from command prompt.

How to resolve this?


Solution

  • Try with double quote

    Yourbat.bat "%1"
    

    Or

    Yourbat.bat "%~1"