Jump to content

Right Click Tar Directories


jrb357

Recommended Posts

I always wanted to add a Tar function to the Right Click option for Directories. Getting the option to the shell is the easy part, but my problem is passing the parameter needed to tar.exe.

Here what i got going on so far:

Added tar.exe to system32, so it's easy to call.

Added Tar to the Right Click for the Directory Shell,

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Tar]

[HKEY_CLASSES_ROOT\Directory\shell\Tar\command]

@="tar.exe -C %1-cfv %1.tar %1"

But this isn't going to work, as %1 sends the full path. Seems i need a .bat to call tar.exe with the right parameter.

So for instance %1=C:\somedir\myfiles

The right commands to call tar.exe from a diferent directory would be like this.

tar.exe -C C:\somedir -cfv C:\somedir\myfiles.tar myfiles

So it looks like I need 3 variables

%a needs to get the path minus the last directory from %1

ie:C:\somedir for the -C switch from %1

%b needs to get the last directory from %1 only.

ie: myfiles directory out of %1

And %1.tar should work for the for the output file

So the final command would be like tar.exe -C %a -vcf %1.tar %b

Then i can just use this for the Right Click for the Directory Shell

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\Tar]

[HKEY_CLASSES_ROOT\Directory\shell\Tar\command]

@="tar.bat %1"

I'm just alittle lost on how to get those variables for the .bat. I get this figured out then the extraction part should be pretty easy.

Thanks in advance :)

Edited by jrb357
Link to comment
Share on other sites


Ok after some more playing around with this i got the Untar function to work fine. This is what I did as i also have Winrar installed..

Same as above, added tar.exe to system32

Then made the following reg mods:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.tar]

"PerceivedType"="compressed"

@="tarfile"

[HKEY_CLASSES_ROOT\.tar\PersistentHandler]

@="{098f2470-bae0-11cd-b579-08002b30bfeb}"

[HKEY_CLASSES_ROOT\tarfile]

[HKEY_CLASSES_ROOT\tarfile\shell]

[HKEY_CLASSES_ROOT\tarfile\shell\Open]

[HKEY_CLASSES_ROOT\tarfile\shell\Open\command]

@="\"C:\\Program Files\\WinRAR\\WinRAR.exe\" \"%1\""

[HKEY_CLASSES_ROOT\tarfile\shell\Un_tar]

[HKEY_CLASSES_ROOT\tarfile\shell\Un_tar\command]

@="tar.exe -vxf %1"

This will let you still left click to open a .tar file with Winrar and also add the option to right click and untar the file to directory you are working in.

Still can't seem to get the variables needed to make a .tar though.

Anyone gotta an idea on that ?

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...