我有以下情况
@echo off
for %%x in (
machine1
machine2
machine3
for %%y in (
A
B
C
D
)
)
do
(
echo machine is %%x
\\%%x\%%y
)
我实际上正在检查股票是否开启
\\ machine1 \ A,\\ machine1 \ B,等等..
你们可以帮助我进行巢穴循环吗?
答案 0 :(得分:0)
如果我理解你的问题,你想循环通过一堆计算机,并在每台计算机上循环通过一堆驱动器号来查看驱动器是否共享?如果是这样,你真的很亲密。您只需使用IF EXIST
来检查您正在构建的路径是否已共享。
@echo off
FOR %%x IN (machine1, machine2, machine3) DO (
echo Checking shares on machine: %%x
FOR %%y IN (A, B, C, D) DO (
echo Testing share: \\%%x\%%y
if exist \\%%x\%%y (echo Shared) else (echo Not Shared)
)
)
答案 1 :(得分:0)
试试这个:
@echo off
for %%x in ( "machine1", "machine2", "machine3" ) do (
echo machine is %%x
for %%y in ( "A", "B", "C", "D" ) do (
echo share is \\%%x\%%y
)
)