Robertopcn
Robertopcn

Reputation: 487

Create Virtual directory in IIS with Inno Setup

Hi I need a help to create a Virtual directory.

I tried use these commands, but none works:

[Run]
Filename: "{cmd}"; parameters: "/C""net %systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"

Filename: "net.exe"; parameters: "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"

Filename: "{cmd}"; parameters: "/C""%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"

Filename: "{cmd}"; parameters: "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"

Filename: "cmd.exe"; parameters: "/C "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/DSERVER /physicalPath:D:\server1 /username:USER /password:PWD""

Filename: "cmd.exe"; parameters: "%systemroot%\system32\inetsrv\AppCmd add vdir /app.name: """"Default Web Site/"" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD"

Upvotes: 0

Views: 1088

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202721

This is the correct syntax:

[Run]
FileName: {sys}\inetsrv\appcmd.exe; \
    Parameters: "add vdir /app.name:""Default Web Site/"" /path:/server1/ /physicalPath:D:\server1 /username:USER /password:PWD"

Your attempts didn't work because:

  • In many, you try to run net, why?
  • You have the quotes all wrong.

    To embed a double-quote character inside a quoted value, use two consecutive double-quote characters.

    See Parameters in Sections.

  • Environment variables (%systemroot%) are resolved on command-line or in a batch file, but not in general when providing arguments to programs. If you want Inno Setup to resolve the variable for you, use syntax {%SystemRoot}. Though in this case, it's better to use {sys}.

    See Inno Setup Constants.

  • While not a problem on its own, there's no point trying to run .exe (appcmd.exe) via command-interpreter (cmd.exe).

Upvotes: 1

Related Questions