Example: $a = Get-Date
Code: Select all
Get-ChildItem -Path C:\Test -Name
Logs
anotherfile.txt
Command.txt
CreateTestFile.ps1
ReadOnlyFile.txt
Code: Select all
Get-ChildItem -Path C:\Test -Name
Logs
anotherfile.txt
Command.txt
CreateTestFile.ps1
ReadOnlyFile.txt
Code: Select all
$a=Get-Date -Format U
$obj = Get-ChildItem -Path "C:\Test" -Name
Foreach ($i in $obj)
{
$a + "|" + $i
}
Code: Select all
$a=Get-Date -Format U
$obj = Get-ChildItem -Path "C:\Test" -Name
$File = 'C:\Test\testfileOutput.txt'
$Stream = [System.IO.StreamWriter]::new($File)
Foreach ($i in $obj)
{
$Stream.WriteLine($a + "|" + $i)
}
$Stream.Close()