Need a little more assistance here please I am just a little way from completing my script but can't seem to figure this last piece out.
Background:
I need to compare a command output \\\\%%A\\%B
to a preset "exclusion list" to compare whether or not the process is already running on a different script. I have a file that stores logs of files locations that had errors copying over. This log file is parsed and all the file locations are stored (on the fly) into %%A
and %%B
. The exclusion list says which files are already being copied manually based on known issues. This script needs to skip these files and copy the rest.
Requirement:
I need to compare the results of %%A\\%%B to \\root\\path and see if the string matches (before the file). If it does then I need to flag it.
Code:
This is what I have so far:
cd C:\logs
for /f "tokens=2* delims=\" %%A in (err.log) do (
if not \\%%A\%%B==%BACKUPDIR% (
if not \\%%A\%%B==%TEMPLATEPATH%\* (
for %%I in %PSTNAMES% do (
if not "\\%%A\%%B"=="%NASDIR%\%%I PST\"* (
echo %NASDIR%\%%I PST\*
@echo \\%%A\%%B
) else (
echo false
)
)
)
)
This should give you an idea of what needs to happen I am also trying to fit in the comparison code:
If NOT "%somepath%"=="%somepath:some_exclusion=%" (
echo continue
) else (
echo don't continue
)
EXTRA:
Now the first set of code would work if I just had the paths to work with but because it includes file names the comparison doesn't match up. So to get this working I guess there are two avenues.
"%somepath%"=="%somepath:some_exclusion=%"
working The issues I am coming across are:
%somepath%
won't work because I can't seem to store %%A
as a variable like %var%
Please help
if you try to use wildcards with if
: this won't work.
but instead of
if mouse==mouse*
you can use
echo mousetail | find "mouse" && echo yes || echo no
(showed just the basic principle; findstr
has some useful features, like "start of string": findstr "^mouse" - see
findstr /?` for more)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.