Advertisement
wetyukmnbxc

Untitled

Feb 16th, 2023 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. AI: AI: Sure thing! You can store the result of the script as a variable by calling the Out-File cmdlet. The modified script looks like this:
  2. $files = Get-ChildItem -Path $folder -Recurse
  3. $fileTypes = $files | Select-Object Extension -Unique
  4. $fileTypes | Out-File -FilePath Result.txt
  5. Foreach ($fileType in $fileTypes) {
  6.     Write-Host $fileType.Extension
  7. }
  8.  
  9. By adding the Out-File cmdlet, the result of the script will be written to a text file named "Result.txt" in the current working directory.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement