Search code examples
iis-7appcmd

How do I change the physical path of web site in IIS7 with APPCMD?


I need to change the physical path of a web site through the command line via the appcmd.exe tool, but I can't figure out the syntax. Can someone help?


Solution

  • This is how you should do:

    C:\Windows\System32\inetsrv>appcmd set vdir "MySite/" -physicalPath:"C:\inetpub\temp"

    Note: "MySite/" is a name of your virtual directory so if your virtual directory is under default web site you're likely have to set "Default Web Site/MySite/"


    As for figuring out how to do other appcmd commands just type: appcmd set vdir /?

    and you'll get all the info on what you can do to set your virtual directory.

    Even more specifically, if you want to know what settings you can change for the specific virtual directory type:appcmd set vdir "MySite/" /?

    These examples are just for virtual directory by they apply to other appcmd commands

    Hope this helps