How to pass list of files to winrar/7z for archiving in cmd

  7zip, command-line-interface, rar, windows

Lets say I’ve a text file which contains paths to specific files e.g.

myFiles.txt

c:users%username%desktopfile1.pdf
c:users%username%desktopjunk.ppt
c:users%username%desktopimage.jpg
c:users%username%downloadsd1.dwg
d:someFolderrandom.exe
.
.
.
.
f:folder2codemyprog.cpp

How can I pass this list to rar.exe or 7z.exe so that it can archive these files e.g.

rar.exe myarchive.rar myFiles.txt
Or
7z.exe myarchive.zip myFiles.txt

Source: Windows Questions

LEAVE A COMMENT