简体   繁体   English

使用 Inno Setup 在 IIS 中创建虚拟目录

[英]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"

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?在许多情况下,您尝试运行net ,为什么?
  • 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.环境变量 ( %systemroot% ) 在命令行或批处理文件中解析,但在向程序提供参数时通常不解析。 If you want Inno Setup to resolve the variable for you, use syntax {%SystemRoot} .如果您希望 Inno Setup 为您解析变量,请使用语法{%SystemRoot} Though in this case, it's better to use {sys} .虽然在这种情况下,最好使用{sys}

    See Inno Setup Constants .请参阅Inno 设置常量

  • While not a problem on its own, there's no point trying to run .exe ( appcmd.exe ) via command-interpreter ( cmd.exe ).虽然本身不​​是问题,但尝试通过命令解释器 ( cmd.exe ) 运行.exe ( appcmd.exe ) 毫无意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM