Mezlo
2011-03-28 17:10:42 UTC
OK, I've done Google searches and also searched this group but haven't
come up with a solution yet. I'm using 4NT 5.0 under Win 7 and am
trying to add an asterisk to the end of an environment variable.
Specifically I'm trying to do something like the following:
if not "%@RIGHT[1,%P]%"=="*" set %P=%P*
I've confirmed the IF test is working correctly, I just can't get the
variable modified. I've tried string functions like @INSERT, @SUBSTR,
and @LEFT but I'm obviously missing something.
Here is what I'm ultimately trying to accomplish. I will have a user-
created input text file similar to the following:
2GE10\0214
2GE11\0301
2GE11\0317
This is a list of possible folders. However, the actual folder names
will be something like "2GE11\0214-082.002". The user won't know the
last part of the folder name, just the start. Somehow I need to take
the input text file and end up with an output text file with the
actual folder names (there may be more than 1 folder matching each
input string). I was planning to use "DIR /B" which is why I need the
asterisk on the end. I will then take that ouput file and use it in a
FOR loop to copy the included folders to another drive.
I would appreciate any help you can provide. I can handle most of the
actual batch file. I'm just stuck on this one part.
Mez
come up with a solution yet. I'm using 4NT 5.0 under Win 7 and am
trying to add an asterisk to the end of an environment variable.
Specifically I'm trying to do something like the following:
if not "%@RIGHT[1,%P]%"=="*" set %P=%P*
I've confirmed the IF test is working correctly, I just can't get the
variable modified. I've tried string functions like @INSERT, @SUBSTR,
and @LEFT but I'm obviously missing something.
Here is what I'm ultimately trying to accomplish. I will have a user-
created input text file similar to the following:
2GE10\0214
2GE11\0301
2GE11\0317
This is a list of possible folders. However, the actual folder names
will be something like "2GE11\0214-082.002". The user won't know the
last part of the folder name, just the start. Somehow I need to take
the input text file and end up with an output text file with the
actual folder names (there may be more than 1 folder matching each
input string). I was planning to use "DIR /B" which is why I need the
asterisk on the end. I will then take that ouput file and use it in a
FOR loop to copy the included folders to another drive.
I would appreciate any help you can provide. I can handle most of the
actual batch file. I'm just stuck on this one part.
Mez