1

I try to move a file on a network resource to another network resource using a batch file. My problem is that Windows command processor doesn't support a UNC path as current directory on execution of a batch file.

Is there any way to bypass the problem?

This is my batch file:

@Echo off
setlocal EnableExtensions

pushd (what do I have to include here?)

for /f "delims=" %%g in ('DIR /b /a-d /od /tw') do (
    set zold=%%g
    set zoldname=%%~ng
    goto movefile
)

:movefile
move "\\B-NAS\Pfad1\Pfad2\Pfad3\%zold%" "\\B-NAS\Pfad1\Pfad2\Pfad3\%zold%.Test1"
timeout /t 3
move /y "\\wfsaw\AWP\Doku\%zold%.Test1" "\\wfsaw\AWP\Doku\%zoldname%.Test2"

popd
pause
exit /b
Mofi
  • 46,139
  • 17
  • 80
  • 143
Lloyd
  • 19
  • 1
  • 6
  • Does this answer your question? [How to run batch file from network share without "UNC path are not supported" message?](https://stackoverflow.com/questions/9013941/how-to-run-batch-file-from-network-share-without-unc-path-are-not-supported-me) – RamblinRose Feb 26 '20 at 14:16
  • 2
    You could try `RoboCopy` with its `/Mov` option. Open a Command Prompt window and enter `robocopy /?` to read its usage information. However your question does not match your code, which is just renaming a file. – Compo Feb 26 '20 at 14:18
  • @Compo The code renames a file, moves it to another folder and renames it again. I will look up the command thanks – Lloyd Feb 26 '20 at 15:09
  • Okay, everything's working now. Thank you! – Lloyd Feb 28 '20 at 06:50

0 Answers0