Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.29 KB | None | 0 0
  1. ------------------
  2. parametry
  3.  
  4. @echo off
  5. if "%2"=="" goto notEnough
  6. if not "%3"=="" goto tooMuch
  7. if "%1"=="%2" goto same
  8. goto different
  9.  
  10.  
  11. :notEnough
  12. echo Za malo parametrow
  13. goto end
  14.  
  15. :tooMuch
  16. echo Za duzo parametrow
  17. goto end
  18.  
  19. :same
  20. echo parametry sa identyczne
  21. goto end
  22.  
  23. :different
  24. echo parametry sa rozne
  25. goto end
  26.  
  27. :end
  28.  
  29.  
  30.  
  31.  
  32.  
  33. --------------------
  34. porownaj
  35.  
  36.  
  37. @echo off
  38. echo .>D:\plik1.txt
  39. echo .>D:\plik2.txt
  40. for %%f in (C:\PRACA\*) DO echo %%~nf%%~xf %%~tf %%~zf>> D:\plik1.txt
  41. for %%f in (C:\DOM\*) DO echo %%~nf%%~xf %%~tf %%~zf>> D:\plik2.txt
  42. comp D:\plik1.txt D:\plik2.txt /M > temp.txt
  43. if errorlevel==2 goto exception
  44. if errorlevel==1 goto different
  45. if errorlevel==0 goto identical
  46.  
  47. :exception
  48. echo Cannot open one of the files or invalid arguments or invalid switch
  49. goto end
  50.  
  51. :different
  52. echo Zawartosc jest rozna
  53. goto end
  54.  
  55. :identical
  56. echo Zawartosc jest identyczna
  57. goto end
  58.  
  59. :end
  60. del temp.txt
  61.  
  62.  
  63. ---------------
  64. usun
  65.  
  66.  
  67. @echo off
  68. if not exist "%1" goto noFile
  69.  
  70. choice /C TN /M "Plik %1 zostanie skasowany. Kontynuowac "  /T 10 /D N
  71. if errorlevel==2 goto cancel
  72. if errorlevel==1 goto delete
  73.  
  74. :cancel
  75. echo Operacja anulowana
  76. goto end
  77.  
  78. :delete
  79. del %1
  80. echo Plik %1 skasowany
  81. goto end
  82.  
  83. :noFile
  84. echo plik %1 nie istnieje
  85. goto end
  86.  
  87. :end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement