How do I escape Ampersand (&) from current working directory %~dp0 in batch file

前端 未结 1 416
面向向阳花
面向向阳花 2021-01-27 01:01

I usually get the current working directory by giving the batch command %~dp0 for combine multiple csv files. But I encountered ampersand (&) symbol while getting current w

相关标签:
1条回答
  • 2021-01-27 01:46

    Putting quotation marks around %~dp0 should be enough:

    ...
    pushd "%~dp0"
    ...
    

    Btw, I don't understand why you use pushd. You don't popd anywhere in your code so pushd seems useless. If I understand ECHO Set working directory correctly, you should replace pushd with CD %~dp0.

    0 讨论(0)
提交回复
热议问题