Good day!

I tried to create a batch file, which in all files in the folder will replace the letter t with the letter s. Here is my code: for /rc:\ %%i in (*t*.*) do ren %%i (*s*.*)

What am I doing wrong?

    1 answer 1

    All wrong. Here's how:

     rem Π’ΠΊΠ»ΡŽΡ‡Π°Π΅ΠΌ ΠΎΡ‚Π»ΠΎΠΆΠ΅Π½Π½ΠΎΠ΅ Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½Ρ‹Ρ… SetLocal EnableDelayedExpansion rem Π¦ΠΈΠΊΠ» ΠΏΠΎ всСм Ρ„Π°ΠΉΠ»Π°ΠΌ, содСрТащих Π² ΠΈΠΌΠ΅Π½Π°Ρ… Π±ΡƒΠΊΠ²Ρƒ t (с Π·Π°Ρ…ΠΎΠ΄ΠΎΠΌ Π² ΠΏΠΎΠ΄ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³ΠΈ) for /rc:\ %%i in (*t*.*) do ( rem ВыдСляСм имя Ρ„Π°ΠΉΠ»Π° (Π±Π΅Π· ΠΊΠ°Ρ‚Π°Π»ΠΎΠ³Π° ΠΈ Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ). set NEW_NAME=%%~ni rem ЗамСняСм всС вхоТдСния Π±ΡƒΠΊΠ²Ρ‹ t Π½Π° s. set NEW_NAME=!NEW_NAME:t=s! rem ΠŸΠ΅Ρ€Π΅ΠΈΠΌΠ΅Π½ΠΎΠ²Ρ‹Π²Π°Π΅ΠΌ исходный Ρ„Π°ΠΉΠ». НовоС имя Π³Π΅Π½Π΅Π½Ρ€ΠΈΡ€ΡƒΠ΅ΠΌ ΠΈΠ· ΠΏΠ΅Ρ€Π΅ΠΌΠ΅Π½Π½ΠΎΠΉ rem !NEW_NAME!, добавляя ΠΊ Π½Π΅ΠΉ исходноС Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ (%%~xi). rename "%%i" "!NEW_NAME!%%~xi" ) EndLocal 

    For more information about the applied constructions, see the help output by the following commands:

     SetLocal /? set /? for /?