Vb.Net:如何在运行时访问系统文件夹时获取管理员权限和管理员权限对话框 [英] Vb.Net: How Do I Get Admin Rights And Admin Rights Dialog During The Runtime For Access To A System Folder
本文介绍了Vb.Net:如何在运行时访问系统文件夹时获取管理员权限和管理员权限对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下问题。
我希望点击一下按钮将我的应用程序的链接复制到用户启动文件夹
-------这里我需要管理员权限 - -------------------------
CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup)& \ FileName.lnk,My.Application.Info.DirectoryPath& \ FileName.exe)
-------这里我将完成管理员权限----------------
或 for 删除此链接
-------这里我需要管理员权限----------------------- ----
如果 My.Computer.FileSystem.FileExists(Environment.GetFolderPath(Environment.SpecialFolder.Startup)& \ FileName.lnk)= True 然后
My.Computer.FileSystem.DeleteFile(Environment.GetFolderPath(Environment.SpecialFolder.Startup)& \ .FileName.lnk)
------ - 我将完成管理员权限----------------
复制我的应用程序在启动文件夹中的链接我需要管理员权限。
如何仅为此命令请求管理员权限对话框。
所有其他功能都应该在没有管理员权限的情况下运行。
感谢您的帮助。
解决方案
参考答案 -
1. 管理员权限单一方法 [ ^ ]
2. 如何在程序启动时请求管理员权限? [ ^ ]
Hi,
I have the following question.
I would like by click on a button copy a link of my application to the user startup folder
-------here i needs admin rights ---------------------------
CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup) & "\FileName.lnk", My.Application.Info.DirectoryPath & "\FileName.exe")
-------here I will finished the admin rights ----------------
or for delete this link
-------here i needs admin rights ---------------------------
If My.Computer.FileSystem.FileExists(Environment.GetFolderPath(Environment.SpecialFolder.Startup) & "\FileName.lnk") = True Then
My.Computer.FileSystem.DeleteFile(Environment.GetFolderPath(Environment.SpecialFolder.Startup) & "\FileName.lnk")
-------here I will finished the admin rights ----------------
For copy the link for my application in the startup folder I needs admin rights.
How can I request the admin rights dialog only for this command.
All other functionality should be run without admin rights.
Thanks for your help.
解决方案
Refer the answers -
1. Admin rights for a single method[^]
2. How to request administrator permissions when the program starts?[^]
这篇关于Vb.Net:如何在运行时访问系统文件夹时获取管理员权限和管理员权限对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文