Batch Script – Sending Items to the Recycle Bin Without Calling Any Third-Party Applications

While writing another larger script, I wanted the ability to send folders or files to the Recycle Bin, which I found out you can’t do natively via the command line without using some third-party apps or PowerShell.

I also found that when looping through a list of files in a batch script, it makes it really difficult to delete folders versus files because you have to either use the “del” command for files or the “rmdir” command for folders. With no simple way to differentiate between the two without a bunch of extra code, I kept looking for an alternative solution.
Continue reading “Batch Script – Sending Items to the Recycle Bin Without Calling Any Third-Party Applications”

Batch Script – Zip/Compress Files Without Calling Any Third-Party Applications

While writing another batch script the last several days, I found out that you cannot zip or compress files or folders natively from the command line without having additional third-party software or PowerShell. After a while of scouring the forums, I came up with this pure batch solution that uses VB script.

Basically, from this chunk of code in a single batch file, we can both generate the VB script, zip up whatever files we want, and then just delete the VB script when we’re done. Within the batch file, we can just call on the VB script using “CScript” and it works pretty much like any other function in any other programming language.
Continue reading “Batch Script – Zip/Compress Files Without Calling Any Third-Party Applications”