I want to associate a extension to a program by a batch file.

This command works fine when I write it interactively.

ftype wavfile="%ProgramFiles(x86)%\VideoLAN\VLC\vlc.exe" "%1"

But when I write it in a batch file and run, then %1 are recognized as a variable, so it ends up with:

ftype wavfile="%ProgramFiles(x86)%\VideoLAN\VLC\vlc.exe" ""

I think someone already ask a same question, but I couldn't find it. How can I use %1 or some other argument variables in a batch file?


You should use two percentage symbols like this: %%1, which will work for a batch file.

It will escape the %% into a percent sign.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.