ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec (Batch File) Can't run batch file

Hello,

I've been trying to launch a batch file located in "C:\Windows\System32", when I run the VI the cmd display: 'p4toHIL.bat' is not recognized as an internal or external command, operable program or batch file. When I use the command "dir *.bat" says that the File Not Found, you can see this in the next image:

CMD from LV.JPG

Also when I launch the batch file using the cmd from windows (windows+R) the batch file runs, also if I use the command "dir *.bat" the files are displayed as you can see in the next image:

CMD from Windows.JPG

 

I think that the issue is that LV launch the cmd without admin rights, Somebody Know How Can I access with the admin rights? I've tried to use the command runas but is not working. 

 

Also if I locate the batch file in another path for example C:\ the bath works but I need that te file run from  "C:\Windows\System32" 

 

The VI that I have been using is attached.

 

Thank you in advance!!

David Espinosa

 

0 Kudos
Message 1 of 4
(4,482 Views)

Hi David,

 

just a wild guess:

Maybe Windows is fiddling with the folders due to the bitness of the calling task (in your case: LabVIEW)!? When using a 64bit environment you might get shown other paths/files then is shown for a 32bit process. This is especially done in the "Windows-internal" folders like "system32"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(4,457 Views)

I think you are better to run everything from LabVIEW... Admin right are not cool to deal with in LabVIEW. or run LabVIEW as administrator and then call the batch file.

0 Kudos
Message 3 of 4
(4,456 Views)

Was there ever a solution to this?  I'm running LabVIEW 2018 on a Windows's 10 box and the .bat file I'm trying to run won't launch.  It will run if I start it from the command prompt.  I've tried several flavors of strings to launch the .bat file.  The cmd window opens up but is blank.  See attached.

Download All
0 Kudos
Message 4 of 4
(3,890 Views)