LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run command prompt as administrator using system exec.vi

Solved!
Go to solution

I have an application that will not stay open unless it is run through command prompt as an administrator.  I have found a way to add a shortcut to my desktop in order to open it (Administrator: Elevated Command Prompt) but not sure how to programically open this program.  Does anyone have a quick and easy solution to this?  I would like to open the Administrator: Elevated Command Prompt and then start writing my commands. 

Thanks!!

-ncm
0 Kudos
Message 1 of 18
(20,276 Views)

Hi ncm

See tha image, in the shortcut go to Properties/advanced in select the Run as Administrator option.

I hope it helps you

Message 2 of 18
(20,253 Views)

So the name of my shortcut is Elevated Command Prompt so I did the following with no luch even opening up the file...  any suggestions? 

trial snippet.png

-ncm
0 Kudos
Message 3 of 18
(20,224 Views)

You need the extension of the shortcut "Elevated Command Prompt.XX" and also be sure of the path, go to properties/general in the shortcut

0 Kudos
Message 4 of 18
(20,221 Views)

Capture.JPG

 

Here are my properties, I changed my program to this and the command prompt closes immediatly and doesn't open desktop shortcut (which is technically a command prompt shortcut with administrator rights that I made, I followed:

http://www.sevenforums.com/tutorials/3718-elevated-command-prompt-shortcut.html)

 

Retrial snip.png

 

I know it should be something easy that I am missing again but I am stumped.....

 

-ncm
0 Kudos
Message 5 of 18
(20,214 Views)
Solution
Accepted by topic author ncm

fix the command line with:   cmd /r "Elevated Command Prompt.lnk"

Message 6 of 18
(20,210 Views)

You have saved the day!!

Thank you very much, I knew it should be simple but just couldn't see the forest cause of the trees Smiley Very Happy

-ncm
0 Kudos
Message 7 of 18
(20,206 Views)

Awesome, good luck with your project

0 Kudos
Message 8 of 18
(20,203 Views)

That worked exactly how I asked but am finding out that is not what I need.  It opens the program but I want to programmically run commands on the Elevated Command Prompt.  Any ideas on how to do this?  I am trying to do this all programmically so that the user only has to run LabVIEW and not actually type anything into the command prompt.  An example of commands that I want to run in the Elevated Command Prompt are:

cd /

cd "Program Files (x86)"

 

and other commands.  The reason that I can't use a regular command prompt is that the program will only run out of one with Administrative rights, and that is why I am trying to use the Elevated shortcut because it has administrative priveledges saved in the shortcut. 

 

Any suggestions?

-ncm
0 Kudos
Message 9 of 18
(20,181 Views)

Batch file.

0 Kudos
Message 10 of 18
(20,174 Views)