|
Answer» Code: [Select]@echo off setlocal enabledelayedexpansion
call SET %cd%.var=!%%cd%.var%!works
echo !%cd%.var! I'm trying to echo the variable that was set in the fourth LINE of code. The output should simply read "works". I've checked and the variable is being set correctly. I just cant SEEM to echo it properly. Any ideas?
Thanks all.I think it is not going to work that WAY because the %cd% variable is going to have the colon CHARACTER ( which the SET command will try to use for string substitution. It looks like you are trying to set a variable for the current directory you are in? If so, you can modify your code to not include the ':' character ... something like Code: [Select]@echo off setlocal enabledelayedexpansion
call set %cd:~3%.var=!%%cd%.var%!works
echo !%cd:~3%.var!Quote from: GuruGary on January 15, 2009, 09:03:17 PM It looks like you are trying to set a variable for the current directory you are in?
Exactly.
Quote from: GuruGary on January 15, 2009, 09:03:17 PMI think it is not going to work that way because the %cd% variable is going to have the colon character ( which the SET command will try to use for string substitution.
With the output I was receiving, that makes perfect sense.
Your code works fantastically for my situation. Thank you for helping, I really appreciate it.
|