#1 24 Apr 2021 14:58

Sperhak
New Member
Registered: 24 Apr 2021
Posts: 1

bat file dont open

Hi sorry my english.
I have some .mkv film in D:\cdd  i write script to sort him to folder.

for %i in (*mkv) do md "%~ni"
for %i in (*mkv) do move "%i" "%~ni"

This is code in bat file. Bat file is in D:\cdd
Bat file not working.

When i run win+r type cmd to cmd type
D:
cd cdd
for %i in (*mkv) do md "%~ni"
for %i in (*mkv) do move "%i" "%~ni"

Code working

Can you help me what i doing bad in batfile?

Offline

#2 24 Apr 2021 15:13

T3RRY
Member
Registered: 15 Oct 2020
Posts: 15

Re: bat file dont open

If you took a moment to read the help output of 'For /?' you would see that for variables need to be % escaped in batch files - So %%i instead of %i

See the pages relating to the For command on this forum for more information.

Offline

Board footer

Powered by FluxBB