Submitted By: Anonymous Submission

Opens the HOSTS file on a specified computer.

Visual Basic
Edit|Remove
@echo off
title Remote HOSTS file Editor
cls
echo.
echo.
echo This batch file will open the HOSTS file
echo of a remote computer.
echo.
echo NOTE: After entering text, you must 
echo press Enter, F6, Enter
echo.
echo Enter name or IP address of computer:

:: Only one single command line is needed to receive user input
FOR /F "tokens=*" %%A IN ('TYPE CON') DO SET INPUT=%%A
:: Use quotes if you want to display redirection characters as well

IF EXIST "\\%INPUT%\c$\WINNT\SYSTEM32\DRIVERS\ETC\HOSTS" start notepad "\\%INPUT%\c$\WINNT\SYSTEM32\DRIVERS\ETC\HOSTS"
IF EXIST "\\%INPUT%\c$\WINNT\SYSTEM32\DRIVERS\ETC\HOSTS" GOTO END
IF EXIST "\\%INPUT%\c$\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS" start notepad "\\%INPUT%\c$\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS"
IF EXIST "\\%INPUT%\c$\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS" GOTO END

COLOR 4f
echo.
echo The computer %INPUT% cannot be found.
echo.
PAUSE

:END