以下代码如何在Batch Scripting(.bat)文件中运行?

时间:2022-11-29 02:33:00

How does following code works in Batch Scripting(.bat) file?

以下代码如何在Batch Scripting(.bat)文件中运行?

:modifyString what with in toReturn
    SET "__in=%~3"
    SET "__in=!__in:%~1=%~2!"
    IF NOT "%~4" == "" (
        SET %~4=%__in%
    ) ELSE (
        ECHO %__in%
    )

1 个解决方案

#1


1  

Assign the contents of the third parameter, stripped of quotes to the variable.

分配第三个参数的内容,删除引号到变量。

replace any occurrence of the first parameter in that string with the second parameter (both stripped of quotes)

用第二个参数替换该字符串中第一个参数的任何出现(都删除了引号)

If the fourth parameter is not missing, set the variablename which is the fourth parameter to the result of the previous operation. If it is not not missing then display the result of the previous operation.

如果第四个参数没有丢失,请将variablename(第四个参数)设置为上一个操作的结果。如果它没有丢失,则显示上一操作的结果。

(yes - I know about the double negative - but that's how it's coded)

(是的 - 我知道双重否定 - 但这是它的编码方式)

#1


1  

Assign the contents of the third parameter, stripped of quotes to the variable.

分配第三个参数的内容,删除引号到变量。

replace any occurrence of the first parameter in that string with the second parameter (both stripped of quotes)

用第二个参数替换该字符串中第一个参数的任何出现(都删除了引号)

If the fourth parameter is not missing, set the variablename which is the fourth parameter to the result of the previous operation. If it is not not missing then display the result of the previous operation.

如果第四个参数没有丢失,请将variablename(第四个参数)设置为上一个操作的结果。如果它没有丢失,则显示上一操作的结果。

(yes - I know about the double negative - but that's how it's coded)

(是的 - 我知道双重否定 - 但这是它的编码方式)