Search found 174 matches

by sambul35
05 Jul 2016 11:21
Forum: DOS Batch Forum
Topic: bat script with parameters and personalized message
Replies: 38
Views: 26975

Re: bat script with parameters and personalized message

how can I modify this script so that it can verify the validity of the full paths of the directories or the validity of the directories or files names independent of their existence Try to create it ( i.e. write it to disk ) - if it succeeds, then the name is valid, else not. Try to add your own co...
by sambul35
04 Jul 2016 18:10
Forum: DOS Batch Forum
Topic: bat script with parameters and personalized message
Replies: 38
Views: 26975

Re: bat script with parameters and personalized message

You should precise what you want to do... . I know from own experience, Der Hunger kommt beim Essen. I'm not sure to grasp how do you check the path\file validity, but its a cumbersome task anyway, probably just giving a draft example? I think he wants to enter data with batch arguments (parameters...
by sambul35
03 Jul 2016 11:25
Forum: DOS Batch Forum
Topic: bat script with parameters and personalized message
Replies: 38
Views: 26975

Re: bat script with parameters and personalized message

The user will have to write the absolute path of the directory because this script will have to be placed in a different directory than of work. The validity of the arguments will have to be compatible with that of symbols allowed by Windows 7 (or higher) for the creation of the file and directory ...
by sambul35
24 Jun 2016 11:24
Forum: DOS Batch Forum
Topic: bat script with parameters and personalized message
Replies: 38
Views: 26975

Re: bat script with parameters and personalized message

That's exactly what this script does. What error are you getting? :D
by sambul35
24 Jun 2016 11:04
Forum: DOS Batch Forum
Topic: bat script with parameters and personalized message
Replies: 38
Views: 26975

Re: bat script with parameters and personalized message

I want to find an alternative solution to the one mentioned above without using the goto command to create the cycle. To be fare, foxidrive gave you the solution sketch that addresses your problem. You need to add some meat to it, or at least post an ALGORITHM (not words) showing how do you envisio...
by sambul35
24 Jun 2016 10:27
Forum: DOS Batch Forum
Topic: One-liners for logical OR operator
Replies: 19
Views: 14425

Re: One-liners for logical OR operator

I just want to note that in my method you just need to add one line of code for each argument... Thanks for clarification. Both methods work great and have certain advantages each. I couldn't find such solutions anywhere on the web. Analyzing user input and batch arguments usually presents serious ...
by sambul35
24 Jun 2016 09:56
Forum: DOS Batch Forum
Topic: Analysing error text in FOR statement
Replies: 9
Views: 6849

Re: Analysing error text in FOR statement

@aGerman

Thanks for as always constructive feedback. Will try that. :wink:
by sambul35
24 Jun 2016 09:34
Forum: DOS Batch Forum
Topic: Analysing error text in FOR statement
Replies: 9
Views: 6849

Re: Analysing error text in FOR statement

That's a typo. The multilevel FOR version works well, but slow, so all I try to achieve is speed, and the below code is close to actual command. Further simplified the snippet for clarity, the problem is the same: I need to assign different errorlevels to both errors (reg query AND findstr) without ...
by sambul35
24 Jun 2016 07:58
Forum: DOS Batch Forum
Topic: Analysing error text in FOR statement
Replies: 9
Views: 6849

Re: Analysing error text in FOR statement

Thanks. It seems to be not a problem of breaking out (I can use Aacini's solution for that), but of identifying a condition WHEN to break out, i.e. analyzing the error TEXT in this case or a similar approach like assigning different errorlevels to the above 2 errors. Or may be its impossible in one ...
by sambul35
24 Jun 2016 07:36
Forum: DOS Batch Forum
Topic: One-liners for logical OR operator
Replies: 19
Views: 14425

Re: One-liners for logical OR operator

I do typos a lot more often. :wink: This one does work great in a quick test, including when an argument is a phrase like "Miami Beach".

While it works, I can't grasp the logic of this code. It seems to do call; (i.e. assign errorlevel to 1) regardless of the %%a value?
by sambul35
24 Jun 2016 07:05
Forum: DOS Batch Forum
Topic: Analysing error text in FOR statement
Replies: 9
Views: 6849

Analysing error text in FOR statement

I'm trying to optimize a code section for speed, the snippet is a part of another FOR loop with %%G parameter, and queries Win Registry for presence of certain values: for /l %%N in (0,1,9) do ( reg query "%key3%%%N"%valv3%" | findstr %%G 2>&1 && echo %%N || (find "ER...
by sambul35
24 Jun 2016 05:21
Forum: DOS Batch Forum
Topic: One-liners for logical OR operator
Replies: 19
Views: 14425

Re: One-liners for logical OR operator

@penpen This one doesn't work for me in Win10, other than for the 3rd argument: c:\Tests>test.bat Paris All arguments valid c:\Tests>test.bat Paris 2 key c:\Tests> What "set\[1\].*%~1" and call; are expected to do, and why there is no output to screen from FINDSTR?
by sambul35
23 Jun 2016 13:07
Forum: DOS Batch Forum
Topic: One-liners for logical OR operator
Replies: 19
Views: 14425

Re: One-liners for logical OR operator

Good point, which might feel like a Cmd bug. However, my question in the 1st post was a bit broader ("No" argument was with capital N), and not necessarily limited to REPLACE expression. Generally it seems beneficial to figure out a way to account also for capital letters in a restricted s...
by sambul35
23 Jun 2016 10:04
Forum: DOS Batch Forum
Topic: New/unknown behaviour in percent/delayed expansion
Replies: 8
Views: 7161

Re: New/unknown behaviour in percent/delayed expansion

Thanks for the explanation, sounds like very effective approach to variable match and replacement techniques. :wink:
by sambul35
23 Jun 2016 09:42
Forum: DOS Batch Forum
Topic: One-liners for logical OR operator
Replies: 19
Views: 14425

Re: One-liners for logical OR operator

I've played a little bit with multiple percentages/exclamationmarks in one single (delayed) expanded variable. Thanks for your investigation into the above approach, initially suggesting using an expanded batch or function argument as a SEARCH pattern in REPLACE strings. I'm still grasping all poss...