pwnulatr
pwnulatr

Reputation: 3

How can I move any file with a certain extension, from one location to another in batch?

When I attempt to move a file from one location, I get an error. What I want to do is have the program detect a .PRISON file on the desktop and move that file to a certain directory. I am really new to this and have just figured out very basic commands. This is what I have and it seems not to be working.

@echo off
echo "Place your .PRISON files on your Desktop, if they do not move, you need to run the program again"
move /y "%systemdrive%\%USERPROFILE%\Desktop\*prison" "%systemdrive%\%USERPROFILE%\AppData\Local\Introversion\Prison Architect\saves"
pause

Upvotes: 0

Views: 38

Answers (1)

SomethingDark
SomethingDark

Reputation: 14370

You're actually very close. The problem is that you're using both the %systemdrive% and %userprofile% variables, so the string is starting "C:C:\" instead of just "C:\"

Also, add change *prison to *.prison to grab all files with the prison extension.

Upvotes: 1

Related Questions