12-03-2018 05:33 AM
Hello
I want to start ROBOCOPY on the command line from an LabVIEW executable.
But the exe itself could also be replaced by this command.
Is it possible to start the system exec call, wait in there a bit, close the exe and then call the ROBOCOPY sequence? Basically the question is, if the system exec call is in an own process. According to this post it isn't a new process...?
Thanks in advance
12-03-2018 09:45 AM
Your use of the language is a bit misleading here. System Exec is indeed not a different process but a function inside LabVIEW to start a new process. And yes System Exec always creates a process according to the command line you pass in but most of that work is really done by Windows. So what was your question again?
12-03-2018 11:17 AM
Thank you for the answer, so it should be possible to create a new process with a system exec out of an exe - and the command(s) out of this command line instruction (like robocopy) is able to replace the exe itself (where the system exec has been started and closed right after)
12-03-2018 12:09 PM
It may be possible to use System Exec to launch a .bat file with "wait until completion" = FALSE to accomplish what you are looking for. Look into the "cmd /c start" command for command line. This will allow you to launch an instance of command line from System Exec, that command line instance then launches another instance of command line to execute the batch file. That will free up the LabVIEW exe process to perform it's shutdown, while the batch file runs in parallel. The batch file could have a "timeout /t 10" or so, to delay the robocopy instruction.
Depending on Windows policy settings, this may not be allowed through command line. You may have to instead implement a Powershell script equivalent. System Exec can be used to launch an instance of Powershell.exe with an optional input for a path to the specific .ps1 script file.