Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Code help need please.

Featured Replies

Hi

I am in need of some help with a routine that will compress system files, is there anyone here willing to help with a routine that will use Makecab to compress system files?

I am having problems at the moment as the path to the files that needs compressing has spaces in them and the routine i am using will not work.

This is the only thing that is holding me back at the moment.

Many Thanks for any help.

Regards

Worf

Edited by Worf

Try this script, this script was placed in the same folder as the files I was testing makecab on.

Here is the path and file names I tested with this script.

E:\Test Make Cab\Tick Tick Boom(The Hives(Rock_2007)).wmv
E:\Test Make Cab\Stuck In The Middle With You(Stealers Wheel(Pop_1973)).wma
E:\Test Make Cab\Chop Suey(System Of A Down(Rock_2001)).wma

Save As TestMKCab.vbs

Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Fld :Set Fld = Fso.GetFolder(".")
Dim F1
For Each F1 In Fld.Files
If InStr(LCase(F1.Path),LCase(".vbs")) Then
Else
Act.Run( _
"%Comspec% /c @Echo Off && CLS && COLOR F3 && MODE 89,9 && " & _
"makecab /D CompressionType=LZX /D CompressionMemory=21 " &_
Chr(34) & F1.Path & Chr(34)),1,True
End If
Next

I wrote 2 vbs script that will makecab and expand files. All you have to do is drag a file onto the script.

Save As DragDropMkCab.vbs

Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Col, Obj
If Wscript.Arguments.Count = 0 Then
Act.Popup "This needs a file drag on to this script.",0,"No File Error",4128
Else
For Each Col In Wscript.Arguments
If Fso.FileExists(Col) Then
If Right(InStr(Col,"."),5) Then
Set Obj = Fso.GetFile(Col)
Act.CurrentDirectory = Fso.GetParentFolderName(Obj.Path)
Act.Run( _
"%Comspec% /c @Echo Off && CLS && COLOR F3 && MODE 89,9 && " & _
"makecab /D CompressionType=LZX /D CompressionMemory=21 " &_
Chr(34) & Obj.Path & Chr(34)),1,True
End If
End If
Next
End If

Save As DragDropExpand.vbs

Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Col, Obj
If Wscript.Arguments.Count = 0 Then
Act.Popup "This needs a file drag on to this script.",0,"No File Error",4128
Else
For Each Col In Wscript.Arguments
If Fso.FileExists(Col) Then
If Right(InStr(Col,"_"),1) Then
Set Obj = Fso.GetFile(Col)
Act.CurrentDirectory = Fso.GetParentFolderName(Obj.Path)
Act.Run( _
"%Comspec% /c @Echo Off && CLS && COLOR F3 && MODE 89,9 && " & _
"EXPAND " & Chr(34) & Obj.Path & Chr(34) & " /R"),1,True
End If
End If
Next
End If

  • Author

Hi gunsmokingman

Thank you for your scripts. I was looking for an actual Visual Studio routine that would get a list of files from a folder and then compress then files into another folder.

  • Author

Thank you gunsmokingman

I am very greatful for you to take you time writting this routine. I will integrate this into my program and once that is done i can then get on with the next part.

Many Thanks

Worf

  • 9 months later...
  • Author

Thanks gunsmokingman

Please Close this thread.

Worf, although you may no longer have a need to re-visit it, the topic may remain useful to others and will therefore remain open for future additions.

I am obviously missing something here :ph34r:, but for the little good it may be :unsure:, this batch does provide drag 'n drop makecabbing:

dragncab.cmd

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS
SET File=%1
SET FilePath="%~dp1"
SET FilePath=%FilePath:~0,-2%"
SET FileExt=%~x1
SET LastChar=%FileExt:~-1,1%
IF %LastChar%.==_. (Extrac32.exe /Y /L %FilePath% %File%) ELSE (makecab %File% /L %FilePath%)

jaclaz

Worf this wasnt for your project, this was more to see if could code a drag and drop app.I know in vbs there a limit to how many items can be drag and drop on to it, I think it limit is 24 items. I dont know if that limit exists in cmd promt, but in Vb.net I have not hit a limit yet.

I am obviously missing something here

jaclaz the purpose of thread like these are to help people to learn new things.

For jaclaz code only

The flaw is that they appear to run makecab on any file which doesn't end with an underscore

That didnt happen on mine because of this line

If Not Microsoft.VisualBasic.Right(I, 1) = "_" Then

I have updated this app and started a new Thread

New App

New Source Code

I also created a 'packaged' batch file a couple of years ago to provide this functionality.

I wasn't going to include the above link, but decided to do so due to a potential flaw in the posted versions. The flaw is that they appear to run makecab on any file which doesn't end with an underscore; mine will 'hopefully' run it on any file which is not already 'cabbed' in the directory, (and upon success delete the 'un-cabbed' version). Cabbed files are not required to use the trailing underscore character and obviously .cab files may also exist in the selected directory.

  • 4 weeks later...

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.