Jump to content

Get admin access with autoLisp


Recommended Posts


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?



Link to comment
Share on other sites

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 ")))
 (strcat cacls
	 " /q /c /t /grant "
	 (cond ((getenv "userdomain"))
	       ((getenv "computername"))
	 (getenv "username")
	 ":(OI)(CI)F /T"
 (and wss (vlax-release-object wss))
;; (_grantuserfullpermission "C:\\Test")

Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...