.NET Logo
Welcome Guest Search | Active Topics | Members | Log In | Register

powershell ครั้งที่ 18 Options · View
paedotnet
Posted: Thursday, February 21, 2008 3:32:28 AM

Rank: มือเทพ
Groups: Member

Joined: 12/6/2007
Posts: 344
Location: bkk
การใช้งาน function provider
function provider ใช้ในการเข้าถึง ฟังก์ชั่น ที่ถูกกำหนดไว้ใน powershell โดยการใช้ function provider  นี้สามารถที่จะเรียกดูฟังก์ชั่นทั้งหมดในระบบออกมาได้ และสามารถเพิ่ม
,แก้ไข และ ลบฟังก์ชั่นได้ 
function provider นี้จะใช้ File System เป็นโมเดลหลักและ cmdlet ที่ใช้กับ function
สิ่งแรกที่ต้องทำในการเข้าถึง function provider คือเขียนโค้ดดังนี้
Set-Location function:\
หลังจากนั้น ก็ใช้คำสั่ง Get-ChildItem เพื่อเรียนดูข้อมูลทั้งหมด ในตำแหน่งของ function PSDrive ดังนี้
Get-ChildItem
ผลลัพธ์จะมีรายชื่อ CommandType ต่างๆออกมา
เราสามารถเรียกดู ข้อมูล ของฟังก์ชั้นได้ เช่น ถ้าต้องการดูข้อมูลของ ฟังก์ชั่นที่ชื่อ man ก็เขียนได้ดังนี้
Get-Content man
 


[With great power comes great responsibility]
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

YAFVision Theme Created by Jaben Cargman (Tiny Gecko)
Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.


Sponsored by