Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#1
Post
by Dos_Probie » 20 Jun 2012 15:15
Hey Guys,
I got the following code below giving me my current Proxy address from the
registry but when I try to add in Ping its gives error and not working.. I think I am close but
if one of you Guru's can help I would really appreciate it..
Code: Select all
@echo off
for /F "eol= tokens=1* " %%a in ('REG Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyserver /t REG_SZ 2^>nul ^| find "REG_SZ"') do set str=%%b
set str=%str:~10,20%
if '%str%'=='' (
ping -n 12 %str%
)
:Output
ping -n 12 %str%
echo Your Current Proxy Address Is: %str%
pause
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#2
Post
by abc0502 » 20 Jun 2012 17:18
what is the output of %str% ?
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#3
Post
by Dos_Probie » 20 Jun 2012 19:56
got it working now , was trying to ping off port, corrected code below.
Code: Select all
for /F "eol= tokens=1* " %%a in ('REG Query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxy /t REG_SZ 2^>nul ^| find "REG_SZ"') do set str=%%b
set str=%str:~10,20%
:Output
ping -n 12 %str%