Prev | Current Page 377 | Next

John Paul Mueller

"Administering Windows Server 2008 Server Core"


If %1Err==Err GoTo ProcessError
REM Simulate an error when the file doesn??™t exist.
Copy MyFile.TXT MyFile2.TXT
If Not ErrorLevel 1 Goto CheckFile
Echo The File doesn??™t exist so the batch file can??™t copy it.
Table 5.5: XCopy Error Levels
Error Level Meaning
0 Success, no error occurred.
1 The system didn??™t find any files to copy.
2 The user stopped XCopy by pressing Ctrl+C.
4 The application experienced an initialization error. The system doesn??™t have enough
memory or disk space. You may have entered an invalid drive name or used invalid syntax
at the command line.
5 The system experienced a disk write error.
144 CHAPTER 5 CREATING CMD AND BAT FILES
REM Check for a specific file and process it when it does exist.
:CheckFile
If Exist MyFile.TXT Goto ProcessFile
REM If the file doesn??™t exist then create it. Display a message with
REM instructions and then let the user type the text.
Echo Type some text for the test file. Press Ctrl+Z when you finish.
Pause
Copy CON MyFile.TXT
REM This is a label for processing the file.
:ProcessFile
REM Determine whether the user wants to display the file.
If Not %1==display Goto Process2
Echo MyFile.


Pages:
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
hostel krakow meble drewniane Teksty piosenek oferty mieszkań i domów Leona Lewis