Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Unterordner mit X Copy aus aktuellem Pfad in ein anzugebendes Laufwerk kopieren

Empfohlene Antworten

Veröffentlicht

Guten Morgen,

 

ich möchte mittels einer Bat-Datei alle Ordner und Unterordner ohne Ihnhalt vom aktuellen Startpunkt auf eine USB-FEstplatte kopieren.

Den Pfad der USB-Platte soll man mittels Eingabe des Laufwerksbuchstaben angeben.

Ich habe mich an XCopy versucht, aber es funktioniert einfach nicht.

 

Vielleicht kann mir einer helfen?

  • Autor

Ja klar:

 

:nochmal
echo.
@echo off 
echo Abbrechen mit Strg-C 
set /p zielort=Ziellaufwerk eingeben:
if "%zielort%"=="" goto nochmal
echo Laufwerk %Zielort% wurde ausgewaehlt.

ECHO Kopiervorgang starten? (j / n)
SET /p wahl=
For %%A in (J N) Do if /i '%wahl%'=='%%A' goto :Wahl%%A
Echo Ungueltige Antwort&Pause&Exit /B 1
Goto Ende
:WahlN
echo Vorgang abgebrochen!
goto Ende
:WahlJ
::xcopy .\  %Zielort%:\ /T /E /i
:Ende
pause

 

Goto. Argh. Und generell fürchterlich unübersichtlich.

Vielleicht solltest du das xcopy nicht mit :: auskommentieren. 🤔

Das unten funktioniert bei mir aber und würde zudem erlauben, in z.B. H:\foo\bar\xcopy statt nur nach H:\ zu kopieren. Dafür muss dann allerdings H: statt nur H als Ziellaufwerk angegeben werden. Naja. Verschmerzbar.

:BEGIN
@echo off 
echo.
echo MeinWunderbaresKopierScriptMitGoto
echo Abbrechen mit Strg+C
echo.
set /P zielort="Ziellaufwerk eingeben: "

if "%zielort%" == "" (
  goto BEGIN
) else (
  set zielort=%zielort%\
)
echo Laufwerk %zielort% wurde ausgewaehlt.
echo.

set /P wahl="Kopiervorgang starten? (j / n) "
for %%A in (J N) do (
  if /i '%wahl%' == '%%A' (
    goto :Wahl%%A
  )
)
echo Ungueltige Antwort
goto END

:WahlN
  echo Vorgang abgebrochen!
  goto END

:WahlJ
  echo Kopiervorgang gestartet
  echo Kopiere von %cd% nach %zielort%
  xcopy "%cd%\*"  %zielort% /T /E /i

:END
pause

Ansonsten: Never heard of Powershell? 😉

Bearbeitet von Visar
Ungewollte leere Zeile entfernt

  • 1 Monat später...

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.