在nsis中安装时从文件读取,但不要在目标PC上将其复制 [英] read from a file while installation in nsis but do no copy it on the destination pc

查看:102
本文介绍了在nsis中安装时从文件读取,但不要在目标PC上将其复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过从文本文件中读取版本在nsis的安装对话框页面上显示版本,但是我必须将此文件复制到运行可执行文件的目标PC上,但是我希望该文本文件是不会复制到用户的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,

我想将此文件包含到exe文件中,并从文件中读取文本以显示在nsis对话框页面上,但不希望将文件复制到运行exe文件的PC上的任何位置吗?

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?

这可能吗?还是有其他方法可以做到这一点?

is this possible? or is there any other way of doing this?

推荐答案

通常,您可以使用$PLUGINSDIR常量.它是目标系统上的事实上的临时目录,您可以在其中放置一些东西并使用.以下代码会将文件复制到目标计算机上的临时目录中,但安装完成后将删除整个目录. (InitPluginsDir之前需要在某处)

In general, you can use $PLUGINSDIR constant. 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 
File /oname=$PLUGINSDIR\blah.txt "..\myfile.txt"

但是在您的情况下,最好以其他方式解决它.您可以定义一些包含版本号的常量,并在代码中使用它,对吗? !define命令可能在生成的文件中,因此您可以将其自动化...

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

这篇关于在nsis中安装时从文件读取,但不要在目标PC上将其复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆