Solved

why edit not working

Posted on 2013-06-24
14
461 Views
Last Modified: 2013-06-29
Directory of C:\Windows\System32\drivers\etc

07/13/2009  08:20 PM    <DIR>          .
07/13/2009  08:20 PM    <DIR>          ..
06/24/2013  05:32 PM               826 hosts
06/10/2009  02:00 PM             3,683 lmhosts.sam
06/10/2009  02:00 PM               407 networks
06/10/2009  02:00 PM             1,358 protocol
06/10/2009  02:00 PM            17,463 services
               5 File(s)         23,737 bytes
               2 Dir(s)  11,307,667,456 bytes free

C:\Windows\System32\drivers\etc>edit hosts.txt
'edit' is not recognized as an internal or external command,
operable program or batch file.

C:\Windows\System32\drivers\etc>edit hosts
'edit' is not recognized as an internal or external command,
operable program or batch file.

C:\Windows\System32\drivers\etc>edit hosts
'edit' is not recognized as an internal or external command,
operable program or batch file.

C:\Windows\System32\drivers\etc>
0
Comment
Question by:walkerdba
  • 4
  • 3
  • 3
  • +2
14 Comments
 
LVL 51

Expert Comment

by:Bill Prew
ID: 39273561
Check for the following file, sounds like it is missing.

What version of Windows?

You're probably better off using "notepad" instead of "edit" anyway, easier to use.

~bp
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 39273572
I don't think Edit has been around since Microsoft dropped QBasic. (The QBasic Editor was the same, I believe).
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 39273578
I have it on Windows 7.

~bp
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 39273587
What is it?

(It's not on Win8 x64).

Actually, that might be it - when I ran it, I reverted to short file names... perhaps Edit is 16bit and thus won't be on a 64 bit system.  Yep, I think that's it - EDIT runs in NTVDM, which is not on 64 bit Windows.

But it is on XP.

Wow... Talk about a blast from the past.
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 39273596
Though admittedly wikipedia:
Edit version 2.0 appeared with Windows 95, and appears in Windows 2000 and later. As it is still a 16-bit DOS program, it is not included in any 64-bit version of Windows, nor will it directly work on one. This version of Edit will run on DOS 3.30 and higher.
http://en.wikipedia.org/wiki/MS-DOS_Editor
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39275239
To modify the host file you "MUST" run notepad or any other text editor in "Run As Administrator" Mode.  So type notepad in the start bar, right click on notepad, Run As Administrator, then browse to the host file (C:\Windows\System32\drivers\etc).  Don't forget to change the show .txt to All files in the notepad open dialog.  You can view the host file without "Run as Administrator" but you can't save it without "Run As Administrator".
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 51

Expert Comment

by:Bill Prew
ID: 39275251
To modify the host file you "MUST" run notepad or any other text editor in "Run As Administrator" Mode.  So type notepad in the start bar, right click on notepad, Run As Administrator, then browse to the host file (C:\Windows\System32\drivers\etc).  Don't forget to change the show .txt to All files in the notepad open dialog.  You can view the host file without "Run as Administrator" but you can't save it without "Run As Administrator".
That's a great and valid point, but only if the poster is using a version of Windows newer than XP.  If XP or older then that wasn't required, and I don't think I've seen yet what the specific version of Windows involved is.

~bp
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39275385
good point.
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39275406
If it is windows xp or earlier then the issue is probably a path issue in the windows environment.  type path and see what's there.  I believe the dos commands were located in "C:\windows\command\"
0
 
LVL 44

Accepted Solution

by:
Darr247 earned 500 total points
ID: 39276494
The date/time stamp on the lmhosts.sam file in the original post identifies it as win7 (aka v6.1.xxxx)

Click the 'start' orb, type in cmd, hold down a Shift key and a Ctrl key (aka Ctrl+Shift), hit Enter, then release the Ctrl and Shift keys. Or, right-click the cmd (or cmd.exe, depending if you have known extensions visible) that then appears at the top of the start menu and choose Run as administrator.

From the Administrator window that opens...
If the C:\Windows\System32\drivers\etc\HOSTS file already exists, run
notepad C:\Windows\System32\drivers\etc\hosts
If hosts has not yet been created, run
notepad C:\Windows\System32\drivers\etc\hosts.sam
then use File -> Save As...
in the Save As dialog that opens, change the Save as type picklist to All Files (*.*), and the File name to simply hosts without the sam extension (if you don't change the picklist to 'All Files', you'll need to put "double quotes" around the name "hosts" or notepad will automatically add the .txt extension).

You might still need to take ownership of the C:\Windows\System32\drivers\etc sub dir, but some have reported only needing to run notepad as an administrator to be able to save the new HOSTS file there.
0
 

Author Closing Comment

by:walkerdba
ID: 39276868
yes
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39276889
Hmm, my answer was basically the same as Darr247 & I posted first so why didn't I get the credit?
0
 
LVL 44

Expert Comment

by:Darr247
ID: 39286778
I figured it was the take ownership instructions. I've never been able to save edits to hosts or lmhosts in Win7 without taking ownership and adding 'Full Control' permission for them (also on the Security tab), so besides the alternate way to run notepad as administrator, I added that link (http://technet.microsoft.com/en-us/library/cc753659.aspx ).
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

My purpose is to describe the basic concepts of virtual memory as implemented in a modern Windows-based operating system. I will also describe the problems inherent in older systems and how virtual memory solves them. The dark ages - before virtu…
This article describes how to set permissions to allow a limited-permissions user to start and stop a particular System Service.   It is always best to give users only the permissions that they need to perform their job, so tweaking particular permi…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now