Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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:
- $files = Get-ChildItem -Path $folder -Recurse
- $fileTypes = $files | Select-Object Extension -Unique
- $fileTypes | Out-File -FilePath Result.txt
- Foreach ($fileType in $fileTypes) {
- Write-Host $fileType.Extension
- }
- 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