LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Command prompt calls from executable

I need to shut down my computer when Labview closes. So I wrote a VI that just calls cmd with the line: "cmd /k shutdown -s -f -t 1". Runnnig this from a VI in labview works, it shuts down the computer. But when I try to just build an executable from the file and run it the call doesn't work....the computer doesn't close down.

 

Any ideas about differences in cmd calls from within LAbview and from an executable made in a Labview project? 

0 Kudos
Message 1 of 6
(3,006 Views)

Just a wild random guess: Does it work differently if you run the executable as administrator (right-click ... run as administrator).

0 Kudos
Message 2 of 6
(3,003 Views)

Oh man I thought you were on to something there....but nop....still not working from an executable..

 

Thanks for trying though! 

0 Kudos
Message 3 of 6
(2,987 Views)

the help states that you should be using \c instead of \k


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(2,982 Views)

I agree with crossrulz in which the /k is most likely the cause of your issue. Try removing the "cmd /k" altogether and just type "shutdown -s -f -t 1". I have successfully ran this code on an executable deployed on a Windows 7 embedded device.

 

Hope this helps.

 

Cory

0 Kudos
Message 5 of 6
(2,954 Views)

So strange. It doesn't work for me. So what I did instead was to keep the cmd comand in a VI by it self and from the exe file I call the VI by referense and that made my computer shut down....but if I called the same VI within the exe it doesn't work still....running 2014...

 

Thanks for all the sugestions though! Don't know what is different in my system for it not to work.

 

Cheers

HS

0 Kudos
Message 6 of 6
(2,905 Views)