Reputation: 227
So, my Coworker asked me to create batch for him, that will move File(In my case, ZIP) from Network folder, to another Network folder. Coworker will be using this batch script from time to time on his Thumb flash drive.
Any way, I've got my batch script to do this:
move "\\folder1\archive\file.zip" "\\###.###.#.#\Newfolder\Archive"
Now, I have problem. When my coworker will use this script on other computers, path to zip file will not work. That means, that I need to somehow find the path.
This is how path will change on other computers:
move "\"another folder"\archive\file.zip" "\###.###.#.#\Newfolder\Archive"
So my question is, how do I find path to "Another folder" ?
Upvotes: 0
Views: 2413
Reputation: 11
Firstly. UNC File paths are \\servername\sharename\folder\file.ext
so your move won't work. Other file paths are Drive:\folder\file.ext
and relative paths \subfolderofcurrentfolder\file.ext
.
Dir c:\filename.ext /s
searches for a file. To get answer
For /f "delims=" %%A in ('dir c:\file.ext /a /s /b') Do echo %%A
Upvotes: 1