0

When I am using the appcmd.exe for creating a website, I need a physical Path address in the command. How can I create directory when I am running this address:

%systemroot%\system32\inetsrv\AppCmd.exe add site /name:websitename /id:4 /physicalPath:C:\inetpub\wwwroot\example12 /bindings:http/*:80:example.com

On above command, "example12" directory doesn`t exist. And I want when running a command, that directory creating that address Automatically.

User12
  • 69
  • 1
  • 7

1 Answers1

0

I never really used Appcmd.exe but it is for manipulating IIS objects not file system objects. So I don't think there is a way to automatically create a directory when using AppCmd.exe

In your batch file just use:

md C:\inetpub\wwwroot\example12
%systemroot%\system32\inetsrv\AppCmd.exe add site /name:websitename /id:4 /physicalPath:C:\inetpub\wwwroot\example12 /bindings:http/*:80:example.com

or better use PowerShell cmdlets rather than AppCmd.exe

Peter Hahndorf
  • 13,763
  • 3
  • 37
  • 58