iT邦幫忙

0

Powershell 更改回只顯示目錄(已解決)

  • 分享至 

  • xImage

題目要求:
依序顯示系統日期、顯示PowerShell程式test.ps1的內容、刪除PowerShell程式test.ps1,最後利用指令顯示確認已經刪除

test.ps1:

Clear-Host
Set-Location
New-Item -ItemType "directory" test
Get-ChildItem

目前思路:

Clear-Host
Set-Location
Get-Date
Get-Content c:\test.ps1
Remove-Item c:\test.ps1
Get-ChildItem

跑出來之後會顯示這種詳細資料
https://ithelp.ithome.com.tw/upload/images/20221205/20155726sLT3RXAQgs.png
https://ithelp.ithome.com.tw/upload/images/20221205/20155726FVlOE1njXc.png
https://ithelp.ithome.com.tw/upload/images/20221205/20155726EfhEPWA6Im.png

但我想要的效果是
https://ithelp.ithome.com.tw/upload/images/20221205/20155726Fnbtwv8quW.png
這樣就好

請問有辦法改進嗎?

nwm310 iT邦新手 4 級 ‧ 2022-12-05 21:19:56 檢舉
Write-Host (Get-Date)
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答