chuck4100 wrote:Oh well I suppose. I honestly have no idea to be more specific. I am speaking about some extremely basic things here and speaking at a kindergarten level is the only way to make it more simple, I just don't know how to make it happen in a batch.
It's a waste of time to help and that's why people still need help or don't know things.
It has nothing to do with "speaking at a kindergarten level".
Your request just is much to vague, so foxidrive has written
"I find your question a little unclear.";
in that post he sketched a part of a solution (to demonstrate his will to help you), and
also pointed out a problematic part (to demonstrate that details of your task are missing).
So in short he wanted you to provide more information;
according to the
linked sticky, it should be something like that:
1) What is the format of the files you want to process:
Is it "<name><no>-v(ersion)?<verison>(.<subversion>(.<build>)?)?(.exe)?" (in terms of regular expressions)?
Are these also possible: "file1.v2", "file3-v2.4.txt", "a file10-v-2.5", ...
(This is unclear because in your opening post you are using the filenames "file1-v2.5.exe" and "'file1-version2.5" {without the ".exe"}, so they are probably "fake names".)
2) Is the "<name>" restricted to alphanumeric characters ({'_', 'a' ... 'z', 'A' ... 'Z', '0' ... '9'}) only?
Is it allowed to contain any other subset of unicode?
Any special characters (for example ampersand, percentage sign, space character, ...)?
3) What should the batch do if there are multiple matches on the search phrase 'file1' for example on
"file1-v2.5.exe", "file10-v3.5.exe", "file11-v1.1.exe", "file12-1-v1.1.exe", "file12-2-v1.1.exe", ... .
Should it raise an error?
Should it set the environment variable to the first/last/... match?
Should it set n environment variable (and what's their naming convention?)
4) Are you using the word "parameter" (in your OP) for an environment variable, or do you really want to set a parameter in a batch file;
in this case which kind of parameter do you want to set:
- a "command line argument" of the called batch file (%0 ... %9 ...)
- a "command line argument" of a new batch file context ("call :label") (also: %0 ... %9 ...)
- a for variable (%%0, %%a, %%?, ...)
- really a parameter (and what's its syntax):
Code: Select all
yourBatch.bat /parameter1=defaultvalue /parameter2 /parameter3="var" /"parameter4=variable"
(...)
penpen