windows_powershell_cookbook.pdf

(15775 KB) Pobierz
THIRD EDITION
Windows PowerShell Cookbook
Lee Holmes
Windows PowerShell Cookbook, Third Edition
by Lee Holmes
Copyright © 2013 Lee Holmes. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor:
Rachel Roumeliotis
Production Editor:
Kara Ebrahim
Proofreader:
Rachel Monaghan
Indexer:
Angela Howard
Cover Designer:
Randy Comer
Interior Designer:
David Futato
Illustrator:
Rebecca Demarest
October 2007:
August 2010:
January 2013:
First Edition
Second Edition
Third Edition
Revision History for the First Edition:
2012-12-21
First release
See
http://oreilly.com/catalog/errata.csp?isbn=9781449320683
for release details.
Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly
Media, Inc.
Windows Powershell Cookbook,
the image of a box tortoise, and related trade dress are trademarks
of O’Reilly Media, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trade‐
mark claim, the designations have been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained
herein.
ISBN: 978-1-449-32068-3
[LSI]
Table of Contents
Foreword. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
Part I.
Part II.
Tour
Fundamentals
19
23
24
26
28
32
35
36
39
40
43
45
47
49
50
52
55
59
61
iii
A Guided Tour of Windows PowerShell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
1. The Windows PowerShell Interactive Shell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
1.1. Run Programs, Scripts, and Existing Tools
1.2. Run a PowerShell Command
1.3. Resolve Errors Calling Native Executables
1.4. Supply Default Values for Parameters
1.5. Invoke a Long-Running or Background Command
1.6. Program: Monitor a Command for Changes
1.7. Notify Yourself of Job Completion
1.8. Customize Your Shell, Profile, and Prompt
1.9. Customize PowerShell’s User Input Behavior
1.10. Customize PowerShell’s Command Resolution Behavior
1.11. Find a Command to Accomplish a Task
1.12. Get Help on a Command
1.13. Update System Help Content
1.14. Program: Search Help for Text
1.15. Launch PowerShell at a Specific Location
1.16. Invoke a PowerShell Command or Script from Outside PowerShell
1.17. Understand and Customize PowerShell’s Tab Completion
1.18. Program: Learn Aliases for Common Commands
1.19. Program: Learn Aliases for Common Parameters
Zgłoś jeśli naruszono regulamin