Batch file parameter with spaces, double quotes, pipes

后端 未结 2 1912
走了就别回头了
走了就别回头了 2021-01-03 00:36

I have a batch file that needs to be passed a parameter that will include pipes and spaces. Because of the spaces, double quotes need to be attached to the parameter when pa

2条回答
  •  情书的邮戳
    2021-01-03 01:28

    @echo off
    if "%~2"=="" (
        call %0 "Account|Access Level|Description" dummy
    ) ELSE (
        setlocal ENABLEEXTENSIONS
        for /F "tokens=*" %%A IN ("%~1") DO @echo.%%A
    )
    

    Not exactly pretty, but it works. Dealing with special characters is always a pain in batch files...

提交回复
热议问题