weiglas Posted January 17, 2018 Posted January 17, 2018 Hi, I have a Lisp that paste a file in a folder that require admin access, but is not all users that have a admin access account. So, there is some way to get the admin access with Lisp? Like, write my admin username and password in the Lisp file, and when required, use these information? Thanks! Quote
ronjonp Posted January 17, 2018 Posted January 17, 2018 Perhaps something like this: (defun _grantuserfullpermission (folder / cacls wss) ;; https://stackoverflow.com/questions/2928738/how-to-grant-permission-to-users-for-a-directory-using-command-line-in-windows (and (vl-file-directory-p folder) (setq wss (vlax-get-or-create-object "WScript.Shell")) (findfile (setq cacls (strcat (getenv "windir") "\\System32\\icacls.exe "))) (vlax-invoke-method wss 'run (strcat cacls "\"" folder "\"" " /q /c /t /grant " (cond ((getenv "userdomain")) ((getenv "computername")) ) "\\" (getenv "username") ":(OI)(CI)F /T" ) ;;SSHHHHH 0 :vlax-true ) ) (and wss (vlax-release-object wss)) ) ;; (_grantuserfullpermission "C:\\Test") Quote
ronjonp Posted January 18, 2018 Posted January 18, 2018 That's working for me!Thanks! Good to hear Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.