Amazon Great Offers

October 31, 2014

Change IP Address and DNS from static to DHCP and vice versa in Windows Command Line Dynamically using Batch file script

Hi friends,

I was frequently changing my system network from static to dynamic.

I was fed-up with the manual changes by entering the static IP address and changing it to dynamic.

I though of creating a batch file, which requests user to select options and proceed further.

 

I found something on Internet, just modified it for my purpose and thought of sharing with you all.

 

  • Check your network name
    • cmd> netsh interface show interface
  • It will list all the network interfaces connected to your system
    • Select the network which you want to change the settings
  • Modify the below code with appropriate network name, IP address, subnet, gateway and DNS server

@echo off

set NETWORK="Local Area Connection"
set IP=10.9.40.95
set SUBNET=255.255.255.0
set GATEWAY=10.9.40.47
set DNSSERVER=192.168.178.1

echo Choose:
echo [S] Set Static IP
echo [D] Set DHCP
echo.

:choice
SET /P C=[S,D]?
for %%? in (S) do if /I "%C%"=="%%?" goto S
for %%? in (D) do if /I "%C%"=="%%?" goto D
goto choice

:S
@echo off
echo "Setting Static IP Address, Subnet Mask and DNS Server"
netsh interface ip set address %NETWORK% static %IP% %SUBNET% %GATEWAY% 1
netsh interface ip set dnsservers %NETWORK% static %DNSSERVER% primary
netsh interface ip show config
pause
goto end

:D
@echo off
echo "Resetting IP Address, Subnet Mask and DNS server For DHCP"
netsh interface ip set address name=%NETWORK% dhcp
netsh interface ip set dns %NETWORK% dhcp
ipconfig /renew

echo "New IP Address, Subnet Mast and DNS Server for %computername%:"
netsh interface ip show config
pause
goto end

:end

Now enjoy the feature of changing IP address with 3 clicks

 

Please send your feedback and comments to psrdotcom@gmail.com

Blogger Labels: Change,DHCP,vice,Windows,Command,Line,Batch,script,system,user,options,Internet,purpose,Check,interface,interfaces,Select,settings,Modify,gateway,server,NETWORK,Local,Area,Connection,SUBNET,DNSSERVER,Choose,Static,Mask,Mast,feedback,netsh,goto,config

October 16, 2014

Convert windows drive or disk file system from FAT32 to NTFS without losing data

Hi all,

I had a problem with my external hard disk when copying some 25GB file.

I had troubleshoot the problem and understand that, my hard disk file system is FAT32, which can only copy max 4GB single file size

 

I was thinking without losing my data, how can I change the file system, so that, I copy more than 4GB sized single files

Then I come across the following commands in Windows

1) chkdsk : Check disk

2) convert : Convert disk file system

 

chkdsk command

Syntax

cmd> chkdsk volume_letter: [options]

Example

Checks for disk errors and fix it

cmd> chkdsk I: /f

 

convert command

Syntax

cmd> convert volume_letter: FS:NTFS [options]

Example

Convert volume from FAT to NTFS in verbose

cmd> convert I: /FS:NTFS /V

 

Possible Errors with solutions

Insufficient Memory

Reason

Nearly 4 GB files in existing FAT32 system

Solution

Move the files to local drive, do chkdsk and then convert

 

References:

http://ss64.com/nt/chkdsk.html

http://www.computerhope.com/convert.htm

 

Blogger Labels: Convert,disk,system,NTFS,data,size,Windows,Check,Syntax,options,Example,Checks,errors,Possible,solutions,Insufficient,Memory,Reason,Solution,Move,References,chkdsk,volume_letter

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com