批处理文件中的数学破损(win10)

时间:2018-11-30 15:25:07

标签: batch-file math cmd

我一直在绞尽脑汁,但似乎很沮丧 香港专业教育学院读了大约5批关于批处理数学的文章,但仍然无法解决这个问题

    setlocal enabledelayedexpansion enableextensions
set /p NPrinters= "How many network printers do you need to setup.     " (will not do the epson side of this).
set /a z=0
for /L %%X in (1,1,%NPrinters%) DO (
    echo Printer%%X
    set /a "z=z+1"
    echo %z%
    set /a IP=210+%z%
    echo %IP%
    cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r "IP_192.168.192.%IP%" -h "192.168.192.%IP%" -o raw
)
set /p dum= "checkyoursheet"

我的输出是

C:\zzzzzzzz\new\Install>(
echo Printer5
 set /a "z=z+1"
 echo 0
 set /a IP=210+0
 echo !IP!
 cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnport.vbs -a -r "IP_192.168.192." -h "192.168.192." -o raw
)
Printer5
0
210
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

Created/updated port IP_192.168.192.

C:\zzzzzzz\new\Install>set /p dum= "checkyou.....

最终目的是让它添加网络端口(IP为192.168.192。(210 + printer number)),添加网络打印机(Printer1,2,3,4 ...等),然后最终在我的最后一次迭代中,它还将检查一个sql数据库并将其添加到那里

但是要开始进行任何这部分工作,必须先进行。有指针吗?预先感谢

0 个答案:

没有答案