简体   繁体   English

使用NSIS复制目录。

[英]Copy a directory using NSIS .

我似乎无法找到有关如何使用NSIS复制目录的任何信息?我知道有一个文件命令但是有任何复制目录的命令。

The syntax is same for both directory and file, except that you need to specify a directory by providing a \\ at the end. 目录和文件的语法相同,只是您需要通过在末尾提供\\来指定目录。 File command copies the directory if the specified argument is a directory. 如果指定的参数是目录,则File命令将复制目录。 For eg, you can do: 例如,你可以这样做:

SetOutPath "outputPath"
File "myDirectory\" #note back slash at the end

But that copies only the top level directory. 但是只复制顶级目录。 To recursively do it, you have /r switch 要以递归方式执行此操作,您需要/r切换

SetOutPath "outputPath"
File /nonfatal /a /r "myDirectory\" #note back slash at the end

which copies the contents of myDirectory (but not myDirectory folder itself). 它复制myDirectory的内容(但不是myDirectory文件夹本身)。 /nonfatal ignores without an error if there is no particular directory. 如果没有特定目录, /nonfatal忽略而不会出错。 /a copies file attributes as well. /a复制文件属性。 /x switch is used to exclude files. /x开关用于排除文件。

Otherwise, 除此以外,

SetOutPath "outputPath\myDirectory"
File /nonfatal /a /r "myDirectory\" #note back slash at the end

copies all the contents of myDirectory including myDirectory folder to outputPath . myDirectory所有内容(包括myDirectory文件夹)复制到outputPath

I found how to do it , sorry for the trouble . 我找到了怎么做,抱歉这个麻烦。

Extract the files to a directory which can't exist beforehand 将文件解压缩到预先不存在的目录中

CreateDirectory $Installdir\extracting

SetOutPath $Installdir\extracting

File Directory\*

File指令从安装程序中提取文件, CopyFiles复制最终用户系统上已存在的文件和/或目录(如果需要从安装程序所在的DVD复制文件,则可以使用$ EXEDIR ...)

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

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