views:

202

answers:

3
f:\i>move foo bar dir
The syntax of the command is incorrect

help move says:

MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination

This seems to imply multiple arguments. So how can I give multiple arguments to move?

+1  A: 

From the command line:

for %i in (foo bar) do @move %i dir

Or, in a cmd file (since the use of % variables is slightly different there):

for %%i in (foo bar) do @move %%i dir
paxdiablo
move is supposed to take multiple arguments. see my edit.
Ian Kelling
Get over your programming language bias. If this were about an argument to a C file move function, it would be programming? Both go in a file as part of a program, which is programming.
Ian Kelling
I have no language bias, Ian, I was just pointing out that, if you're asking how to move files from the command prompt, that' NOT programming-related and the question will be closed. If it's done as part of a cmd script, it IS programming. Some of my best code has been written in bash/cmd.
paxdiablo
Ok, you have a console bias. You can program on the console. Unlike this question, everything valid in a bash script is also valid on the command line. Also, ZSH has good multi-line editing capabilities, so theres no reason not to write a complete program as a function on the console and then paste it into a file if you want to save your work. Powershell ISE has a console built in it that also has multi-line editing abilities.
Ian Kelling
I don't understand where you're coming from here, @Ian, especially with a two month gap :-) I've just stated that questions just relating to Windows commands are likely to be closed. *I* won't close them since you're right - quite a bit of my shell development is on the command line then just cut and pasted into a script. Even Windows, though it tends to be one command at a time there, unlike bash. In any case, your question survived, possibly *because* you made it clear it was for a script. My information was to point out the difference between % and %% in how you run it.
paxdiablo
Since the answer seems to be troubling you, I'll just remove the phrase you seem concerned about. No offense intended or taken. I hope that's better.
paxdiablo
+1  A: 

if you have the privilege to download stuffs, you can use GNU coreutils,

c:test> mv foo bar destination
ghostdog74
A: 

To pass multiple files to the move command as the first argument, separate them with commas:

move foo,bar dir

That's why there's a comma in the help:

MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination
Stobor
That gives the exact same message, syntax incorrect. mkdir foo bar dir, then do that command, you will see.
Ian Kelling
Apparently that syntax was dropped in xp and newer... It used to work in win2k and before. I don't know why it's still listed in the docs. :-S
Stobor
If the multi-file syntax really was removed in XP and later, the best option is probably to create a CMD file using the commands I've given in my answer (suitably adjusted to handle spaces in the filename if need be).
paxdiablo