
I am interested in which method is used at the first stage, because it helps in understanding what is going on when it is given something on the command line, to make more sense of a bunch of cases of why a program might give an error when passed something. maybe they used GetCommandLine() maybe CommandLineToArgv(), why am I looking into that? To answer a question asked in comment, of why am I interested in which method the app uses. I think that's what might be happening, but i'd like to verify if that's correct?Īnd correct that the/that windows implementation of grep uses GetCommandLine(), and findstr use argsv? And rather than add the, it says invalid and deletes it. Then, assigning that to an element of an array, is similar to assigning it to a variable. So it looks like with argv, if it just receives a ", which it would if at the shell, ^" was written. If on the other hand, a program uses argsv, then ^" isn't sufficiently escaping the quote C:\>echo a^"b | findstr ^" If a program uses GetCommandLine(), then ^" is sufficiently escaping the quote. The arguments passed as an array, to the main procedure of the program.Īnd so one can see what a program would see, whether it used GetCommandLine(), or argv. The other option, which a non-windows implementation would use, or which a windows program could use, is that argv array. I have these programs from a while back C:\blah>type w.cĪ windows program might load the windows.h library, and then it can use the function GetCommandLine() to get arguments from the command line. I'm wondering if we can determine that grep is using GetCommandLine() and findstr is using argsv. So findstr needs the extra character,, to escape the quote.

What I notice though C:\>echo a^"b | grep ^" So I'm bearing some of those hazards in mind. (in regular expressions ^z would mean match if the letter z is at the beginning of the line) C:\>echo a^"b | grep ^^a in these two examples with ^^, grep is being passed a caret. C:\>echo a^"gg|grep ^"Īnd I want to be sure that grep isn't getting passed a caret, because if grep is passed a caret, that has a meaning in regular expressions. The quote should be escaped, to ensure that grep will not just receive the quote, but the quote won't have a special meaning to cmd. It still worked but if there were things after the quote it might not have. It's like how echo ">c:\blah\a.a won't make the file. It works but it's not quite right 'cos if I were to do echo a^"gg|grep " >c:\blah\a.a it won't make the file. The following works, but is a bit incorrect.

Let's suppose I want to look for a quote. There is NO WARRANTY, to the extent permitted by law.
#Windows grep program free#
This is free software: you are free to change and redistribute it.
#Windows grep program license#
License GPLv3+: GNU GPL version 3 or later.
#Windows grep program software#
This is the grep i'm using C:\>where grepĬopyright (C) 2021 Free Software Foundation, Inc. In Windows cmd, does grep use GetCommandLine(), and findstr use argv?
