'Seek a command to move or rename or cut a file on windows
I want to move / cut a file on Windows (PS: the orginal path and destination are on the same drive.)
I know xcopy can copy a file, but I don't know how to cut a file with it. And it came to me the command of rename which is the function name of cutting a file in C/C++.
I tried this, rename command, but it seems it just renames files under a same folder, so it can't do cutting.
And I also don't want to do copy+delete the orignal one work, because a real cut a more effective since it just changes the file's position reference in the directory tree.
Edit: I'm seeking a command working for VisualStudio Post Build Event. It seems Move-Item doesn't work for that.
Solution 1:[1]
Thank to @Olaf's hint. I just find the command move, and with the help of if exist ... del, it works well for visual studio build event
IF EXIST "destionation\$(TargetFileName)" (DEL /F "destionation\$(TargetFileName)")
Move $(TargetPath) destionation\$(TargetFileName)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Zhang |
