Its not tested, but this should help you:
@echo off
REM check if supplied file name actaully exists
IF "%1"=="" GOTO END
IF NOT EXIST "%1" GOTO END
REM define output file name. Use supplied files name without extension and add ".zip"
SET OutputPath=C:\Documents and Settings\vipul\Desktop\%~n1.zip
"C:\Program Files\WinZip\WINZIP32.EXE" -min -a -ex "%OutputPath%" files "%1"
copy "%OutputPath%" "C:\Documents and Settings\vipul\Desktop\My briefcase"
copy "%OutputPath%" "E:\Valuations\2009"
:END
This batch uses the first command line parameter (%1) as input for the file to package and copy.
The first IF
statements check if the file is valid. The SET
command set a variable with the name of the file to create (the zip file). The remaining part is mainly the code you already have, but now uses the variables.
EDIT:
To call the batch programm, lets name it package.bat
, use a syntax like this:
package "C:\Documents and Settings\vipul\Desktop\vipul.xls"
or
package "C:\Documents and Settings\vipul\Desktop\sanj.xls"
You can also use drag 'n drop and simply drop the file you want to process on the batch file package.bat
to start it.
If it doesn't work, add a comment.
EDIT:
To use this batch file in your send to context menu do the following steps:
- save the above code in a file and name package.bat (or anything else you want)
- put in a location you want.
- create a link to the batch file package.bat (right click on the file, chose create link)
- move the created link file to your Send to folder (e.g.
C:\Documents and Settings\vipul\SendTo
- now you can select any file you want and chose the batch file command from your context menu->send to
Hope that helps.