简体   繁体   English

在nsis中安装时从文件读取,但不要在目标PC上将其复制

[英]read from a file while installation in nsis but do no copy it on the destination pc

I want to display the version on the installation dialog pages of nsis, by reading the version from a text file, but i have to copy this on the destination pc where the executable is run, but i want that the text file is not copied on the user's pc but is only read from, 我想通过从文本文件中读取版本来在nsis的安装对话框页面上显示版本,但是我必须将此文件复制到运行可执行文件的目标PC上,但是我希望文本文件不被复制到用户的PC,但只能从中读取,

that is, 那是,

i want to include this file into the exe, and read text from it to display on the nsis dialog pages, but not copy it anywhere on the pc wherever the exe is run? 我想将此文件包含到exe文件中,并从中读取文本以在nsis对话框页面上显示,但无论在运行exe文件的地方,都不能将其复制到PC上的任何位置?

is this possible? 这可能吗? or is there any other way of doing this? 还是有其他方法可以做到这一点?

In general, you can use $PLUGINSDIR constant. 通常,可以使用$PLUGINSDIR常量。 It is de-facto temporary directory on target system and you can put there something and use. 它是目标系统上的事实上的临时目录,您可以在其中放置一些东西并使用。 Following code will copy the file into the temporary directory on the target machine, but whole directory will be deleted after the installation completion. 以下代码会将文件复制到目标计算机上的临时目录中,但是安装完成后将删除整个目录。 ( InitPluginsDir is needed somewhere before) (之前需要InitPluginsDir

InitPluginsDir 
File /oname=$PLUGINSDIR\blah.txt "..\myfile.txt"

But in your case, it could be better to solve it in some other way. 但是在您的情况下,最好以其他方式解决它。 You can define some constant containing version number and use it in the code, can't you? 您可以定义一些包含版本号的常量,并在代码中使用它,对吗? The !define command could be in generated file so you can automate it... !define命令可能在生成的文件中,因此您可以使其自动化...

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

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