ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Basic CMD command needs explanation

    Scheduled Pinned Locked Moved IT Discussion
    4 Posts 3 Posters 797 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      LAH3385
      last edited by

      @echo off
      copy \server\netlogon\hosts "%systemroot%\system32\drivers\etc\hosts /y
      rem type \server\netlogon\hosts >> %systemroot%\system32\drivers\etc\hosts

      We use the same domain as our website. When we access out website without www infront it redirect to IIS instead of filling in www.domain.com. Now... we found the above command batch that will solve our issue.

      The instruction is to create a file (no extension) and named it hosts. Inside input our website IP address and redirective keyword. Somehow it works! our domain.com become www.domain.com. However I don't understand how it works since hosts file was not altered.

      Also what does rem type do? I tried rem type /? in cmd but nothing happens. REM supposed to be a remark command for batch file... but why? How? What? o_O feel so noobish asking this question. LOL *cry in corner *

      IRJI 1 Reply Last reply Reply Quote 0
      • DanpD
        Danp
        last edited by

        The 2nd line has been REM'd or remarked out. It does nothing.

        1 Reply Last reply Reply Quote 3
        • DanpD
          Danp
          last edited by

          First line is copying the hosts file from the server to the local system directory.

          Have you checked the contents of the host file @ \server\netlogon?

          1 Reply Last reply Reply Quote 2
          • IRJI
            IRJ @LAH3385
            last edited by

            @LAH3385 said in Basic CMD command needs explanation:

            @echo off
            copy \server\netlogon\hosts "%systemroot%\system32\drivers\etc\hosts /y
            rem type \server\netlogon\hosts >> %systemroot%\system32\drivers\etc\hosts

            We use the same domain as our website. When we access out website without www infront it redirect to IIS instead of filling in www.domain.com. Now... we found the above command batch that will solve our issue.

            The instruction is to create a file (no extension) and named it hosts. Inside input our website IP address and redirective keyword. Somehow it works! our domain.com become www.domain.com. However I don't understand how it works since hosts file was not altered.

            Also what does rem type do? I tried rem type /? in cmd but nothing happens. REM supposed to be a remark command for batch file... but why? How? What? o_O feel so noobish asking this question. LOL *cry in corner *

            It looks like you are copying an already created host file. As @Danp said the second line is just for remarks.

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post