How do you strip quotes out of an ECHO’ed string in a Windows batch file?

The call command has this functionality built in. To quote the help for call: Substitution of batch parameters (%n) has been enhanced. You can now use the following optional syntax: %~1 – expands %1 removing any surrounding quotes (“) Here is a primitive example: @echo off setlocal set mystring=”this is some quoted text” echo mystring=%mystring% … Read more

batch file Copy files with certain extensions from multiple directories into one directory

In a batch file solution for /R c:\source %%f in (*.xml) do copy %%f x:\destination\ The code works as such; for each file for in directory c:\source and subdirectories /R that match pattern (\*.xml) put the file name in variable %%f, then for each file do copy file copy %%f to destination x:\\destination\\ Just tested … Read more

Batch file encoding

You have to save the batch file with OEM encoding. How to do this varies depending on your text editor. The encoding used in that case varies as well. For Western cultures it’s usually CP850. Batch files and encoding are really two things that don’t particularly like each other. You’ll notice that Unicode is also … Read more

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