|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Local variable not resetting--Win shell
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 "10/10" > 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? Also, how can I break out of a FOR loop... as in BREAK or CONTINUE in Perl? Any comments... BTrail |
|
#2
|
|||
|
|||
|
In my original posting, the line I use could be more clear:
dir "\\%%a\c$\program files\jsconsole\ntcon.bat" | FINDSTR "10/10" > nul could better read: dir "\\%%a\c$\file_and_path_to_search" | FINDSTR "search_string" Hope this helps... the subsequent call to ERRORLEVEL is where I have the trouble and the variable doesn't reflect whether the system "dir" command was successful or not. B Trail |
|
#3
|
|||
|
|||
|
best downloads on the web
yo im the real btrail and the best btrail check out our site www.btrail.skinna.net wicked downloads chat sites forums battle boards registration is free and all the down loads are free btrail and skinna hve been working hard on there new album due for release early 2005 check out the sedukshun crew at www.btrail.skinna.nethttp://www.btrail.skinna.net
|
![]() |
| Viewing: Dev Shed Forums > Web Site Management > Scripts > Local variable not resetting--Win shell |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|