Search found 60 matches

by ©opy[it]®ight
20 Mar 2014 08:31
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

Re: FINDSTR + literal strings/double quotes and DelayedExpan

omg.. I would never be able to do this on my own, penpen (reading this, Squashman? ). And it even works under Win 7 I hope this stuff didn't keep you from sleeping? Does this escape all known (to-be-escaped) characters or is there more to it? I still have to learn a lot, but thanks to you (and other...
by ©opy[it]®ight
19 Mar 2014 10:20
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

Re: FINDSTR + literal strings/double quotes and DelayedExpan

For the record: I'm trying to parse a json file that can hold escaped strings/characters I don't think FINDSTR /R will work as i've noticed that strings can have [ ] brackets as well, where /R would see them as a RegEx Character class. With Disable DelayedExpansion all characters are preserved, but...
by ©opy[it]®ight
19 Mar 2014 06:10
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

Re: FINDSTR + literal strings/double quotes and DelayedExpan

Probably help if you spent a little more time on the forums reading some of the questions and solutions and assisting when you can instead of being gone for months and years at a time. True. But you must know that i've been googling A LOT and have been on many sites before i came here. Perhaps i co...
by ©opy[it]®ight
15 Mar 2014 17:06
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

Re: FINDSTR + literal strings/double quotes and DelayedExpan

Hmm.. i've been testing the code on a collection of json profiles, but i've run into a parsing problem where a profile has escaped double quotes in it (i totally forgot about this ) partly content of the json file: { "profiles": { "\"test\"": { "name": "\...
by ©opy[it]®ight
15 Mar 2014 15:57
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

Re: FINDSTR + literal strings/double quotes and DelayedExpan

Oh my, you're a walking encyclopedia/handbook :D

I greatly appreciate what you did penpen, this truly helps me a lot :) (where to give +rep?)

Thanks :wink:
by ©opy[it]®ight
15 Mar 2014 12:02
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

Re: FINDSTR + literal strings/double quotes and DelayedExpan

How about this: FOR /F "delims=" %%L in ('!SystemPath!FINDSTR /IC:"\"selectedProfile\": \"^" "!PROFILES!"') do (IF %ERRORLEVEL% EQU 0 ECHO FOUND) "!SystemPath!FINDSTR" /IC:"\"selectedProfile\": \"^" "!PROFILES!"...
by ©opy[it]®ight
15 Mar 2014 09:51
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

Re: FINDSTR + literal strings/double quotes and DelayedExpan

Thanks foxidrive for the quick answer/solution. I'm only afraid your code isn't strict enough, as you used some wildcards (.) which will make any character pass through as valid. To decrease the chance of false-positives, "selectedProfile": " should be treated as a literal search stri...
by ©opy[it]®ight
15 Mar 2014 09:29
Forum: DOS Batch Forum
Topic: FINDSTR + literal strings/double quotes and DelayedExpansion
Replies: 18
Views: 25877

FINDSTR + literal strings/double quotes and DelayedExpansion

Greetings DosTips addicts After hours of trial-and-error i've (once again) come to this place to hopefully get an explanation or solution for my FINDSTR batch troubles. I have a script that has both CommandExtensions and DelayedExpansion enabled. The purpose of the script is to search through a file...
by ©opy[it]®ight
24 Oct 2013 12:42
Forum: DOS Batch Forum
Topic: Convert an arguments-script into a stand-alone one?
Replies: 5
Views: 5536

Re: Convert an arguments-script into a stand-alone one?

One more question: Is it (also) possible to search for strings that are enclosed with double quotes? I didn't knew it wouldn't take these into account otherwise i would've mentioned it in the first place Thanks edit: I've found a solution by doing "\"%__PATTERN__%\"" but i'm not ...
by ©opy[it]®ight
19 Oct 2013 14:11
Forum: DOS Batch Forum
Topic: Convert an arguments-script into a stand-alone one?
Replies: 5
Views: 5536

Re: Convert an arguments-script into a stand-alone one?

That did the job for me! Thanks a lot aGerman! ps: i could've responded sooner, but i was playing around with the script/code and tried to modify it further to make it smaller, but i don't think that's possible =P Doing the same (or more) with less code is cool but can be tricky (e'specially for bat...
by ©opy[it]®ight
10 Oct 2013 09:31
Forum: DOS Batch Forum
Topic: Convert an arguments-script into a stand-alone one?
Replies: 5
Views: 5536

Convert an arguments-script into a stand-alone one?

Greetings everyone, I was looking for a script to do some RegEx string searching and found the following one at: - m @echo off set recurse= if "%~1%~2"=="%~1" goto :EOF if "%~3"=="" (set count=0 & %0 %1 %2 %2) for /f "delims=" %%f in ('findstr /m...
by ©opy[it]®ight
20 Sep 2012 10:30
Forum: DOS Batch Forum
Topic: Verify user-entered paths (unexpected ERRORLEVEL-behaviour)
Replies: 13
Views: 10144

Re: Verify user-entered paths (unexpected ERRORLEVEL-behavio

hmm, too bad you aren't in the mood to assist me with that ERRORLEVEL-madness :)
by ©opy[it]®ight
20 Sep 2012 10:07
Forum: DOS Batch Forum
Topic: Verify user-entered paths (unexpected ERRORLEVEL-behaviour)
Replies: 13
Views: 10144

Re: Verify user-entered paths (unexpected ERRORLEVEL-behavio

ok, back on-topic: I've made some progress with my script in regards to getting the expected errorlevels. The mistake was that i ECHOed the path, instead of testing it (facepalm). The below code works, and it even checks/removes trailing spaces, since those would simply echo the current state of ECH...
by ©opy[it]®ight
20 Sep 2012 09:24
Forum: DOS Batch Forum
Topic: Verify user-entered paths (unexpected ERRORLEVEL-behaviour)
Replies: 13
Views: 10144

Re: Verify user-entered paths (unexpected ERRORLEVEL-behavio

Of course that will only work if Java is installed to the default location. Not all of my users (including me) have Java installed there. Some of them don't even know where Java is (pre)installed. For that reason i've created a script, but because i'm getting unexpected/the wrong ERRORLEVEL results ...