Thanks in advance.
Ok soo the problem is that... That i was searching on internet how to read text file lines with batch command and i found this:
Code: Select all
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (variables.txt) do (
set /a N+=1
set v!N!=%%a
)
set hostname=!v1!
set backupdrive=!v2!
set backupdir=!v3!
set xbackupdir=!v4!
echo %hostname% %backupdrive% %backupdir% %xbackupdir%
pause
Then i modyfied part of the code and got something like this (i don't know what some commands do):
Code: Select all
:IPScan
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (ipscan.txt) do (
set /a N+=1
set v!N!=%%a
)
set ip=!v1!
echo Ip %ip% Scan Start
nbtstat -a %ip%
net view \\%ip%
echo Ip %ip% Scan End
set ip=!v2!
echo Ip %ip% Scan Start
nbtstat -a %ip%
net view \\%ip%
echo Ip %ip% Scan End
set ip=!v3!
echo Ip %ip% Scan Start
nbtstat -a %ip%
net view \\%ip%
echo Ip %ip% Scan End
Then I wrote set ip=!v4!, and ect. , but then i understood that, if my text file will have more lines than ex. 100 i won't able to read them and my scan will stop.
ipscan.txt looks something like this:
Code: Select all
109.123.111.99:80
109.123.70.47:80
109.230.213.40:3128
109.68.186.218:3128
109.72.32.115:80
112.133.195.28:6588
113.105.168.172:8080
113.160.23.58:8888
114.113.238.238:8080
114.141.57.249:80
115.160.178.253:80
115.78.135.30:80
116.72.170.33:3128
118.122.67.81:1337
122.226.60.42:1337
123.125.148.44:80
123.139.155.86:80
123.194.40.64:8088
123.242.172.4:80
123.30.183.119:8118
123.65.0.175:3128
125.162.70.99:808
125.39.154.75:80
125.40.85.96:3128
125.46.34.28:8080
125.75.204.22:8080
128.111.52.64:3127
128.112.139.28:4815
128.119.41.211:3128
128.143.6.130:3124
128.143.6.130:3127
128.143.6.130:3128
128.220.231.4:3124
130.83.166.245:3128
137.132.80.106:3124
137.165.1.115:3124
14.136.194.137:3128
14.136.194.137:80
14.136.194.138:3128
14.136.194.138:80
141.76.45.34:3128
141.76.45.35:3129
143.215.131.198:4815
164.78.252.110:80
164.78.252.24:80
164.78.252.25:80
167.192.220.240:80
168.167.43.188:6588
173.12.170.130:80
173.192.60.3:80
173.80.140.66:8085
174.37.138.181:80
174.49.95.109:8085
178.33.26.119:80
183.91.74.68:8080
184.106.137.84:8000
184.106.181.74:80
184.107.136.146:443
186.232.195.13:8080
186.42.183.5:80
187.111.192.4:8080
187.111.192.5:8080
187.35.83.132:6588
188.128.64.9:54321
188.165.194.167:80
188.165.194.167:8080
188.168.46.195:3128
189.125.212.234:80
189.2.127.70:8080
189.200.240.68:80
189.89.70.127:6588
190.152.223.27:8080
190.201.241.120:8080
190.253.89.130:3128
190.26.93.234:3128
190.85.21.51:80
190.86.206.53:8080
192.26.179.68:3124
194.151.57.244:808
194.8.154.157:88
194.8.154.157:8888
195.138.88.105:3128
195.158.19.210:3128
195.218.117.17:80
195.239.36.214:80
200.251.200.1:8080
200.251.58.190:8080
200.56.240.59:3128
200.93.212.74:8080
200.94.40.62:3128
201.18.15.11:8080
201.20.18.165:3128
201.73.221.252:80
202.101.124.18:80
202.108.5.35:8080
202.115.12.140:808
202.129.58.68:80
202.147.198.69:80
202.147.198.71:8080
202.149.24.216:80
202.171.253.70:80
202.171.253.71:80
202.181.174.252:80
202.183.167.210:8080
202.185.33.14:80
202.28.66.115:8080
202.41.135.68:8080
202.57.69.84:80
202.6.96.14:80
202.6.96.16:80
202.6.96.31:80
202.6.96.31:8080
202.6.96.31:8081
203.154.19.136:8080
203.196.97.44:80
205.202.120.216:3128
208.109.207.149:80
208.78.97.11:80
209.221.131.75:80
209.34.241.44:80
209.97.203.60:3128
210.101.131.231:8080
210.123.39.103:3124
210.212.123.10:8080
210.212.29.147:8080
210.44.126.14:3128
210.51.38.124:808
210.82.57.79:8080
211.101.55.183:808
211.147.65.4:80
211.95.79.134:80
212.14.38.95:80
212.160.138.237:80
212.233.220.34:808
212.45.5.172:3128
212.50.240.17:8080
213.0.88.85:8080
213.125.24.236:8080
213.165.90.63:80
213.230.23.101:80
213.248.47.87:8888
213.248.47.88:8888
216.157.222.82:80
216.157.222.84:80
217.172.179.50:80
218.203.176.126:8080
218.248.44.216:8080
218.25.99.135:808
218.87.150.138:1337
218.92.8.165:8080
218.94.6.149:3128
219.135.215.36:8080
219.139.132.59:80
219.147.61.21:3128
219.166.83.4:80
219.91.232.234:8081
220.181.49.163:8123
220.227.100.59:443
220.227.100.59:8080
220.231.93.41:80
221.10.44.131:80
221.130.162.205:80
221.195.254.14:80
221.213.50.115:8000
221.214.7.130:1337
221.231.109.164:808
222.122.206.203:80
222.187.199.37:8080
222.221.8.254:808
222.248.193.53:8000
222.255.122.155:8080
222.255.27.223:81
222.73.173.115:8118
222.77.14.54:8088
My question is. How to make batch file read all text lines (without soo much writining same thing) and execute nbstat -a command and net view command.
One more time thanks for advance.