LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview run time engine system exec restart command

Solved!
Go to solution

Hi, I am working on a project where I wanted a way that I could send a remote command to a computer to restart it. I found doing some research (system exec.vi), and that if a passed the command (shutdown -r -t 0) in the command line input. If I run the program as a VI in labview it works perfectly, but when I compile the vi into an .exe it does not restart or toss an err. The system has error handling that is set up to save any errors before restarting. Attached is how I have the case set up. What do I need to use to get this to work?

0 Kudos
Message 1 of 14
(3,358 Views)

There is nothing attached.

0 Kudos
Message 2 of 14
(3,352 Views)

sorry, failed to attach.

0 Kudos
Message 3 of 14
(3,350 Views)

What does the subVI lined up before it do? Since it seems to involve paths, maybe it throws an error (relative paths work differently in an exe).

Does it work if you run the exe as administrator?

0 Kudos
Message 4 of 14
(3,342 Views)

It is a basic VI that takes an array of error's that is stored in a global verible and writes it to a file. Attached is the VI.

0 Kudos
Message 5 of 14
(3,319 Views)
Solution
Accepted by topic author pwrobot

sometimes (often) I find that I have to prepend

"cmd /c" to a system exe to get the command line to work exactly as I want it in the runtime environment.

 

try cmd /c shutdown -r -t 0

(as well as clearing any errors on the input - wouldn't mind guessing you're getting error 8 or 7 out of that VI, but can't open it on my PC with the current version of LabVIEW.)

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 6 of 14
(3,298 Views)

that worked, Thank you.

0 Kudos
Message 7 of 14
(3,289 Views)

It is written in labview 2017, no error's have been tossed from it recently, just finished debugging it.

0 Kudos
Message 8 of 14
(3,285 Views)

I have attached the savedata vi printout for you to view.

0 Kudos
Message 9 of 14
(3,282 Views)

Glad your issue is solved

 

Have I missed something in your save VI???

Any reason for the Global "error array final" to update the "appended error array" - local in a race condition with the for Loop, and then the for loop to contain a complicated while loop doing indexing rather than just indexing the Global into the For loop?

(Harder to see the PDF rather than browse a LV2015 VI)

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 10 of 14
(3,275 Views)