【发布时间】:2014-11-05 19:28:10
【问题描述】:
我有一个批处理文件试图替换
中的文件C:\Users\All Users\Symantec\Symantec Endpoint Protection\12.*\Data\Config
但是 * 因计算机而异,所以我不能有输入列表
此批处理文件在另一个批处理文件中执行,该批处理文件从命令行调用。
这里是带有 * 路径的批处理文件,C:\script.bat
@echo off
if exist "C:\Users\All Users\Symantec\Symantec Endpoint Protection\12.*\Data\Config\SyLink.xm_" del /Q "C:\Users\All Users\Symantec\Symantec Endpoint Protection\12.*\Data\Config\SyLink.xm_"
ren "C:\Users\All Users\Symantec\Symantec Endpoint Protection\12.*\Data\Config\SyLink.xml" sylink.xm_bak
del /Q "C:\Users\All Users\Symantec\Symantec Endpoint Protection\12.*\Data\Config\SyLink.xml"
echo.
echo Copying new SyLink.xml
echo.
copy C:\SyLink.xml "C:\Users\All Users\Symantec\Symantec Endpoint Protection\12.*\Data\Config"
echo.
echo Deleting temp files
del /Q "c:\SyLink.xml"
这是另一个批处理文件,C:\copy.bat 调用第一个批处理文件,即 C:\script.bat
xcopy C:\sylink.xml \\10.10.10.10\c$
xcopy C:\sylink.xml \\10.10.10.11\c$
D:\pstools\psexec.exe @C:\clients.txt -c C:\Script.bat
C:\clients.txt
10.10.10.10
10.10.10.11
批处理文件通过命令行执行
C:\> C:\copy.bat
问题是,如何使这个批处理文件工作,以便将 * 识别为通配符?
谢谢
【问题讨论】:
-
请提问。
标签: windows batch-file cmd wildcard