135012
Goto Top

Batch "copy" Netzlaufwerk

Wenn ich folgenden Befehl in die cmd eintippe : copy A:M.Müller\test.txt C:\Users\%Username%\Daten\test.txt
macht er genau was er soll. Die Testdatei aus dem Netzlaufwerk A auf den Desktop kopieren.
Schreibe ich den Befehl genau so in eine *.bat kommt eine Fehlermeldung das der Pfad nicht gefunden werden konnte.
Warum? Was ist daran falsch?

Content-Key: 358315

Url: https://administrator.de/contentid/358315

Printed on: April 19, 2024 at 04:04 o'clock

Mitglied: 134998
134998 Dec 15, 2017 updated at 10:26:35 (UTC)
Goto Top
A:M.Müller\test.txt
Missing backslash.

If you run this in task scheduler not with your current account, the network drive won't be mapped and therefore your the path is not available, because network drives are mapped only for the specific user account. You should use UNC Paths wherever possible.

Best regards
Tom
Mitglied: 135012
135012 Dec 15, 2017 at 10:38:38 (UTC)
Goto Top
But I cant use UNC for example "\\server\Folder"
Mitglied: 134998
Solution 134998 Dec 15, 2017 updated at 10:41:40 (UTC)
Goto Top
Zitat von @135012:
But I cant use UNC for example "\\server\Folder"
Sure you can! Try it yourself ...
copy "\\Server\folder\test.txt" "%userprofile%\Daten"  
Mitglied: 135012
135012 Dec 15, 2017 updated at 10:42:23 (UTC)
Goto Top
LoL iam dumb xD It works *yay* :D Thank you <3