How can I move all the files from one folder to another using the command line?

You can use move for this. The documentation from help move states: Moves files and renames files and directories. To move one or more files: MOVE [/Y | /-Y] [drive:][path]filename1[,…] destination To rename a directory: MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2 [drive:][path]filename1 Specifies the location and name of the file or files you want to … Read more

Difference between Dynamic Environment Variables and Normal Environment Variables in CMD

There are three types of variables of which value is accessed using the syntax %variable% or !variable! on having enabled delayed environment variable expansion with using the option EnableDelayedExpansion of the command setlocal from within a Windows command prompt window or a batch file, i.e. using %SystemRoot%\System32\cmd.exe. 1. Persistent stored variables There are environment variables … Read more

Split %date% in a batch file regardless of Regional Settings

Four years have passed, but this question doesn’t get old, and I think now there’s a slightly better answer than using wmic (on win7 onwards). for /F “tokens=1,2,3 delims=_” %%i in (‘PowerShell -Command “& {Get-Date -format “MM_dd_yyyy”}”‘) do ( set MONTH=%%i set DAY=%%j set YEAR=%%k ) echo %MONTH% %DAY% %YEAR% With powershell Get-Date you can … Read more

How to expand a CMD shell variable twice (recursively)

Thinking in terms of a less tortuous solution, this, too, produces the CCC you desire. setlocal enabledelayedexpansion set AAA=BBB set BBB=CCC for /F %%a in (‘echo %AAA%’) do echo !%%a! edit: to dissect this answer: setlocal enabledelayedexpansion – this will allow for any environment variable setting during your bat to be used as modified during … Read more