windows - 要求用户在 cmd 中输入值而不是从不同的文件中获取
问题描述
我有batch
接受参数的文件,到目前为止,我正在从另一个文本文件中获取参数ClientName.txt
。
现在我需要从 cmd 本身获取参数,例如Enter client name:。查看我的文件
@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"
)
我怎样才能做到这一点?谢谢你。
解决方案
在上述评论的帮助下,我得到了答案
@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"
推荐阅读
- python - 如何对模块外的文件使用 Sphinx 自动功能
- google-chrome - Firefox Ctrl-F 与选定的文本到主搜索栏
- javascript - 如何在使用材料 ui 表的反应中向表头列条目添加超链接?
- javascript - Express .use() 回调在使用 express.static() 时被多次调用
- mysql - 将 lstart 转换为 mysql 时间戳
- python - f-string 导致 CDSW/linux 上的换行错误
- windows - 在命令行输出中搜索关键字并显示上一行的批处理文件(x5)
- reactjs - 删除 localhost 名称以部署 Next.js 时出现问题
- shadow-dom - 有没有办法使用组合来改变带有阴影 dom 的 web 组件的 CSS?
- php - 从没有 FFMPEG 的 MP4 中提取帧