要求用户以cmd输入值,而不是从其他文件中获取

时间:2019-03-25 11:00:28

标签: windows batch-file cmd command-prompt

我有batch个文件,该文件接受param,到目前为止,我正在从另一个文本文件ClientName.txt中获取param。

现在,我需要像输入客户端名称这样从cmd本身获取参数。查看我的文件

@echo off
setlocal enabledelayedexpansion
FOR /F "tokens=*" %%A in (1.ClientName.txt) DO ( 
XCOPY "..\AppIcons\%%A\drawable\*" "..\Global\Resources\" /E /F /R /Y /H   >> "..\AppIcons\%%A\copy.log"
XCOPY "..\AppIcons\%%A\SplashSc\*" "..\Global\Resources\" /E /F /R /Y /H   >> "..\AppIcons\%%A\copy.log"
)

我该怎么做?谢谢。

1 个答案:

答案 0 :(得分:1)

借助以上评论,我得到了答案

@echo off
    set /p $client=Enter project name:

        XCOPY "..\AppIcons\%$client%\drawable-hdpi\*" "..\RisingSun\Resources\drawable-hdpi\" /E /F /R /Y /H            >> "..\AppIcons\%$client%\copy.log"
        XCOPY "..\AppIcons\%$client%\drawable-mdpi\*" "..\RisingSun\Resources\drawable-mdpi\" /E /F /R /Y /H            >> "..\AppIcons\%$client%\copy.log"
        XCOPY "..\AppIcons\%$client%\drawable-xhdpi\*" "..\RisingSun\Resources\drawable-xhdpi\" /E /F /R /Y /H          >> "..\AppIcons\%$client%\copy.log"
        XCOPY "..\AppIcons\%$client%\GoogleJsonFile\*" "..\RisingSun\" /E /F /R /Y /H       >> "..\AppIcons\%$client%\copy.log"
        XCOPY "..\AppIcons\%$client%\LoginPageImage\*" "..\RisingSun\Resources\drawable\" /E /F /R /Y /H        >> "..\AppIcons\%$client%\copy.log"
        XCOPY "..\AppIcons\%$client%\MenifestFile\*" "..\RisingSun\Properties\" /E /F /R /Y /H          >> "..\AppIcons\%$client%\copy.log"
        XCOPY "..\AppIcons\%$client%\SplashScreenImage\*" "..\RisingSun\Resources\drawable\" /E /F /R /Y /H      >> "..\AppIcons\%$client%\copy.log"