管理员 - 我该怎么办? [英] Administrator - what can I do?
问题描述
嗨...抱歉再次打扰,但这个对我来说很难!!
我的应用程序在c:\program files中有效并保存一些设置,我使用.ini文件,访问此文件,我需要以管理员身份运行我的应用程序。但是,我希望我的应用程序在Windows启动时运行..因为我在StartUp文件夹中安装了一个图标!
现在......问题是如果管理员设置关闭,我的应用程序只能在启动时运行!!!
我该怎么做才能解决这个问题呢?
谢谢!
我尝试了什么:
i什么也没试过......我对这一个完全失明......不知道从哪里开始!!!!
将.INI或您正在使用的任何设置文件放在适当的文件夹中,例如 CommonApplicationData [ ^ ]。您可以使用 Enivornment.GetFolderPath() [ ^ ]。
一旦你有了这条路径,你就可以在它上面添加你的公司和应用程序文件夹并将你的设置文件存储在那里。
好的我找到了办法
Dim path 作为 字符串 = Directory.GetCurrentDirectory()
Dim pathy = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
如果 My.Computer.FileSystem.FileExists(pathy& \ APP \Settings.ini)然后
Else
My.Computer.FileSystem.CopyFile(path& \ Settingtings \Settings.ini,pathy& \ APP \Settings.ini)
感谢无论如何:)
Hi...sorry to bother again but this one is very hard for me!!
My app is instaled in "c:\program files" and to save some settings i use a .ini file, to access this file i need to run my app as administrator..however i want my app to run on windows startup..for that i installed an icon in the StartUp folder!
Now ... the problem is that my app only runs on startup if the administrator setting is off!!!
What can i do to overpass this problem?
Thank you!
What I have tried:
i tried nothing ...i am completely blind on this one..do not know where to start!!!!
Put the .INI or whatever settings file you're using in an appropriate folder, like CommonApplicationData[^]. You can get the path to this folder using Enivornment.GetFolderPath()[^].
Once you have that path, you can build on it to add your company and application folders to it and store your settings file in there.
ok i found a way
Dim path As String = Directory.GetCurrentDirectory() Dim pathy = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) If My.Computer.FileSystem.FileExists(pathy & "\APP\Settings.ini") Then Else My.Computer.FileSystem.CopyFile(path & "\Settings\Settings.ini", pathy & "\APP\Settings.ini")
thanks anyway : )
这篇关于管理员 - 我该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!