Jump to content

Recommended Posts

Posted (edited)

For my next project I would like to send files with "alternate data streams" by email in ZIP format.
I can not use any external program like 7-Zip or WinRAR. (They would fitπŸ˜₯)
Who knows how to create a ZIP file with "alternate data streams" included with the Powershell command "Compress-Archive"? 

Here a test script:  (save as "ADSTester.cmd")

@rem Try to create a zip file with alternate data streams (ADS) included

@rem Housekeeping
@cls
@del ADSTester.zip >nul:
@RD /S /Q Extracted >nul:
@del ADSTester.txt >nul:
@rem End of Housekeeping

echo This is the ADSTester.txt file >ADSTester.txt
echo This is the ADSTester.txt:Part1 file >ADSTester.txt:Part1
echo This is the ADSTester.txt:Part2 file >ADSTester.txt:Part2

dir /r ADSTester.txt
@rem See the 3 files

@rem ****************************************************************
@rem ****************************************************************
@rem Please alter the next lines to include the alternate data streams.   
powershell Compress-Archive -Path .\ADSTester.txt -Update -DestinationPath ADSTester.zip 
powershell Expand-Archive -Path ADSTester.zip -DestinationPath .\Extracted\

dir /r Extracted\ADSTester.txt
@rem Only one file left :-(

pause

 

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Posted

Not sure if the Compress-Archive method will collect the stream data and embed it in an archive, then put it back in place when the file is extracted.  You might have to do a custom script to extract the stream data and add it to the archive, then a archive extraction process to "rebuild" the streams.  

I saw an article that says the RAR file format supports NTFS ADS, but haven't looked into it.

 

  • 2 weeks later...

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
Γ—
Γ—
  • Create New...