Copy, duplicate, rename...all that works, but the valuecheck is missing
Posted: 02 Sep 2020 15:22
Hello,
this is my final version of the Script with the following funktion:
1. 2 Folders - Copy a file from one to the other directory ( source to target )
2. Ask how often den copied file shall be duplicated - if yes...no...correct...cancel...automatically "YES" after a certain time + a few times "Echo"
3. Copy as often as wanted and rename + a marvelous continuous numerating
4. Well done thanks the helping hand of aGerman, Compo and last but not least OJBakker
This is the script ( German text version ):
This is the script ( English text version ):
What I want:
A check whether the entered value is a number
Is there anyone, lending me a helping hand?
this is my final version of the Script with the following funktion:
1. 2 Folders - Copy a file from one to the other directory ( source to target )
2. Ask how often den copied file shall be duplicated - if yes...no...correct...cancel...automatically "YES" after a certain time + a few times "Echo"
3. Copy as often as wanted and rename + a marvelous continuous numerating
4. Well done thanks the helping hand of aGerman, Compo and last but not least OJBakker
This is the script ( German text version ):
Code: Select all
@ECHO OFF
SET Quelle=C:\000Quelle
SET Ziel=C:\000Ziel
SET Zahl=0
Set Z=1
Set ZE=0
SETLOCAL ENABLEDELAYEDEXPANSION
if "%1"=="" goto eingabe
set /Anzahl=%1
goto ausgabe
:eingabe
set /p Anzahl=So oft soll kopiert werden:
goto ausgabe
:ausgabe
echo Ausgabe zur Kontrolle:
echo Anzahl=%Anzahl%
choice /C JNA /D J /T 6 /M "J = Ja, N = Nein oder A = Abbrechen oder einfach warten, dann geht automatisch weiter"
if errorlevel 3 goto EXIT
if errorlevel 2 goto NEIN
if errorlevel 1 goto Zahl
:NEIN
echo.
echo Falsche Eingabe, Du Depp
echo.
REM pause
timeout /T 9
cls
GOTO eingabe
:Zahl
Set /A ZE=%ZE%+1
Set /A Z=%Z%+1
FOR /F "usebackq tokens=*" %%i IN (`DIR %Quelle% /B "*.*"`) DO (
ECHO Alt: %Quelle%\%%i
SET /A Zahl=!Zahl!+1
ECHO Neu: %Ziel%\!Zahl!!
ECHO.
COPY %Quelle%\%%i "%Ziel%\%%~ni !Zahl!%%~xi"
if %ZE%==%Anzahl% goto End
Goto Zahl
:End
ECHO.
)
Code: Select all
@ECHO OFF
SET Source=C:\000Source
SET Target=C:\000Target
SET Number=0
Set Z=1
Set ZE=0
SETLOCAL ENABLEDELAYEDEXPANSION
if "%1"=="" goto input
set /Amount=%1
goto output
:input
set /p Amount=How often would You like to duplicate:
goto output
:output
echo Check the Value here:
echo Amount=%Amount%
choice /C YNC /D Y /T 6 /M "Y = Yes, N = No or C = Cancel - or just wait a few seconds and the show goes on"
if errorlevel 3 goto EXIT
if errorlevel 2 goto No
if errorlevel 1 goto Number
:No
echo.
echo Oh, a little mistake, Mr. Trump
echo.
REM pause
timeout /T 9
cls
GOTO input
:Number
Set /A ZE=%ZE%+1
Set /A Z=%Z%+1
FOR /F "usebackq tokens=*" %%i IN (`DIR %Source% /B "*.*"`) DO (
ECHO Alt: %Source%\%%i
SET /A Number=!Number!+1
ECHO Neu: %Target%\!Number!!
ECHO.
COPY %Source%\%%i "%Target%\%%~ni !Number!%%~xi"
if %ZE%==%Amount% goto End
Goto Number
:End
ECHO.
)
A check whether the entered value is a number
Is there anyone, lending me a helping hand?