LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec call as own process

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

0 Kudos
Message 1 of 4
(2,307 Views)

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?

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 4
(2,273 Views)

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)

0 Kudos
Message 3 of 4
(2,263 Views)

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.

0 Kudos
Message 4 of 4
(2,257 Views)