If I understand ... this seems to work for me in Vista:
caller.bat
echo this is the caller echo initial value is: %reportfile% call setter.bat echo value is: %reportfile%
setter.bat
echo this is the value setter set reportfile=c:\report.txt
C: \ TEMP> subscriber
C: \ temp> echo, this is the caller
it's caller
C: \ temp> initial echo value:
initial value:
C: \ temp> call setter.bat
C: \ temp> echo this is a setter value
this is setter value
C: \ temp> set reportfile = c: \ report.txt
C: \ temp> echo value: c: \ report.txt
value: c: \ report.txt
updated to use goto instead of parens:
if not exist file.txt goto doit goto notfound :doit echo this is the caller echo initial value is: %reportfile% call setter.bat echo value is: %reportfile% goto end :notfound echo file found :end
source share