2

I need to create a batch file as per below requirements

1) pass path1 & path2 while running the batch file

exl: testrun.bat E:\ERP\test1.txt E:\ERP\header.txt

2) Need to store these command line paths values in batch file

exl: var1=E:\ERP\test1.txt var2=E:\ERP\header.txt

3) zip the path1 using PKZIPW.exe or 7z.exe and create new o/p zip file

exl: 7z.exe u -tzip E:\Erp\Test1.zip var1

4) copy path2 in newly created o/p file

exl: copy /b var2+test1.zip E:\Erp\Final_output.zip

1

Try this:

@ECHO OFF

SET var1=%1
SET var2=%2

E:\Erp\7z.exe u -tzip E:\Erp\Test1.zip %var1%
copy /b %var2%\test1.zip E:\Erp\Final_output.zip
  • Its giving below mentioned error "7z.exe is not recognized as internal or external command,operable program or batch file" – abhayk May 12 '15 at 9:51
  • 1
    7z.exe would be under program-files (perhaps x86). The script should use setlocal and temporarily extend PATH to address this problem. – Thomas Dickey May 12 '15 at 10:32
  • @Thomas Dickey : got it... as i was running the batch from desired folder locn so I skipped full path for exe.. but now as i'm passing full path and its working.. – abhayk May 12 '15 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.