Showing posts with label Windows 8. Show all posts
Showing posts with label Windows 8. Show all posts

Monday, January 14, 2019

How to change the host url in Host file on Windows

Modifying your hosts file enables you to override the domain name system (DNS) for a domain on a specific machine. This comes in handy when you want to test your site without the test link prior to going live with SSL, verify that an alias site works prior to DNS changes.

The syntax stays mostly the same across in Windows, macOS, or Linux. Generally, most hosts files will have several entries for loopback. Follow the below basic syntax of a host entry.

An entry is divided into 3 parts in following way.

  1. The location to redirect the address to 
  2. The address that you will want to redirect,
  3. The comment. 
This can be separated by a space, but for ease of reading are typically separated by one or two tabs.

Follow below instructions if you are running on WIndows 10 or 8:

  1. Run NotePad or NotePad++ as Administrator.
  2. Open the following file: c:\Windows\System32\Drivers\etc\hosts 
  3. Make the necessary changes to the file.
  4. Go to File > Save your changes.

Sample host file entry for http://localhost/UmbracoDemoApp/
127.0.0.1 UmbracoDemoApp  # Sample host name
127.0.0.1 UmbracoDemoApp.local # Sample host name

Sunday, September 27, 2015

How to delete a file with a path too long for normal delete

I was working with some computer vision source code I found that it creates cache file that has a VERY LONG name and now
I can't delete entire folder due that file.

I tried to rename it to a shorter name but I can't do anything to the file, I also tried to restart my computer and see if it would just go away.

The error message says:
The file name(s) would be too long for the destination folder. You can shorten file name and try again, or try a location that has a shorter path.

After doing lot of things I found an easy way of removing  a file with a path too long to be deleted. So simply


  1. Run cmd as Administrator (you might don't need it).
  2. Change path to the directory that file is located or the parent folder.
  3. I'm using robocopy command to get this done. finally run following commands. Because when you want to completely delete a directory and it has file with long names inside it, robocopy does a VERY good job for you.☺

mkdir empty_dir
robocopy empty_dir the_dir_to_delete /s /mir
rmdir empty_dir
rmdir the_dir_to_delete