Jump to content

Recommended Posts

Posted

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!

Posted

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")

Posted
That's working for me!

Thanks!

 

Good to hear :)

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.

Guest
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...