unrar with long file path - file

I have an .rar achive, when I use right click on file explorer, and use the menu "extract here", I can extract the files sucessfully. but when I use unrar.exe to extract the same achive, I got errors like can not find the specified path.
the path in problem is longger than 260 char.
my question is: how can I unrar a achive under bat file with long file path?

Related

Huffman compressed files with my own extension

I am working on a project that uses Huffman algorithm to compress files, and I am doing my project using Java, what I want is to create my own file extension say (.huff) for the compressed file, and when I right click a file if it has the (.huff) extension, I want to add a new option which decompresses it, I searched the web but I did not find anything useful.
Any help would be appreciated.
To set the file extension just use one of the String methods like append(".yourExtension") (append it to the filename) and set as filename. Simple as that.
String filename = filename.append(extension);
To decompress the compressed file, I suggest you write a metod to which you provide a path to file as argument, check if the file extension is correct and then in another method you decompress this file.
There is nothing special about a file extension, it's just a part of the file name. To create a .huff file extension, just add .huff to the end of the file name.
To add the windows context menu, that's explained in the question linked in the comments How can I add a context menu to the Windows Explorer for a Java application?
I would recommend creating a batch script that will launch your program taking in the file to decompress as an argument.
Something similar to:
#echo off
java -cp <path-to-jar> <decompression main class> %1
Adding in any other setup or program arguments you need. Then a registry entry might look like.
HKEY_CLASSES_ROOT\.huff\shell\Decompress huffman encoded file\command
"<path to batch file>" "%1"

Batch wildcards not accepted

How do I do reshacker -extract on all files in the system32 folder as well as get their filename and add .rc to the end of each output file.
reshacker.exe does not accept wildcards so im not sure what to do.
I have tried the following:
ResHacker.exe -extract C:\windows\system32\*.*, C:\resources\%1.rc, dialog,,
it is supposed to extract dialog data from each file in system 32 and save this data as %the_filename%.rc.

Opening all pdf files in a folder using cmd or bat file

I have a folder which have around 20 pdf files inside. Is there any way to open all the pdf in the folder in one shot like using something "* .pdf"?
IFF you are on Microsoft Windows and you have the correct association setup, you could do the following. Of course, there are other things to do like getting to or specifying the directory containing the .pdf files. If you put this into a .bat script, be sure to double the '%' characters on the variable.
FOR %f IN ("*.pdf") DO ("%~f")

Loading files into MAGMA

I'm trying to load files into MAGMA and am running into some trouble. Ostensibly, the command load "filename";should be sufficient. I've attempted, but keep getting the same result:
>> load "filename";
^
User error: Could not open file "filename" (No such file or directory)
The file is saved in my documents folder, so I'm not sure what the issue is. Do I have to specify the path? Save the file in a particular place?
I've tried reformatting, using both txt and rtf files, so I don't think that's the issue.
For loading file in MAGMA you can place your file in installed place folder. For example: C:\Program Files (x86)\Magma
Also if your file have an special format you should mention it.
Suppose You want loading a txt file with name a. with load"a"; you face with error. You must type load"a.txt";.
Try using GetCurrentDirectory() command to find your current directory location. And then you can use SetPath() to change where MAGMA has to be to search for your file. This will fix it.

Doing a batch file for first time

First time doing batch files, I don't even know how to do it. I need a batch file that given a path (say I:\FOLDER1\SUBFOLDER1\) will produce a text file showing all the subfolders in that directory as fully qualified paths.
Something like this:
I:\FOLDER1\SUBFOLDER1\SUBSUBFOLDER1
I:\FOLDER1\SUBFOLDER1\SUBSUBFOLDER2
I:\FOLDER1\SUBFOLDER1\SUBSUBFOLDER3
I:\FOLDER1\SUBFOLDER1\SUBSUBFOLDER4
...
If understand you are trying to list file path
dir/s/b *.txt
to redirect it into a text file
dir/s/b *.txt > textfile.txt
Help full Link

Resources