logo
  • 教程列表
  • SO官方文檔
  • Powershell 教程
    • Powershell - 概述
    • Powershell - 環境設定
    • Powershell - cmdlet
    • Powershell - 檔案和資料夾操作
    • Powershell - 日期和時間操作
    • Powershell - 檔案 I/O 操作
    • Powershell - 高階 Cmdlet
    • Powershell - 指令碼
    • Powershell - 特殊變數
    • Powershell - 運算子
    • Powershell - 迴圈播放
    • Powershell - 條件
    • Powershell - 陣列
    • Powershell - 雜湊表
    • Powershell - 正規表示式
    • Powershell - 反向撇號
    • Powershell - Brackets
    • Powershell - Alias
  1. 教程
  2. Powershell 教程
  3. Powershell - 刪除檔案內容

Powershell - 刪除檔案內容

Created: November-02, 2018

Cmdlet

Clear-Content cmdlet 可用於清除 txt 檔案的內容。

在這個例子中,我們正在刪除檔案 test.txt 的內容。

Clear-Content D:\temp\test\test.txt

現在,如果我們讀取檔案 test.txt 的內容。

Get-Content D:\temp\test\test.txt

就會發現檔案裡的內容時空的。

  • Powershell - 建立 HTML 檔案
  • Powershell - 讀取文字檔案

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 關於本站
  • 免責聲明