Mr Moose
Mr Moose

Reputation: 6344

Windows command works from command prompt but not in cmd file. Any idea why?

I am trying to run the following command from a batch file (I got the idea from this answer), but it doesn't seem to work. Yet when I run it from a cmd window, it runs fine.

Can anyone explain why, and more importantly, what I can do about it?

The command is;

for %f in ("../Schema Objects/Schemas/dbo/Programmability/Stored Procedures/*.sql") do echo %f

The error I get when it's run from a batch file is;

f was unexpected at this time.

Any help is much appreciated

Upvotes: 3

Views: 1163

Answers (1)

BillP3rd
BillP3rd

Reputation: 1019

The %f in your batch file needs to be %%f.

Upvotes: 4

Related Questions