Followers 0

# Add Makecab and Expand in SendTo

## 71 posts in this topic

-----

EDIT january 9, 2006

-----

CAB Tool 1.8

Cabinet files compression/decompression program, including

Cabinet files creation from folders/subfolders.

v1.8

Better display of error messages.

New way for identifying Cabinet file. Instead of looking at the file

name, Cabinet files are recognize by SetupIterateCabinet API function.

XP Visual Style have been added on form (was not applied as supposed).

Cancel button added.

Improved installer.

-----

The batches and VBScripts are always available but I wrote a program to replace them called CAB Tool.

The program use the SendTo folder like the previous scripts but do not use EXPAND.EXE, MAKECAB.EXE or CABARC.EXE. All API.

Run on Windows 2000 and higher.

CAB Tool details

PECheckSum

Another SendTo folder program to edit checksum of PE files. Do the same as the -c switch of MODIFYPE.

This new version have one advantage over MODIFYPE: file modification date is not updated.

Edited by jdoe
0

#### Share this post

##### Share on other sites

cool what is %~dps1 just curious

0

#### Share this post

##### Share on other sites

@MCT

When you select a file and click on Makecab in SendTo folder (for example), %1 is passed to this batch (%1 is the full file path).

%~dps1 extract the short path name of the folder where the file is

%1 = d:\folder path\file.txt

then

%~dps1 = d:\folder~1\

0

#### Share this post

##### Share on other sites

oh, cool , i knew what %1 was, just not the other, thanks

0

#### Share this post

##### Share on other sites

Thank you I will make use of it

0

#### Share this post

##### Share on other sites

another script to makeCab a whole directory, output to parent folder, named folderName.cab, in cmdWindow or Explorer(install cmd in line1&2).

cmdWindow:

cabIt path\to\anyFolder

or without argument to cab current directory and output to parent directory.

cabIt

cabIt.js

0

#### Share this post

##### Share on other sites

@idle.newbie - nice script

You put your link to cabIt in context menu in this reg HKCR\Directory

Personnally I put Command Prompt Here in HKCR\Folder

Someone know the difference between these two reg. It looks like they do the same things.

I'm working on something like cabIt for the SendTo folder because I have so much things in Context Menu that's why I'm using SendTo to free some space.

----------------------

I made a modification to MAKECAB.CMD to prevent strange behaviors when selecting a folder by mistake or when the file size = 0

If you have previously downloaded these batch - re-download to make sure you have the good one.

0

#### Share this post

##### Share on other sites

i don't know the exactly difference, basically HKCR\Folder = HKCR\Directory + HKCR\Drive + and more(like some special shell folder), HKCR\Directory more physical directory, i like HKCR\Folder but not this case(my script may not work correct on specialFolder, and i don't want it to apply on DriveRoot).

SendTo's nice, but my script needs only a directory, SendTo works on File too, too lazy to check for file or directory.

0

#### Share this post

##### Share on other sites

Nice batches. You might want to not have it prompt the user for the modifype. Could just have it check for certain files, since not all are executable. Plus the programs need to be in the path, which not everyone knows how to do.

Something I did learn which I didn't know before is how you use modifype. I could never get it to work with the full path. Never tried making it short like you did. I always just did a pushd, then popd back. Still can't get the > NUL to work on it though.

One more thing shouldn't

IF %FSIZE%==0 GOTO END

be

IF %FSIZE% EQU 0 GOTO END

0

#### Share this post

##### Share on other sites

maybe you can help me with this jdoe, it looks stupid but...

@ECHO OFFdir %1 /-p /o:gn > %SYSTEMDRIVE%\Dir.txtPAUSE

... this will store the contents of the folder on a %SYSTEMDRIVE%\Dir.txt file, how can i store it in the same folder that i want to print the contents?

0

#### Share this post

##### Share on other sites

@sleepnmojo

Good idea, I will remove prompt and only check for file extension but what are the file that need a CRC header edits - I know EXE, DLL but what are the others (if any) ?

You're right that it's more logical to make numbers comparison with IF %NUMERIC% EQU X but it work with a strings comparison too.

The installer put these batch in system32 so they are in the path.

@SiMoNsAyS

This batch create DIR.TXT with a folder contents (%1) and prevent DIR.TXT to appear in it. Otherwise DIR.TXT would contain DIR.TXT in the listing because you put it in the same directory of the DIR %1 command.

@ECHO OFFIF EXIST "%~f1\DIR.TXT" DEL /F /Q "%~f1\DIR.TXT"DIR %1 /O:GN>"%TEMP%\DIR.TXT"MOVE "%TEMP%\DIR.TXT" "%~f1\DIR.TXT"

0

#### Share this post

##### Share on other sites

@jdoe thanks dude

just a bit of my taste but i preffer to add the /A /-P switches to the dir command

0

#### Share this post

##### Share on other sites

hi,

I installed your batch but i have a problem using it.

the expand command works perfectly, but when i wanna makecab my dll, the dll disappear like if it was deleted. Even any file i try to makecab vanishes.

Nobody knows what's happening ?

weeb,

0

#### Share this post

##### Share on other sites

@webservices, dll it's deleted by default. if you don't want to, remove this line from makecab.cmd

DEL /F /Q %1

0

#### Share this post

##### Share on other sites
hi,

I installed your batch but i have a problem using it.

the expand command works perfectly, but when i wanna makecab my dll, the dll disappear like if it was deleted. Even any file i try to makecab vanishes.

Nobody knows what's happening ?

weeb,

My guess is either you don't have makecab and modifype in your path, or something goes wrong in them. You can modify makecab.cmd and take out the del statement, and add a pause at the end to see whats happening.

@jdoe - you might want to do a errorlevel check before going on to the next step. modifype -> makecab -> del

0

#### Share this post

##### Share on other sites

I guess maybe it is cause i put ModifyPE.exe in system32 as i downloaded the file, but i see that in the vbs the file called is modifytype

FOR %%I IN (.EXE .DLL .SYS .OCX .CPL .COM) DO IF /I "%%I"=="%EXT%" MODIFYPE.EXE %~fs1 -c

I guess if i rename it to MODIFYPE.EXE it shoudl works. I will give it a try ....

Weeb,

Nope i tryed, still doesn't work. ummmm, maybe a path problem, but expand should not work as well, or it does.

0

#### Share this post

##### Share on other sites

@webservices

I made modification to batches. Now you will have a message if an error occurred. It's gonna be easier for me to know whats the problem.

Dont' forget that the original file is deleted, if you send a file to Makecab the file is deleted and a new compressed one is created.

If you want to keep the original file like SyMoNsAyS said, delete line DEL /F /Q %1

@sleepnmojo

ModifyPE don't return an error code but if you look at the batch, I found a workaround.

0

#### Share this post

##### Share on other sites

@jdoe

Thx for your fast updates, respect .... Thanks to your logs, i do suspect a corrupt profile. I have a fresh install in a VMware, i am gonna test it in here and give you a feedback.

here are the logs i got : The good part is that my files are not deleted anymore

Concerning teh expand focntion, i have no probleme.

1) makecab WINNT32U.DLL

Microsoft ® Cabinet Maker - Version 5.1.2600.0

Copyright © Microsoft Corporation. All rights reserved..

EnsureDirectory: Cant create file: C:\DOCUME~1\chirs\BUREAU\COMPBA~1\ADDMAK~1\NOUVEA~1\WINNT32U.DLL\CAB03540.TMP, errno=

2, _doserrno=3, GLE=3

ERROR: Path is invalid: C:\DOCUME~1\chirs\BUREAU\COMPBA~1\ADDMAK~1\NOUVEA~1\WINNT32U.DLL

Appuyez sur une touche pour continuer...

2) makecab winspool.exe

ERROR - MODIFYPE CAN'T PATCH winspool.exe

Appuyez sur une touche pour continuer...

EDIT : Ok i did a new try in a clean installation of XP, and i got the same error.

It's like a path problem, so maybe the fact my OS is french with accentuated letters, that put a mess in it.

I am waiting for your investigations ....

0

#### Share this post

##### Share on other sites

@webservices

Man you're not lucky, in fact there is 1 bug I can solve and 1 I can't.

1) WINSPOOL.EXE is not a Win32 executable file so it don't need a CRC header edits and by the way what kind of hacking are you doing on this file. You should not need to play with this file or there is something I don't know about this file. If you give me a good reason, I will try to do something for that.

2) For WINNT32U.DLL (and all Win32 executable file) the problem is a behavior of MAKECAB.EXE and it's not a path problem. It seem to be a french Windows problem (j'ai la même erreur que toi mais j'ignore si c'est le SP1 ou Windows francais). I have few ideas for solving this problem. I'm working on it...

0

#### Share this post

##### Share on other sites

i am sure you gonna make it .... I can still use a cmd btach to launch some makecab command when i need it. but your vbs is quiet cool and easy to use.

For the WINSPOOL.EXE, my fault, i just took an .exe without looking at if it was win32 executable or not. Sorry to have confused you. Who would like to hack that file ?

A french ? oh god, we are mad but not at this point yest

Catch you later on.

Weeb.

0

#### Share this post

##### Share on other sites

@webservices

Both problems are solved. The script will know what kind of file it is and will not display an error when there is none. I know there is no utility to decompress winspool.exe but anyway now you can decompress and recompress any file.

I made test with english and french Windows and it worked well. Let me know if you still have errors but I think this time it will be ok.

0

#### Share this post

##### Share on other sites

@jdoe.

sorry not to have responded to you earlier, but i have been away for a few days.

First of all, thx ever so much cause now it is working perfectly on my french OS, and be sure I am using your scipts for my custom XP cd.

Best wishes on your next developments .....

Weeb,

0

#### Share this post

##### Share on other sites

Is there a way to have the cmd file automatically make the file name uppercase when running makecab?

0

#### Share this post

##### Share on other sites

@webservices

Great

@RyanVM

I have tried to do so but there is a bug with the french character "é" - "É"

and I need these batch to work with both french and english Windows.

It's surely possible with an external .EXE program (a kind of renamer.exe) but I want a simple batch for that.

With no bugs with french characters I would do something like this to convert file name to uppercase...

SET UCN=%1SET UCN=%UCN:a=A%SET UCN=%UCN:b=B%SET UCN=%UCN:c=C%SET UCN=%UCN:d=D%SET UCN=%UCN:e=E%SET UCN=%UCN:f=F%SET UCN=%UCN:g=G%SET UCN=%UCN:h=H%SET UCN=%UCN:i=I%SET UCN=%UCN:j=J%SET UCN=%UCN:k=K%SET UCN=%UCN:l=L%SET UCN=%UCN:m=M%SET UCN=%UCN:n=N%SET UCN=%UCN:o=O%SET UCN=%UCN:p=P%SET UCN=%UCN:q=Q%SET UCN=%UCN:r=R%SET UCN=%UCN:s=S%SET UCN=%UCN:t=T%SET UCN=%UCN:u=U%SET UCN=%UCN:v=V%SET UCN=%UCN:w=W%SET UCN=%UCN:x=X%SET UCN=%UCN:y=Y%SET UCN=%UCN:z=Z%SET UCN=%UCN:é=É%SET UCN=%UCN:à=À%......

BTW this is working for the english Windows - if you want a makecab.cmd with this code in it let me know and I will post a makecab.cmd for english Windows only - for uppercase file name (compressed)

0

#### Share this post

##### Share on other sites

I'm in the US, so an English-only version doesn't bother me

0

## 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
Followers 0

• ### Recently Browsing   0 members

No registered users viewing this page.