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 1. Open IIS Manager by Typing inetmgr on Start Menu or Run. Click On Sites on the Left navigation of IIS Manager. Right Click on Site where you want to Add Virtual Path and Choose Add Virtual Directory.
Physical path - This is the actual path the file is located by IIS. Virtual path - This is the logical path to access the file which is pointed to from outside of the IIS application folder. Let's display this image from Hard-drive 'E' using a virtual directory in IIS Default web site.
AppCmd.exe is located in the %systemroot%\system32\inetsrv\ directory. Because it is not part of the PATH automatically, you need to use the full path to the executable when executing commands like in %systemroot%\system32\inetsrv\AppCmd.exe list sites .
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With