0

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"
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Robertopcn
  • 447
  • 1
  • 5
  • 15
  • Does any of these work when you execute them manually on command-line? – Martin Prikryl Oct 15 '15 at 06:47
  • Yes, I used this command in DOS: %systemroot%\system32\inetsrv\APPCMD add vdir /app.name:"Default Web Site/" /path:/SERVER1 /physicalPath:D:\server1 /username:USER /password:PWD – Robertopcn Oct 15 '15 at 22:21

1 Answers1

1

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).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992