From 11:00 PM CDT Friday, May 10 – 02:30 PM CDT Saturday, May 11 (04:00 AM UTC – 07:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WinRAR Command-Line tools not archiving in executable on Windows Server 2012

Solved!
Go to solution

Hello all,

 

I have developed a VI in LabVIEW 8.6 that uses WinRAR command-line tools (passed into the System Exec.vi) to archive data that is held on 5 different networked computers, and stores the resulting .rar files on a server.  The VI's executable runs perfectly on my development computer (running WinXP).  The data from each of the 5 machines is archived and the .rar files are stored on the server.  However, when I move the executable to the server where the .rar files will be stored, and run the executable, the command window flashes on the screen as if the WinRAR commands are being executed, but no data is archived onto the server.  No errors are passed out of the System Exec.vi.  The Server's OS is Windows Server 2012, and I have placed the Rar and UnRAR .exe's in the system32 folder on the server.  The server's firewall is disabled, and it is able to explore to the locations of the data to be arhived.  The server is logged in as a domain administrator account.

 

Here is an example of one of the command-line commands that I pass into the System Exec.vi:

 

cmd /c rar a -m5 \\selsacn11\viscom\selsvis01\15\07\20.rar \\selsvis01\Rep0\Archiv\15\07\20

 

When I manually type this command into the cmd line on the server, the data is archived correctly.  The problem only occurs when I run the executable on the server. 

 

I tried to work around the issue by creating a batch file containing the above command and then using the System Exec.vi to call this batch file.  Again, when I run the batch file manually, it works correctly, but when the System Exec.vi in a LabVIEW executable runs the batch file on the server, I get the same result as descirbed above -- no data is archived onto the server.  This batch file method does work on my development computer, and on my company laptop.

 

My only thought is that there is an issue with access rights.  So far the executable works correctly on an older server (Windows Server 2003), the development computer (Win XP), and my company laptop (Win7), but the executable does not archive the data on the Server 2012 server or on another computer running WIndows 7.  I have all of these machines logged in as the same domain administrator account, but IT networks are admittedly over my head, so I wanted to check here to see if anyone has seen this issue with WinRAR and/or the System Exec.vi.

 

Thanks for any info!

0 Kudos
Message 1 of 5
(8,264 Views)

When in your EXE was does the standard out, and error out return from the exec?  I'd suggest adding debugin indicators so when in an EXE you can see what the output is, along with what the input to the function is.

Message 2 of 5
(8,243 Views)

Thank you for the suggestion, Hooovahh. 

 

I had previously put an indicator on the System Exec.vi and there were no errors.  Per your suggestion, I did just put an indicator on Standard Output, and the following was returned every time the System Exec.vi was executed:

 

'rar' is not recognized as an internal or external command,

operable program or batch file.

 

To double-check the command line command, I manually typed one of the commands passed into the System Exec.vi into the command prompt, and there were no issues (attached: "Manual Execution.jpg).  There must be something wrong with my wiring of the System Exec.vi.

 

To test this, I put together a quick VI using just the System Exec.vi and one rar command (attached: "Single RAR Command.jpg").  This executable runs correctly with no errors on my laptop.  There is no message in the Standard Error or the Error Out of the System Exec.vi.  The Standard Output of the System Exec.vi on this simple executable says the folowing:

 


RAR 3.50   Copyright (c) 1993-2005 Alexander Roshal   3 Aug 2005
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Creating archive \\selsacn11\viscom\selsvis01\15\07\20.rar

Adding    \\selsvis01\Rep0\Archiv\15\07\20\01.txt                        100%  OK
Adding    \\selsvis01\Rep0\Archiv\15\07\20                                 OK
Done

 

However, when I run this executable on the server, I get no message in the Standard Output or in the Error Out, and the Standard Error says:

 

'rar' is not recognized as an internal or external command,
operable program or batch file.

 

This further leads me to believe that I am not using the System Exec.vi correctly, but I have been succssful in simple commands passed into the System Exec.vi such as "cmd /c dir," and I'm also still curious as to why I can call batch files with the System Exec.vi but not when the batch files contain the "rar" command.  Any ideas?

 

Thanks again! Smiley Happy

Download All
0 Kudos
Message 3 of 5
(8,198 Views)

Have you checked your path variable (echo %PATH%) on both machines?  Just make sure the path to the RAR executable is in there somewhere. 

 

You could also test by using the complete path to the RAR executable.  If I am relying on a third-party program like this I tend to track down the install directory myself (either automatically or have the user find it), and save it as part of the configuration.  When I go to call the program I then use the full path.  This way I am not relying on things like having the program installed in the same directory, or a specific location, or added to the path.

 

Oh, and if you are not actually trying to use a dos command you do not really need to open a command prompt, just call rar directly and drop the cmd /c part.

Message 4 of 5
(8,163 Views)
Solution
Accepted by topic author jruss85

Success!!!! Smiley Very Happy

 

Darin, I took your suggestions and after a little more fighting with it, I was able to an Error Code 2 out of the System Exec.vi.  This led me back to searching the forums where I stumbled on the following:

 

http://forums.ni.com/t5/LabVIEW/Problem-Using-quot-msg-quot-command-with-quot-System-Exec-vi/m-p/153...

 

Sure enough, every machine that had been able to run the executable is a 32-bit system.  Every machine that has been unable to run the executable is a 64-bit system.  I placed the Rar.exe in the C:\Windows\SysWOW64 folder on the server and it works exactly as intended now. 

 

I've been fighting with this for weeks, so I'm a bit disappointed that it was something so simple, but I'm very happy to finally have it working!

 

Thank you all very much for the help!!!

0 Kudos
Message 5 of 5
(8,120 Views)