Search found 7 matches

by ImAhNoBoDy
06 Dec 2016 11:41
Forum: DOS Batch Forum
Topic: Comparing Arrays
Replies: 9
Views: 1451

Re: Comparing Arrays

Currently I'm logged in as User1 and User2 is disconnected. When I run the script this is the results I'm getting: USER1 is logged on USER1 is not added USER2 is logged on USER2 is not added PROFILE[0]=USER2 PROFILE[10]=USER1 PROFILE[11]=USER3 PROFILE[1]=USER4 PROFILE[2]=USER5 PROFILE[3]=USER6 PROFI...
by ImAhNoBoDy
06 Dec 2016 10:18
Forum: DOS Batch Forum
Topic: Comparing Arrays
Replies: 9
Views: 1451

Re: Comparing Arrays

Hm....I just realized I didn't explain fully. The results of the array should not have any duplicate users. So I have a list with only 1 instance of the users logged on in the list and duplicates of users not logged in. So the list should be of only users not logged onto the computer. Is this possib...
by ImAhNoBoDy
06 Dec 2016 06:44
Forum: DOS Batch Forum
Topic: Comparing Arrays
Replies: 9
Views: 1451

Re: Comparing Arrays

Firstly the code you have above has unbalanced parentheses and it also is performing case sensitive comparisons. @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION SET "a=0" SET "b=0" FOR %%a IN ("%USERPROFILE%") DO ( ECHO %%~nxa is logged on FOR /F %%c IN ('DIR/B/AD-S-H C:\Use...
by ImAhNoBoDy
06 Dec 2016 05:03
Forum: DOS Batch Forum
Topic: Expand 2 variables at the same time
Replies: 5
Views: 2443

Re: Expand 2 variables at the same time

The solution was to replace ECHO !ARR[%i%]! with CALL ECHO %%ARR[!i!]%%
by ImAhNoBoDy
06 Dec 2016 04:54
Forum: DOS Batch Forum
Topic: Comparing Arrays
Replies: 9
Views: 1451

Comparing Arrays

I'm wondering how do you compare the results from one array to another? I'm trying not list users that are not logged in at the moment and then put the results in an array. @ECHO OFF SETLOCAL ENABLEDELAYEDEXPANSION SET "a=0" SET "b=0" FOR /F "SKIP=1 TOKENS=1 DELIMS=> " ...
by ImAhNoBoDy
16 Nov 2016 16:18
Forum: DOS Batch Forum
Topic: Expand 2 variables at the same time
Replies: 5
Views: 2443

Expand 2 variables at the same time

I'm trying to expand 2 variables at the same time. Is this possible? The issue I'm having is during the IF statement. Instead of echoing 1 and then 2, the script echos 1 and 1. SETLOCAL ENABLEDELAYEDEXPANSION SET i=0 SET ARR[%i%]=1 SET /A "i+=1" SET ARR[%i%]=2 SET /A "i+=1" SET A...
by ImAhNoBoDy
16 Nov 2016 12:31
Forum: DOS Batch Forum
Topic: SET variable in IF statement
Replies: 2
Views: 931

SET variable in IF statement

I'm trying to figure out why the SET command in an IF statement will not change. The script just displays the IP address, subnet mask, and gateway. It also logs the results in a txt file. :@echo off SETLOCAL ENABLEDELAYEDEXPANSION SET LOG="C:\LOGS\IPMATCH.TXT" SET "i=0" ::STORE F...