Command For not working

2

I'm trying to run the for command at the command prompt to delete all my files that have the text "< cd_comiss>P< /cd_comiss>" , assigning them to a %%e variable, but it returns me that %e was unexpected at this point. Could someone help me?

Note: I'm navigating to the folder I want to then run the command.

for /f %%e in ('findstr "<cd_comiss>P</cd_comiss>" *.*') do del %%e
    
asked by anonymous 16.06.2017 / 18:39

1 answer

2

For the form you are wanting to execute just change the form you are using the variable, instead of using %%e use %e :

for /f %e in ('findstr "<cd_comiss>P</cd_comiss>" *.*') do del %e

Just to clarify, variable usage is different when you want to run directly through the Prompt or execute a batch file.

When run directly from the prompt use: %e
How much per batch file, use: %%e

As you guide the documentation, in free translation:

  

{% Variable | %% variable}: Required. Represents a parameter   replaceable. Use the% variable to run from the   command. Use the %% variable to run the for command within a   file in batches. Variables are case-sensitive and   should be represented with an alpha value, such as% A,% B or% C.

See the here documentation.

    
16.06.2017 / 19:18