Remove quotation marks from invocation parameter

Viewed 33

I want to process files in a subroutine by passing a filename and adding path + extension

This is what I have coded

echo %0 %1 
setlocal EnableDelayedExpansion
set "input=P:\Convert\%1.ts"
echo.Process "!input!"

If the filename contains no blanks I dont need quotation marks. But if it includes blanks, then I must enclose the parameter in quotation marks to pass it to the subroutine. Here is what I get:

sample test
Process "P:\Convert\test.ts"    <-- this is OK

sample "test file"
Process "P:\Convert\"test file".ts"   <-- NOT OK

How do I get rid of these quotation marks ?

0 Answers
Related