Hello i want to find the most efficient way to delete a file in directory
Code:
C:\WINDOWS\system32\drivers\etc\HOSTS
which i think i would use the kill command and then replace it with a file called HOSTS too with a press of a button then use a simple if-then statement to show success.
Hello i want to find the most efficient way to delete a file in directory
Code:
C:\WINDOWS\system32\drivers\etc\HOSTS
which i think i would use the kill command and then replace it with a file called HOSTS too with a press of a button then use a simple if-then statement to show success.
,thanks in advance
Code:
Dim file as string="C:\WINDOWS\system32\drivers\etc\HOSTS\Filename.txt"
My.Computer.FileSystem.DeleteFile(file, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently, FileIO.UICancelOption.DoNothing)
Sorry, put that in windows explorer and look down and you should see a file called "hosts"...i want to delete the existing and replace it with a new one called "hosts" too...it is for a activation blocker for CS5 to not let the activator connect to the internet to check if a key is legit.
Originally Posted by benl
Code:
C:\Windows\System32\drivers\etc
Sorry, put that in windows explorer and look down and you should see a file called "hosts"...i want to delete the existing and replace it with a new one called "hosts" too...it is for a activation blocker for CS5 to not let the activator connect to the internet to check if a key is legit.
Code:
Dim newFile as string="Location+Filename"
My.Computer.Filesystem.copyFile(NewFile,"C:\WINDOWS\system32\drivers\etc\hosts",true)
Replace "Location+Filename" with the location and name of the host file you want to be replaced. For example if its in your D Drive, then it would be:
Code:
"D:\host"
OR if it's in another folder then:
Code:
"D:\Somefolder\host"
This would replace the existing file.
Thanks i will see if it works and is there a way to not have to use run as admin in win7 since you are modifying/changing a file because it may cause a problem?
Dim file as string="C:\WINDOWS\system32\drivers\etc\HOSTS\Filename.txt"
My.Computer.FileSystem.DeleteFile(file, FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently, FileIO.UICancelOption.DoNothing)
"hosts" is not a folder - it's your TCP local DNS resolution file.
Originally Posted by benl
Thanks i will see if it works and is there a way to not have to use run as admin in win7 since you are modifying/changing a file because it may cause a problem?
Disable UAC - it's a Windows restriction to prevent viruses and malware from wreaking havoc with your computer.