trebor97351
trebor97351

Reputation: 33

Why does "invalid number of parameters" come up in this .bat file?

I have made this code and it doesn't seem to work anymore because of invalid number of parameters:

xcopy C:\Users\t\Desktop\survival\world "C:\Users\t\Desktop\backups\survival\Backup-%date:/=-%_%time:~0,2%.%time:~3,2% /s /e /i

Upvotes: 1

Views: 7897

Answers (2)

PHPirate
PHPirate

Reputation: 7572

If you want to use that command in a git hook (could be, since it isn't specified in the question), a solution could be to remove some spaces, like this:

xcopy "C:\Users\t\Desktop\survival\world\*.*" "C:\Users\t\Desktop\backups\survival\Backup"/s/e/i 

and no, I don't know why.

If you have spaces in the path, you could put the xcopy command in a somecommand.cmd file and in the git hook call cmd.exe /c "C:\path\to\cmdfile\copypdf.cmd"

Upvotes: 2

mahinlma
mahinlma

Reputation: 1248

Try this

xcopy /s /e /i "C:\Users\t\Desktop\survival\world\*.*" "C:\Users\t\Desktop\backups\survival\Backup-%date:/=-%_%time:~0,2%.%time:~3,2%"

Upvotes: 2

Related Questions