From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-29-2011 12:39 PM
When I enter "shutdown /f /t 0" into the input, system exec just won't execute this command and returns a generic error. This command is used to restart the operating system and it's located in %windir%\system32\ folder. Other commands from this folder works fine, e.g., taskkill, ipconfig, etc.. But why not "shutdown /f /t 0"? Anyone have any suggestion? A screenshot will do just fine. Thanks.
04-29-2011 01:06 PM
And that generic error that you get would be?
Have you tried prepending "cmd /c" to the command?
04-29-2011 03:01 PM - edited 04-29-2011 03:03 PM
When wiring "shutdown /f /t 0" into the input and get a generic error of code 2 msg: system exec.vi command "shutdown /f /t 0".
When wiring "cmd /c "shutdown /f /t 0" into the input, I get no error but a msg of shutdown is not recognized as an external or internal program.
When wiring "cmd /c "%windir%\system32\shutdown.exe /f /t 0" into the input, I get no error but a msg of c:\windows\system32\shutdown.exe is not recognized as an external or internal program. But that's not true because that file exists.
system exec.vi is always a struggle for me because it's never working too accurately. Some windows command works some don't. For example, ipconfig & taskkill goes through just fine.
If you would like to see how the restart command works, just go to your command prompt, type in "cmd /c "shutdown /f /t 0"" or "shutdown /f /t 0""and you'll see it works.
04-29-2011 04:27 PM
I know what the shutdown command is - I use it all the time for remote connections.
That error code is what Windows is returning, not LabVIEW. Windows is telling you it can't find the file. Remember that System Exec is basically equivalent to entering a command in the Start -> Run window, not a command window. Thus, do you get the same issue if you do it there? Another question: are you wiring it to the "command line" input? Are you setting the "working directory"? If so, don't set the working directory. Have you checked your PATH environment variable?
04-29-2011 08:32 PM
If you are using a 64-bit OS, the problem this user had may be your problem.
05-02-2011 06:14 PM
Hey lavalava,
I second Matthew, and Kudos to him for beating me to the post! This sort of system exec issue, especially one dealing with a primitive command like shutdown, is almost always due to a 32-bit application being called in a 64-bit OS. Here is a link to the Microsoft information on how to properly format the command, and the reason for the error. Let us know if that doesn't work for you. Have a great evening!
05-02-2011 08:32 PM
@Matthew Kelton wrote:
If you are using a 64-bit OS, the problem this user had may be your problem.
Ooooh... good point.