对于循环不使用多个输入

时间:2017-11-30 17:54:24

标签: batch-file for-loop

当用户在set /p store...输入多个商店号时,我无法使用此功能

如果用户放入2个或更多商店(以空格或逗号或两者分隔),则会按照预期在mkdir e:\Support\Vendor\PAUL\RHS\%store%中创建第一个文件夹;其余的是在.bat运行的目录中创建的。

同样,从find /I开始的2行失败。

我尝试在Setlocal EnableDelayedExpansion之后使用color A但没有运气。

@echo off
TITLE Sysinfo from SCH

color A

set /p store="Enter just the store number in this format 12345  "
echo %store% >> E:\Support\Vendor\PAUL\RHS\Store_list.txt

mkdir e:\Support\Vendor\PAUL\RHS\%store%
set sys=E:\Support\Vendor\PAUL\RHS\%store%\%store%_%date:~4,2%-%date:~7,2%-%date:~10,4%.txt

for /F %%s in (E:\Support\Vendor\PAUL\RHS\Store_list.txt) do (
    "E:\Support\MTS\Utilities\PSEXEC\psexec.exe" \\US%%sSCH01 -n 90 -d -w "\\US%%sSCH01\c$\SystemInfo" "\\US%%sSCH01\c$\SystemInfo\SysInfo.cmd"

    find /I "System Model =" \\US%%sSCH01\c$\SystemInfo\SysInfo.txt >> %sys%
    find /I "Serial Number:" \\US%%sSCH01\c$\SystemInfo\SysInfo.txt >> %sys%

    echo %%s,>>E:\Support\Vendor\PAUL\RHS\DONE_%date:~-4,4%%date:~-10,2%%date:~-7,2%.txt

)

0 个答案:

没有答案