以管理员身份运行bat文件 [英] Run bat file as administrator
问题描述
我开发了一个C#.Net应用程序。在我的应用程序中,我创建了一个批处理文件,它在窗口7 64位(SYSWOW64文件夹)中注册我的Dll文件。一切都在XP环境中正常工作,但是当我在Windows 7 64位中运行此应用程序时,它会出现错误,例如文件已加载但dllregisterserver调用失败,错误代码为0x80070005与dll注册功能相关。
当我以管理员身份手动运行批处理文件时,它可以正常工作。
有没有办法以编程方式运行批处理文件作为管理员?
如何设置批处理文件始终作为管理员运行?
I have developed one C#.Net application. In my application I have created a batch file which registers my Dll files in window 7 64 bit(SYSWOW64 folder). Everything is working correctly in XP environment but when I run this application in Windows 7 64 bit it gives error like "The file was loaded but the call to dllregisterserver failed with error code 0x80070005" related to dll registration functionality.
When I run batch file as administrator manually it works properly.
Is there any way to run batch file as administrator by programmatically?
How can I set that batch file run always as administrator?
推荐答案
检查: http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspx [< a href =http://chrison.net/UACElevationInManagedCodeStartingElevatedProcesses.aspxtarget =_ blanktitle =New Window> ^ ]
这篇关于以管理员身份运行bat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!