Collecting Wisdom

Collecting Wisdom

Skip to content
Menu

Category: Uncategorized

Uncategorized

How to Calculate Date Difference in PowerShell (With Examples)

Posted on February 29, 2024 by Zach

You can use the following basic syntax to calculate the difference between two dates in PowerShell: $date_diff = New-TimeSpan -Start $date1 -End $date2 This particular…

Uncategorized

PowerShell: How to Create Array from CSV File

Posted on February 29, 2024 by Zach

You can use the following syntax in PowerShell to create an array from a CSV file: $my_csv = Import-Csv “c:\users\bobbi\basketball_data.csv” $my_array = foreach ($row in…

Uncategorized

How to Compare Two Times in PowerShell (With Example)

Posted on February 29, 2024 by Zach

You can use the following basic syntax to compare two times in PowerShell: $datetime1.TimeOfDay -lt $datetime2.TimeOfDay This example assumes that $datetime1 and $datetime2 are both…

Uncategorized

How to Compare Two Folders in PowerShell (With Example)

Posted on February 28, 2024 by Zach

You can use the following syntax in PowerShell to compare the contents of two folders: $folder1 = Get-childitem “c:\users\bobbi\data1” $folder2 = Get-childitem “c:\users\bobbi\data2” Compare-Object $folder1…

Uncategorized

How to Compare Two Strings in PowerShell (With Examples)

Posted on February 28, 2024 by Zach

You can use the following methods in PowerShell to compare two strings: Method 1: Compare two strings (case-insensitive) $string1 -eq $string2 This example checks if…

Uncategorized

How to Compare Two Files in PowerShell (With Example)

Posted on February 27, 2024 by Zach

You can use the following basic syntax to compare two files in PowerShell: $file1 = “c:\users\bobbi\teams1.txt” $file2 = “c:\users\bobbi\teams2.txt” diff (cat $file1) (cat $file2) This…

Uncategorized

How to Compare Two Arrays in PowerShell (With Examples)

Posted on February 27, 2024 by Zach

You can use the following methods in PowerShell to compare the values in two arrays: Method 1: Find values that exist only in first array…

Uncategorized

How to Compare Dates in PowerShell (With Examples)

Posted on February 27, 2024March 14, 2024 by Zach

You can use the following methods in PowerShell to compare dates: Method 1: Compare Two Dates $date1 -lt $date2 This particular example checks if the…

Uncategorized

PowerShell: How to Check if String Starts with Specific Value

Posted on February 27, 2024 by Zach

You can use the StartsWith() method in PowerShell to check if a string starts with a specific value. One common way to use this method…

Uncategorized

PowerShell: A Simple Formula for “Not Contains”

Posted on February 27, 2024 by Zach

You can use the following syntax in PowerShell to only show rows in a file that do not contain specific strings: (Get-Content $my_file) -notmatch [String]::Join(‘|’,$dont_want)…

Uncategorized

PowerShell: Check if String Exists in List of Strings

Posted on February 27, 2024 by Zach

You can use the following syntax in PowerShell to check if a specific string exists in a list of strings: $list_of_strings -contains “this_string” This particular…

Posts pagination

Previous Page Page 1 … Page 86 Page 87 Page 88 Next Page

Search

© 2024 Collecting Wisdom | Privacy Policy
Wisteria Theme by WPFriendship ⋅ Powered by WordPress