balalakshmi
balalakshmi

Reputation: 4208

is it possible to change IE proxy settings from command line

I am looking for options which will allow me change connection proxy information of IE thru command line.

Upvotes: 16

Views: 47960

Answers (6)

Hyung Doe
Hyung Doe

Reputation: 51

this is a question that is almost 11 years old but...

if there are some windows 10 users that need this done on cmd

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyEnable /t REG_DWORD /d 1 /f
reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v proxyServer /t REG_SZ /d socks=localhost:4444 /f

if you check the checkbox the work is done.

here

Upvotes: 2

ZEE
ZEE

Reputation: 3193

you could also use netsh:

// for a Socks proxy

netsh winhttp set proxy proxy-server="socks=10.0.0.254:1080" bypass-list="localhost"


// using credentials

netsh winhttp set proxy proxy-server="http=aUser:[email protected];aUser:aPass@https=10.0.0.254;" bypass-list="localhost"


// reset proxy

netsh winhttp reset proxy 


Upvotes: 0

Kevin Xiong
Kevin Xiong

Reputation: 153

you could also make it via powershell:

<#
.Synopsis
This function will set the proxy settings provided as input to the cmdlet.
.Description
This function will set the proxy server and (optinal) Automatic configuration script.
.Parameter ProxyServer
This parameter is set as the proxy for the system.
Data from. This parameter is Mandatory
.Example
Setting proxy information
Set-InternetProxy -proxy "proxy:7890"
.Example
Setting proxy information and (optinal) Automatic Configuration Script 
Set-InternetProxy -proxy "proxy:7890" -acs "http://proxy:7892"
#>

Function Set-InternetProxy {
    [CmdletBinding()]
    Param(      
        [Parameter(Mandatory = $True, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
        [String[]]$Proxy,

        [Parameter(Mandatory = $False, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
        [AllowEmptyString()]
        [String[]]$acs               
    )

    Begin {
        $regKey = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"      
    }   
    Process {
        Set-ItemProperty -path $regKey ProxyEnable -value 1
        Set-ItemProperty -path $regKey ProxyOverride -Value "<local>"
        Set-ItemProperty -path $regKey ProxyServer -value $proxy                        
        if ($acs) {                    
            Set-ItemProperty -path $regKey AutoConfigURL -Value $acs          
        }
    }    
    End {
        Write-Output "Proxy is now enabled"
        Write-Output "Proxy Server : $proxy"
        if ($acs) {       
            Write-Output "Automatic Configuration Script : $acs"
        }
        else {           
            Write-Output "Automatic Configuration Script : Not Defined"
        }
    }
}

you could find the reference here Set-InternetProxy : Enable proxy with PowerShell

Upvotes: 2

Srichakradhar
Srichakradhar

Reputation: 1625

proxycfg might be the tool you are looking for.

C:\>proxycfg /?
Microsoft (R) WinHTTP Default Proxy Configuration Tool
Copyright (c) Microsoft Corporation. All rights reserved.

usage:

    proxycfg -?  : to view help information

    proxycfg     : to view current WinHTTP proxy settings

    proxycfg [-d] [-p <server-name> [<bypass-list>]]

        -d : set direct access
        -p : set proxy server(s), and optional bypass list

    proxycfg -u  : import proxy settings from current user's
                   Microsoft Internet Explorer manual settings (in HKCU)

It works well in windows XP
In next windows versions, you can use:

C:\>netsh winhttp import proxy source=ie

to import proxy settings from Internet Explorer and

C:\>netsh winhttp reset proxy

to reset proxy settings for more help, use:

C:\>netsh winhttp /?

But these changes might not get reflected in Internet Explorer. Nonetheless, you should be able to use proxy in command line applications.

Upvotes: 3

CraigTP
CraigTP

Reputation: 44909

According to this MSDN article:

Internet Explorer Command Line Options

there is no way to change Internet Explorer's proxy settings via the command line.

Upvotes: 1

i_am_jorf
i_am_jorf

Reputation: 54600

IE proxy settings are controlled via registry keys. In general you should change them manually since this implementation detail can change between versions. However, as a debugging tool its useful.

Anyway, you can change registry keys from the command line using the REG command. Specifically, I would just create some .reg files with the various states you want to change to and do REG IMPORT example-file.reg. Or, failing that, REG ADD.

Upvotes: 5

Related Questions