How to make a shortcut to always "Run as Administrator"

조회 수: 462 (최근 30일)
KAE
KAE 2017년 6월 13일
댓글: Walter Roberson 2023년 12월 4일
I would like to change the default startup of Matlab to 'Run as Administrator', which is necessary for tasks like saving the path. I start Matlab from a desktop icon and would like to alter the icon properties so I always 'Run as Administrator'. Or if there is another way to make the default startup of any Matlab session to run as administrator, please let me know. I know this can be done via right clicking on Matlab from the Windows start menu, but would like to not have to take this extra step. I am using Windows 10 and running R2015b.
  댓글 수: 1
Adam
Adam 2017년 6월 13일
편집: Adam 2017년 6월 13일
I don't remember doing anything out of the ordinary with my shortcuts and I have no problem saving my path (Windows 10, R017b)

댓글을 달려면 로그인하십시오.

채택된 답변

Dimitris Iliou
Dimitris Iliou 2017년 6월 16일
Please keep in mind that this is a Windows workflow and not a MATLAB specific one.
What I would suggest is
  1. Go to the MATLAB icon
  2. Click on properties
  3. Go to the Shortcut tab
  4. Press Advanced..
  5. Check the "Run as administrator" checkbox.
  댓글 수: 1
KAE
KAE 2017년 6월 16일
편집: KAE 2017년 7월 11일
Works perfectly. I am delighted. Head's up though if anyone is trying this: If you run as administrator, you may no longer see mapped network drives from within Matlab, see here.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Daniel Dergance
Daniel Dergance 2023년 12월 3일
how do I Run as administrator from a MAC?
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 12월 4일
Run As Administrator is not MacOS or Linux concept.
The equivalent MacOS or Linux concept is to set the effective UID.
The API call for that is https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setuid.2.html#//apple_ref/doc/man/2/setuid or setreuid() -- but basically You Can't Get There From Here if you are starting out without special permissions .
The way to get special permissions is if your executable has already been marked as setuid which would usually be done using the chmod() system utility -- so you would use a shell command to chmod the executable to give it an effective uid of root. But you would not normally have permission to do that... so you would typically start by using the system utility sudo to grant you enhanced access to allow you to run chmod to set the effective uid on the executable that is to run with root priviledges.
Now... when an executable is marked setuid then the operating system puts special restrictions on it to make sure it does not abuse its power. One of the restrictions is that while the executable is running, it will ignore LD_LIBRARY_PATH and DYLD_LIBRARY_PATH and some internal @rpath stuff -- so it can only access dynamic libraries that are on the system library path. Which is potentially a problem.
And you have to mark the right executable... which is not always obvious in the MacOS app hierarchy.
You could try using Pseudo 1.2 as described at https://macdownload.informer.com/pseudo/ -- I used that utility from time to time a number of years ago. It is a utility that allowed you to drag and drop icons onto it, and it would launch the icon with elevated priveledges. But I suspect Pseudo 1.2 is likely a 32 bit program that cannot be used on current MacOS releases.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by