Passing a path containing whitespaces as argument to a batch file.

  • Thread starter Thread starter pavankkavuta
  • Start date Start date
P

pavankkavuta

Hi All,

I am facing a problem while passing argument to a batch file. The
argument will be a file path. In the file path, if there are not white
spaces, it is working fine. But if any white spaces are there, it is
not recognizing that, and treating that is the end of file path.
I have tried enclosing the entire file path in double quotes. Even this
does not work. Could any one please suggest how do I pass a file path,
having white spaces.

Thanks in advance

Pavan Kumar K
(e-mail address removed)
 
Hi All,

I am facing a problem while passing argument to a batch file. The
argument will be a file path. In the file path, if there are not white
spaces, it is working fine. But if any white spaces are there, it is
not recognizing that, and treating that is the end of file path.
I have tried enclosing the entire file path in double quotes. Even this
does not work. Could any one please suggest how do I pass a file path,
having white spaces.

Thanks in advance

Pavan Kumar K
(e-mail address removed)

You could enclose the parameter in double quotes, then strip
the double quotes in your batch file:

@echo off
for %%a in (%1) do set parm=%%~a
echo Parm=%parm%

If this is not what you require then you should post your
own batch file to demonstrate your problem.
 
Back
Top