Edit Hosts File in Windows 8 /7/10 and block any websites like facebook,youtube etc easily. Cannot Edit C: Windows System32 drivers etc hosts file solve problem easily 2016 Pooja Gupta.
- C /windows/system32/drivers/etc/services
- C Windows System32 Drivers Usbccgp Sys
- C Windows System32 Drivers Etc Hosts Block Website
- C Windows System32 Drivers Etc Hosts
- C Windows System32 Drivers Etc Hosts Missing
Active3 years, 3 months ago
I want to append a line to
C:WindowsSystem32driversetchosts
using VBScript. I tried to read this file first using this code:But I got an error in the second line: Bad file mode. I ran it using this command:
with
cmd
being run as an administrator. Any help would be great.Anh Nguyen
Anh NguyenAnh Nguyen
13422 gold badges99 silver badges2020 bronze badges
3 Answers
Open the file for appending, and simply output what you want. It will automatically be appended.
C /windows/system32/drivers/etc/services
Of course that does not address a potential issue of appending data that is already in the file.
If you want to read the file first, open it for reading, read the data, close it, then re-open it for appending and make your changes. There is no need to open it for writing.
If you want to edit the file, read it in, close it, reopen it for writing, and write out the edited data.
kbulgrienC Windows System32 Drivers Usbccgp Sys
kbulgrien3,35522 gold badges1919 silver badges3636 bronze badges
Matt ClarkC Windows System32 Drivers Etc Hosts Block Website
Matt Clark19.2k1111 gold badges5252 silver badges103103 bronze badges
C Windows System32 Drivers Etc Hosts
DisplayNameDisplayName