Microsoft
Software
Hardware
Network
Question : MS DOS looping
I am needing to run the following in a MS DOS bacth file:
net use x:\\hippo\login_rpt\Data
set p1=%comspec% /C if not @ISDIR
set p2=del 0x22x:\@FILE0x22
set days=-30
FORFILES /P x:\ /D %days% /C "%p1%==TRUE %p2%"
net use x: /delete
net use x:\\lamb\login_rpt\Data
set p1=%comspec% /C if not @ISDIR
set p2=del 0x22x:\@FILE0x22
set days=-30
FORFILES /P x:\ /D %days% /C "%p1%==TRUE %p2%"
net use x: /delete
net use x:\\tuttle\login_rpt\Data
set p1=%comspec% /C if not @ISDIR
set p2=del 0x22x:\@FILE0x22
set days=-30
FORFILES /P x:\ /D %days% /C "%p1%==TRUE %p2%"
net use x: /delete
net use x:\\baltar\login_rpt\Data
set p1=%comspec% /C if not @ISDIR
set p2=del 0x22x:\@FILE0x22
set days=-30
FORFILES /P x:\ /D %days% /C "%p1%==TRUE %p2%"
net use x: /delete
How can this be simplified so I am not repeating the code between the net use commands?
Answer : MS DOS looping
Try this:
@echo off
setlocal
for %%a in (hippo lamb tuttle baltar) do call :process %%a
goto :eof
:: *** Subroutine process:
:process
set Machine=%1
net use x:\\%Machine%\login_rpt\Da
ta
set p1=%comspec% /C if not @ISDIR
set p2=del 0x22x:\@FILE0x22
set days=-30
FORFILES /P x:\ /D %days% /C "%p1%==TRUE %p2%"
net use x: /delete
goto :eof
Random Solutions
ASP.NET reading, creating Excel files
Click Context Menu, opened by mshtml.IHTMLElement
decrypt access database
I have 9 Cursore need to make one report
Using Range(Cells(r1,c1),Cells(r<wbr />2,c2)) instead of Range("A1:B2")
Quick Launch Toolbar Office 2k7 - Roaming Profiles
Exchage Error SPAM question.
CSocket object in thread
How to hide a startup form
Importing and appending Excel worksheets into Access Project temporary table