Need Out-file formatting help

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 15 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
flouie
Posts: 1
Last visit: Tue Apr 22, 2008 2:32 am

Need Out-file formatting help

Post by flouie »

Hello,I'm a newbie to Powershell and I found this script to search for files containing SSN and it seems to work but my out-file seems to be unformatted and very hard to read.Get-ChildItem -rec -exclude *.exe,*.dll |select-string "[0-9]{3}[-| ][0-9]{2}[-| ][0-9]{4}" |out-file C:1.txtCan someone tell me how do I get the out-file to only list the path and file name of the file containing SSN? I think the problem might be that the path to most of those files are very long and can be nested like 6 sub-folders deep.Thanks in advance.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Need Out-file formatting help

Post by jvierra »

This is more fun if you want it to look good.

Code: Select all

	PS>dir c:windows -rec -exc *.exe,*.dll,*.bat,*.cmd|convertto-html -property fullname > c:dirlist.htmPS>c:dirlist.htm
	[/code.
	 
	You can add style sheets and custom formatting using the "ConvertTo-Html" CmdLet.jvierra2008-04-22 12:27:55
This topic is 15 years and 11 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked