Edit host file by Batch File

Update Host file with bath script

Today I got a mail from one of my senior is there a way by which we can add multiple address in host file with out consuming lot of time and my simple reply was we need to use batch file for that. They said ok do it but actually I have never done it before so I had no other option than Google.

I searched for Google but every time I got a lengthy result and comment on those results were not positive it worked for some people and for some people it doesn't. I was wondering If I can have a simplest way for this as my previous backup script.

So I decided if I can print few lines in host file and it worked.Now no need of writing a long batch script for editing host file.

Here is the command

echo test.test.com>>c:\Windows\System32\drivers\etc\hosts

You can add as many line as you want to add and save the file as hostentry.bat

Let me explaint you meaning of each word here

Echo it will print the words written after it Its the ip of the server

Test.test.com Its the dns name of the server

>> it save the printed data in given file

c:\Windows\System32\drivers\etc\hosts Host file location for printg the data

Needless to say that IP and domain name would get change as per your server detail

if your oprating system is not in c driver please chagne the drive latter as per needed.

Just run the batch file and you are done for updating your host entry.

Hope it was usefull for you.

Please let me know if you face any problem in it.

Read More......

Backup,compress and rename the folder with current Date by batch file

Automated file backup, renaming with current date & compress using batch file

Sometimes we need to take back up of some particular folder that regularly get updated and very crucial folder too. So what we need to do either use a third party tool or windows backup utility but I do not like both of them because of different reason.

For most of backup thing I love scripts and scheduling to do backup because you plant the tree once and get mangos always.

This time someone asked me to take a vss backup on daily basis but I can’t do this manually daily so I wrote a script and scheduled it to take the backup and rename it with current date. After that I thought if I can compress the folder it will save lot of disk space so I added one more line and it was all done.

For this compression thing you need to download an additional tool called 7zip command line version. That you can download from 7Zip download page here. After downloading it extract the zip file and copy the 7za.exe file in c:\WINDOWS\system32 folder. It’s very important to copy it in this system32 folder else you will need to give the full path of this 7za.exe file.

After this copy the bellow code and paste it in notepad.

xcopy D:\Data\*.* e:\backup\*.* /e /h /r /y

7za a -tzip e:backup.zip "e:\Backup"

rename "E:\backup.zip" %Date:~-10,2%_%Date:~-7,2%_%Date:~-4,4%.zip

Save the above file as backup.bat.

If you will run it by double click it will open a command prompt window immediately and will start processing after execution of all task it will get close and you can see the backup files at backup location.

In the above script fist line will copy the data second line will compress the folder and third line will rename the zip file to current date name.

Now here is next task, scheduling the backup.

For scheduling thing we will use windows scheduler. For this go to Control Panel->Scheduled Tasks and then double click on Add scheduled task. It will open a wizard just follow the wizard and it’s all done when you are at end of wizard.

Things do remember

1) Make sure to change the folder path.

2) Do not do any change other than the folder path

3) make sure to test it on a test environment before putting it live.

I hope it was useful for you please comment if you face any problem or have any suggestion for this.

Thanks for visiting my blog.

Read More......

MAPI32.DLL file missing in outlook

MAPI32.DLL file missing in outlook

MAPI32.DLL error running Outlook 2003 - Office Setup

Today morning one of my colleagues asked me to upgrade his mail client from outlook express to MS outlook. I questioned him why you are using outlook express while we have MS outlook and he answered me “all the time I start MS outlook I get some annoying error. I tried to reinstall and did every tweak that was available on net but it’s not working”.

I decided to check it by my own so I started outlook and got the error MAPI.DLL is missing or corrupt. Well after this simply I had to do outlook repair or reinstall but my colleague said he already done that. I said ok let me do it once again. First I repaired but it dint work than uninstall and reinstall but then also result was same.

Now I had no other option that thinking in out of box way. I removed MS office once again and now I went to C:\program files here I looked if traces of MS office installed files are still there and I got the problem. The MS office folder was still there. I removed the MS office folder and then I removed the msocache folder from my c drive that gets created when we install MsOffice.

After this I restarted the computer and re-installed the MS Office and needless to say it worked as if it never had any problem.

So to get rid of this error just uninstall MS office->Remove all the files of installed MS office from program file and temp files now restart the computer and reinstall ms office and your are done.

Hope this was useful for you.

Please let me know if you get any problem in this.

Read More......

Download the complete website for offline mode browsing

Download the complete website by Httrack website copier

I am a big freak of comics and I use to download them from different sources but once in a comics community I got someone shared his comics in the form of a website in different folder and many of those comics were not there with me so I yesterday night I decided to download them but I couldn’t do that manually as I do all my downloading in night only and scheduling was not a good option as there were number of files and scheduling everything was practically impossible for me. In this condition I only got a simple idea “DOWNLOAD THE ENTIRE SITE” and I did that.

Downloading a website is not a tough job as long as you have a good internet speed and you know how to do that. Luckily I have BSNL EVDO data card that give up to 2mbps speed and about how to do I was aware about it since a long time. I just downloaded httrack website copier and used it for this job.

HrTrack Website copier downloads the entire content of the website and create a website in offline mode that you can access any time doesn’t matter what content the original website had it will give you almost similar look and feel but it will not give you database connectivity as it do not download the data base. It downloads the every content from website weather it’s a exe,pdf,zip or html or any file it will download that file too if it allowed to download. It creates a .whtt file as index file and from this .whtt file it open the entire website.

Here is the short tutorial to download the website or part of the website.

1) After installing open it and you will get screen like this,

2)Select your project name and its location.

3)Give the website url. If you want to download some particular folder give only that folder path. files access should be enabled on the website.

4) finish it and just let it go. It will download the entire content of the particular given path. it can download the external link also and we can decide what should be the depth to download the external link.

You can download htttrack website copier from its website here

Do response me if you liked it.

Thanks for visiting

Read More......
Clicky Web Analytics