I have very little experience with CMD, and am trying to use it to call a program on every .go file in a directory, recursively.

First, I was trying for /R apiserver_sdk %%G in (*.go) DO gocyclo %%G, but learned that doesn't work. Then, heeding the advice here, I did for /R apiserver_sdk %%G in (*.go) DO gocyclo %G. In attempt to debug it, I changed gocyclo to echo, and wrapped the last %%G in double quotes, but still didn't work.

All attempts returned this error:

%%G was unexpected at this time.

OK, this is my fault for not reading the manual more closely; /* I missed this line:

%%parameter : A replaceable parameter: in a batch file use %%G (on the command line %G)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.