如何在调用语句中将逗号(,)作为参数传递

时间:2018-03-22 19:21:00

标签: batch-file

我希望能够将逗号(call)传递给:example @echo off call :test , echo %output% pause :test set "output=%1" goto :eof 语句并将其用作变量,但以下似乎不起作用:

export LD_LIBRARY_PATH=/path_to_lib_folder/lib:$LD_LIBRARY_PATH

2 个答案:

答案 0 :(得分:3)

 UIView.animate(withDuration: 3.0, animations: {
    // UIView.setAnimationRepeatCount(3.0)

        self.leadng.constant = self.view.frame.size.width + self.vwObj.frame.size.width
        self.view.layoutIfNeeded()

    }, completion: { finished in
        UIView.animate(withDuration: 3.0, animations: {
            self.leadng.constant = -(self.vwObj.frame.size.width)
        })
    })

@echo off call :test "," echo %output% pause goto :eof :test set "output=%~1" goto :eof 是一个分隔符,因此如果您想将其作为文字传递,则需要,

要从参数中删除封闭引号,请使用"enclose it in quotes"

请注意额外的~。在goto :eof发布后,这会跳过:test代码。

答案 1 :(得分:1)

@echo off
REM Pass the , with Quotes around it.
call :test ","
echo %output%
pause


:test
REM Using ~ to remove the quotes
set "output=%~1"
goto :eof

<强>输出

,
Press any key to continue . . .