本文介绍了如何在inno脚本中将文件复制到AppData \ Local \ Temp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用inno脚本为我的应用程序创建了.exe文件.在这里,我想将文件从安装文件夹复制到AppData \ Local \ Temp目录.这是使用以下代码完成的.

I have created an .exe file for my application using inno script. Here I want to copy files from my setup folder to the AppData\Local\Temp directory. This is done using the below code.

Source: "WebcamApplet_1-0-0\*"; DestDir: "{localappdata}\Temp\WebcamApplet_1-0-0"

我面临的问题是此代码仅将文件复制到sysadmin中,即C:\ Users \ Sysadmin \ AppData \ Local \ Temp(Admin),我必须将其放入C:\ Users \ Manesh \ AppData \ Local \ Temp(User)使我的应用程序正常工作.我该如何解决这个问题.

The problem I'm facing is that this code is only copying the files into the sysadmin ie C:\Users\Sysadmin\AppData\Local\Temp (Admin), I have to put it in C:\Users\Manesh\AppData\Local\Temp(User) for my application to work. How do I solve this problem.

推荐答案

如果您希望将文件安装到Temp文件夹,则您的应用程序设计不良.之所以命名该文件夹,是因为用户或系统可以随时删除其中包含的所有文件,因此仅适合临时使用.

Your application is badly designed if it expects files to be installed to the Temp folder. This folder is so named because the user or the system are free to delete all files contained therein at any time -- it is therefore suitable only for temporary use.

此外,对于每台计算机的安装程序(默认运行PrivilegesRequired=admin运行),没有合理可靠的方法将文件或设置安装到每个用户的文件夹,包括每个用户的临时文件夹.

Additionally, there is no reasonable and reliable way for a per-machine installer (one running with PrivilegesRequired=admin, which is the default) to install files or settings to per-user folders, including the per-user temporary folder.

如果您确实要执行此操作,则应将PrivilegesRequired=lowest设置为创建每个用户的安装程序-但请记住,这将引入其他限制,例如限制应用程序的安装位置.如果您以最低特权运行,则可以使用{%TEMP}引用临时路径.

If you really really want to do this, you should set PrivilegesRequired=lowest to create a per-user installer -- but bear in mind that this will introduce other restrictions, such as limiting where your application can be installed to. Provided that you are running with lowest privileges, you can then use {%TEMP} to refer to the temporary path.

这篇关于如何在inno脚本中将文件复制到AppData \ Local \ Temp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 07:49