10-10-2018 08:30 AM
Hi,
I'm using System Exec.vi to execute a simple batch file which waits 3 seconds and exits:
"timeout /t 3 /nobreak"
I set the "Wait Until Completion" flag to TRUE but the VI returns immediately if I execute it on Windows 7 64bit. On Windows 10 64bit it works correctly. Do you know what could be the issue here?
VI was developed in LabVIEW 2015 SP1 32bit. Tested with LV18 with the same results.
*.bat extension is not allowed so I renamed the attached file extension to .txt.
10-10-2018 09:49 AM - edited 10-10-2018 09:51 AM
Try cmd /k
CMD /C Run Command and then terminate
CMD /K Run Command and then return to the CMD prompt.
BTW you do know that LabVIEW has a "Time Delay" function if all you need to do is wait 3 seconds.
10-10-2018 09:52 AM - edited 10-10-2018 09:54 AM
@LucianM wrote:
Hi,
I'm using System Exec.vi to execute a simple batch file which waits 3 seconds and exits:
"timeout /t 3 /nobreak"
I set the "Wait Until Completion" flag to TRUE but the VI returns immediately if I execute it on Windows 7 64bit. On Windows 10 64bit it works correctly. Do you know what could be the issue here?
VI was developed in LabVIEW 2015 SP1 32bit. Tested with LV18 with the same results.
*.bat extension is not allowed so I renamed the attached file extension to .txt.
Wire something to your outputs. You probably have some error that shows up in one of them, like the file wasn't found. It works fine for me. Whenever something doesn't work right with system exec, it's always useful to look at those outputs they give you.
10-11-2018 05:18 AM
I should have given more details: this batch file is not the actual file used in my app. This is just an example to simulate the execution of a batch file for 3 seconds. I need to wait until this batch file completes before I execute the rest of the code.
Standard error output is: "ERROR: Input redirection is not supported, exiting the process immediately."
Return Code = 1
Executing the batch file by double clicking on it in Windows Explorer, or by launching with Windows Run or with LabVIEW and System Exec.vi with Wait Until Completion set to FALSE, works as expected on both systems (Windows 7 and 10). If Wait Until Completion is TRUE, it does not work on Windows 7 64bit systems (tested on 4 already). Found out in the meantime that it also worked on a Windows 7 32bit computer.
@billko, I'm not sure I understood: the VI worked on your computer? If yes, what OS do you have? Did you execute the VI and saw the cmd window for 3 seconds and then VI finished execution?
10-11-2018 06:21 AM
Wire the "Set working directory", that has tricked me on several occations.
/Y
10-11-2018 07:52 AM
@LucianM wrote:
I should have given more details: this batch file is not the actual file used in my app. This is just an example to simulate the execution of a batch file for 3 seconds. I need to wait until this batch file completes before I execute the rest of the code.
Standard error output is: "ERROR: Input redirection is not supported, exiting the process immediately."
Return Code = 1
Executing the batch file by double clicking on it in Windows Explorer, or by launching with Windows Run or with LabVIEW and System Exec.vi with Wait Until Completion set to FALSE, works as expected on both systems (Windows 7 and 10). If Wait Until Completion is TRUE, it does not work on Windows 7 64bit systems (tested on 4 already). Found out in the meantime that it also worked on a Windows 7 32bit computer.
@billko, I'm not sure I understood: the VI worked on your computer? If yes, what OS do you have? Did you execute the VI and saw the cmd window for 3 seconds and then VI finished execution?
That is correct. I wonder if it had something to do with me hardwiring the path? (I cheated. Instead of concatenating the path, I just cut n pasted the path along with the file name.) The computer I ran this on was a Win10 machine.
10-11-2018 07:56 AM
I Googled the error and it seems to be related to that particular command. (So riddle me this, Batman? Why did it work on MY computer and not YOURS! PCs are a weird species.)
10-11-2018 09:18 AM
@Yamaeda wrote:
Wire the "Set working directory", that has tricked me on several occations.
/Y
I tried it already but the same:(
@billko, on Windows 10 is working also on my side. The problem appears only on Windows 7 64bit.
10-11-2018 02:52 PM
@LucianM wrote:
@Yamaeda wrote:
Wire the "Set working directory", that has tricked me on several occations.
/Y
I tried it already but the same:(
@billko, on Windows 10 is working also on my side. The problem appears only on Windows 7 64bit.
Oops, I read your first post. I'm an idiot.