|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
NT/W2K/XP script loop variable won't reset
I'm writing a simple script to scan systems on my NT/W2K/XP network for the existence of a particular file and report relative to the file's date.
I want various checks to happen on each loop including one check on the "system" variable %ERRORLEVEL%. What I am finding is that this variable doesn't get reset on each pass code sample: FOR /F %%a IN (%1) DO ( IF NOT EXIST "\\%%a\admin$\system32\." ECHO %%a not online dir "\\%%a\c$\program files\jsconsole\ntcon.bat" | FINDSTR "search string" > nul IF ERRORLEVEL 0 ( echo %%a has right file ) ELSE ( echo %%a has wrong file or no file at all ) ) In this case ERRORLEVEL comes into the FOR loop as one value and won't change inside the loop. Is there a way to refresh the value inside the loop, a sort of local variable? Any comments... Brad |
|
#2
|
|||
|
|||
|
free hip hop downloads and battle forums
sedukshun records check out this site for the best new hip hop downloads around btrail and skinna from the sedukshun crew are working on there new album due for release early 2005 check em out sedukshun records
|
|
#3
|
|||
|
|||
|
I don't see it looping because you only have %1 in the ().
Maybe your problem is that "if errorlevel 0" means ZERO OR MORE so it's always true. Maybe you need something like this: if errorlevel 1 do this && goto ENDchk if errorlevel 0 do that && goto ENDchk :ENDchk DC4 |
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > NT/W2K/XP script loop variable won't reset |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|