194
❘
CHAPTER 10
Using ironPython for AdministrAtion tAsks
let the user enter data using command line switches (as shown by the many utilities described so far
in the book) or through environment variables. This chapter concentrates on the latter two techniques,
but shows all three to some extent. (Theoretically, you have a fourth option in forcing the application
to gather information from an external source such as a database, but this chapter doesn’t discuss that
option because most command line applications don’t use it.)
The user also expects your application to provide output as appropriate. As with data input, command
line applications have three major options for outputting data. The common method is to display the
output directly on the console screen. However, the user might not be looking at the console screen, so
you need alternatives. The two most common alternatives are to use log files on disk or to add entries
to the Windows event log. This chapter discusses all three techniques because they’re all important.
UNdERSTANdINg THE CommANd LINE
The command line is a text-based environment that some users never even see. You type a command
and the computer follows it — nothing could be simpler. In fact, early PCs relied on the command
line exclusively (even earlier systems didn’t even have a console and instead relied on punched tape,
magnetic tape, punched cards, or other means for input, but let’s not go that far back). Some people
are amazed at the number of commands that they can enter at the command line and the usefulness
of those commands even today. A few administrators still live at the command line because they’re
used to working with it. The following sections give you a better understanding of the command
line and how it functions.
Newer versions of Windows (such as Vista and Windows 7) display a command
prompt with reduced privileges as a security precaution. Many command line utili-
ties require administrator privileges to work properly. To open an administrator
command prompt when working with a newer version of Windows, right-click the
Command Prompt icon in the Start menu and choose Run As Administrator from
the context menu. You may have to provide a password to complete the command.
When the command prompt opens, you have full administrator privileges, which
let you execute any of the command line applications.
Do'stlaringiz bilan baham: |