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

不打扰是莪最后的温柔 提交于 2019-12-11 23:42:49

问题


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,

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?

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


回答1:


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"

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



来源:https://stackoverflow.com/questions/6013926/read-from-a-file-while-installation-in-nsis-but-do-no-copy-it-on-the-destination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!