rogerdjr
asked on
Passing a variable from Excel to a batchfile
Running a batch file from excel
The code in excel is:
set arg1 %1
if [%1] equ [] set arg1=%cd:~0,1%
echo "Test" %arg1%
echo %arg1%:\ZZZ\ZIP-BAT\source -zip.txt
dir e:\ZZZ\Zip-Bak\DayBkup\hm1 8*.zip>%ar g1%:\ZZZ\Z IP-BAT\sou rce-zip.tx t
dir %arg1%:\ZZZ\Zip-Bak\DayBku p\hm*.zip> %arg1%:\ZZ Z\ZIP-BAT\ dest-zip.t xt
The Dos batch file content is
set arg1 %1
if [%1] equ [] set arg1=%cd:~0,1%
echo "Test" %arg1%
echo %arg1%:\ZZZ\ZIP-BAT\source -zip.txt
dir e:\ZZZ\Zip-Bak\DayBkup\hm1 8*.zip>%ar g1%:\ZZZ\Z IP-BAT\sou rce-zip.tx t
dir %arg1%:\ZZZ\Zip-Bak\DayBku p\hm*.zip> %arg1%:\ZZ Z\ZIP-BAT\ dest-zip.t xt
I get an error Environment variable not defined (see attached screen shot)
Need help
Thanks
Dos-Batch.JPG
The code in excel is:
set arg1 %1
if [%1] equ [] set arg1=%cd:~0,1%
echo "Test" %arg1%
echo %arg1%:\ZZZ\ZIP-BAT\source
dir e:\ZZZ\Zip-Bak\DayBkup\hm1
dir %arg1%:\ZZZ\Zip-Bak\DayBku
The Dos batch file content is
set arg1 %1
if [%1] equ [] set arg1=%cd:~0,1%
echo "Test" %arg1%
echo %arg1%:\ZZZ\ZIP-BAT\source
dir e:\ZZZ\Zip-Bak\DayBkup\hm1
dir %arg1%:\ZZZ\Zip-Bak\DayBku
I get an error Environment variable not defined (see attached screen shot)
Need help
Thanks
Dos-Batch.JPG
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.