我需要运行在AutoCAD / ZWCAD中需要提升权限的应用程序。
通过LISP,我可以使用以下方式运行应用程序:
(startapp "C:\\[path]\\Application.exe")
但是对于需要提升权限的应用程序,startapp
返回nil
,并且应用程序无法运行。
也尝试过:
(setq Shell (vlax-get-or-create-object "Wscript.Shell"))
(setq updater(vlax-invoke-method Shell 'Exec (strcat path "Appname.exe" ) ) )
(vlax-release-object Shell)
但是我得到了:
*error*: Automation error : WshShell.Exec : The requested operation requires elevation.
那么还有其他方法来运行需要更高权限的外部应用程序吗?
也许您可以尝试RunAs
?
(startapp "runas /user:administrator C:\\[path]\\Application.exe")
当然,系统会提示您输入密码。
您可以在这里找到替代方法:https://superuser.com/q/55809/60438