LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

WinRAR Command Line using System Exec.vi

Solved!
Go to solution

I am trying to code a program that will RAR an a folder that contains many subfolders with files in them.  WinRAR allows for command line codes to be sent to control WinRAR through the command prompt (I have this working well).  What I want to do, is integrate this command line code through the command prompt into a vi.  I have tried using the System Exec.vi, but with very little luck.  I have set the path for winrar tools to be present at that directory and I have used the "cmd /c" string before my input so that LabVIEW knows its a DOS command.  I keep getting an error message that says " 'winrar' is not recognized as an internal or external command, operable program or batch file."  I have tried moving the command line codes to the standard input and even the winrar code to that input as well (this only leaves the "cmd /c" as the command to be sent), still no dice.  Any suggestions would be most useful.  I can provide my code and a list of the command line codes for WinRAR if you need it.  Other zipping programs would be another option to take that I am open to, as long as it can be controlled within the LabVIEW environment and that the compression is best.


Thanks in advance!


A

0 Kudos
Message 1 of 11
(8,314 Views)

Hi II Papu,

can you show the System Exec call or a picture of it? It would be very helpful. I'm sure it will work, but if not you can try to insert your code into a batch file and call this with the System Exec function.

 

Mike

0 Kudos
Message 2 of 11
(8,291 Views)

Hi A,

 

have you tried to use the command line tool "rar" instead of the WIndows GUI WinRAR?

Usually you have to use the command line tool to allow for any switches...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 11
(8,286 Views)

The code I insert to the command line is "cmd /c winrar a -r "archive name" "Folder to read within the working Dir""

 

The a is to tell it to create an archive and "-r" is telling it to consider the structure within the folder and include all of it within the archive.


Thanks!

Message 4 of 11
(8,285 Views)

Just tried the "rar" command within the system exec vi and still no dice.  Thanks for the suggestion!

 

A

0 Kudos
Message 5 of 11
(8,282 Views)

Il Papu wrote:

I keep getting an error message that says " 'winrar' is not recognized as an internal or external command, operable program or batch file." 


This indicates that you have to provide the full path to the executable that you want to run. Have you tried that?

Message 6 of 11
(8,251 Views)
Solution
Accepted by topic author Il Papu

smercurio,

 

Thanks!  This actually worked.  What I had to do to get this to work was modify the command going into system exec vi.  

 

This is what it looks like:

 

"<directory pointing to winrar.exe>"  "<winrar commands and comments (these can be found in the help)> 

 

Thanks again!  This will save me loads of time!

 

The big thing here that I learned was the removal of cmd /c for this.


A

0 Kudos
Message 7 of 11
(8,249 Views)

Il Papu wrote:

smercurio,

 

Thanks!  This actually worked.  What I had to do to get this to work was modify the command going into system exec vi.  

 

This is what it looks like:

 

"<directory pointing to winrar.exe>"  "<winrar commands and comments (these can be found in the help)> 

 

Thanks again!  This will save me loads of time!

 

The big thing here that I learned was the removal of cmd /c for this.


A


Another option might be the use of the OpenG LVZIP library. It is supported on Widnwos, Mac OS X and Linux so fairly cross platform. It does its work by using an external shared librarey created from the zlib library from Jean-loup Gailly and Mark Adler and and the according ZIP file extension from Gilles Vollant

 

You can best download the VIPM here and get the oglib-LVZIP library and the necessary support libraries (file and error). VIPM uses this library too as its VI packages are really ZIP files with a specific internal file structure.

 

Rolf Kalbermatter

Message Edited by rolfk on 05-03-2009 08:57 PM
Rolf Kalbermatter
My Blog
Message 8 of 11
(8,199 Views)

I had try to use winRAR Command Line with System Exec. And send command like this:

"PathToWinRar" a SomeKeys -ac -ao "File.rar" "folderToCompress"

Keys -ac -ao adds files to archive if they "archive" attribute set to True, and set this attribute to false in file.

And this works, but winRAR ignore this attribute with .tdm files and add they to archive every time. What is wrong?

0 Kudos
Message 9 of 11
(4,486 Views)

When you run the command you posted separately from the Exec VI (on the command line), do you see the same behavior?

0 Kudos
Message 10 of 11
(4,472 Views)