![]() |
|
|
|||||||
| Petri.co.il is happy to award auglan the title of Most Valuable Member !!! |
| Register | Calendar |
Search |
Today's Posts |
Mark Forums Read |
| Notices |
|
|
Batch File creation - Help Needed.this thread has 4 replies and has been viewed 6661 times
|
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||||||
|
||||||||
|
Hi
Ive created a cd that autoruns a graphical menu with clickable links, and one of the links points to a HOSTS.bat file that copies over a custom HOSTS file from the cd to the ..\drivers\etc folder on the system root. The problem I'm having is that I'm unsure of the correct syntax to use to automatically overwrite the existing HOSTS file. I need to write it to work on both Win2K and XP machines, so have included two lines; one copies the HOSTS file to WINDOWS\system32\drivers\etc, and one copies it to Winnt..\etc. Thsi seems to work ok, for if it's an XP machine it ignores the Winnt instruction and vica versa. However, this has all been tested with my original HOSTS file temporarily renamed to HOSTS2, so there is no HOSTS file to be overwritten. I cannot seem to make it work if there is a HOST file already present. Is there a switch to make it overwrite? Or changing tack entirely, is there a way I can instruct the IP address I need to be written into the original HOSTS file? Here is the contents of the batch file as it stands: rem copy "hosts" "C:\WINDOWS\system32\drivers\etc\hosts" copy "hosts" "C:\WINNT\system32\drivers\etc\hosts" If anyone can help I would be most appreciative! TIA |
|
#2
|
|||||||||
|
|||||||||
|
Hi,
Use 'XCOPY' not 'COPY' XCOPY is much more powerful Open a command prompt window (START > RUN > type CMD press Enter) type: XCOPY /? This shows the switches you can use with the XCOPY command. Quote:
Hope that helps...
__________________
1 + 1 = 11 ... honest! |
|
#3
|
||||||||||
|
||||||||||
|
just add the following line instead of those 2 lines:
Code:
copy /y <CDDRIVE>\dir\hosts "%windir%\system32\drivers\etc\hosts
__________________
Marcel Netherlands http://www.phetios.com http://blog.nessus.nl MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE No matter how secure, there is always the human factor. |
|
#4
|
||||||||||
|
||||||||||
|
Quote:
topper
__________________
There are 10 types of people in this world, those who understand binary and those who do not. |
|
#5
|
||||||||
|
||||||||
|
Thanks for the reply, it worked a treat!
Bladerunner |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Needed for Outlook Express's Damaged .dbx file | alitoday | Outlook XP/2003/2007 | 1 | 4th February 2006 13:25 |
| Run a batch file @ shutdown | Solid | Windows 2000 Pro, XP Pro | 8 | 19th January 2006 20:41 |
| Batch file copy from cd? | Bladerunner | General Scripting | 6 | 17th April 2005 23:41 |
| PHP extensions installations , IIS crash after enable mbstri | igoldman | Windows Server 2000 / 2003 | 0 | 7th April 2005 10:42 |
| Batch File | Michellea | General Scripting | 1 | 24th January 2005 12:47 |