Command line and keyboard apologist corner

2008-09-23

Internet Explorer proxy control

Turn on IE Proxy:

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f


Turn off IE Proxy:

reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f

2007-10-15

XP environment variables manager

There is a very handy, freeware, single exe-file tool to manage the environment variables on your XP. View and edit the variables separately, check the dead folders in your PATH.

http://www.rapidee.com/

2007-10-12

Where does Windows XP store the evrironment variables?

In the registry the User environment variables are stored at

HKEY_CURRENT_USER\Environment

and the System environment variables are stored at

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment

2007-09-07

Smart PPTP connect/disconnect scripts for XP

When you are using PPTP connection in XP, you get the situation when the connection is established, that XP sets the default routing to your established PPTP connection, that is why some of your local network connectivities can be broken.

The following script establishes the selected PPTP connection and modifies the routing table to preserve your local connectivities:

rasdial PPTP-CONN username password
for /f "skip=3 tokens=3" %%a in ('netsh diag show ip Miniport*') do set VPNIP=%%a
route add 172.19.0.0 mask 255.255.255.0 %VPNIP%
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1

This script assumes that you local network is 192.168.1.0/255.255.255.0, your remote network over PPTP VPN is 172.19.0.0/255.255.255.0, and your PPTP connection name is `PPTP-CONN'. You should customize it (including user name and password) for your setting.

Disconnect script:

rasdial OTS-PPTP /disconnect

Getting IP address of any network interface on your XP

Information about all interfaces:

netsh diag show ip

Now, we use the mask to select the requested interface (this example selects the active PPTP connection):

netsh diag show ip Miniport*

Than, we strip unnecessary characters and get the IP address:

for /f "skip=3 tokens=3" %%a in ('netsh diag show ip Miniport*') do set VPNIP=%%a

echo %VPNIP%

2007-09-05

Getting your XP identity

for /f "delims={} tokens=1" %%a in ('dir /B "%USERPROFILE%\Local Settings\Application Data\Identities"') do SET IDENT=%%a

echo %IDENT%

2007-08-09

Getting the file length in the Windows XP/W2K batch-file

for %%I in (c:\autoexec.bat) do set SZ=%%~zI

echo %SZ%