Do you wish to examine two textual content strings in PowerShell however couldn’t discover a Cmdlet to do that? I had the identical drawback, so I developed a PowerShell script (a perform, Evaluate-TextStrings).
Overview
I used to be writing the article PowerShell IF ELSE Defined after I got here throughout a query about evaluating two textual content strings with PowerShell. To be particular, I wish to examine two textual content strings like those under:
"My identify is Victor" "My identify shouldn't be Tammy"
I need to have the ability to listing the strings which might be related in each textual content strings. Equally, I wish to listing the textual content strings which might be totally different in each textual content strings.
Firstly, I attempted the Evaluate-Object cmdlet however as anticipated, it is not going to do the job. I performed round with logical operators however none of them would do the job.
#1 Finest Total
EVEO Display screen Cleaner Spray – Giant Display screen Cleaner Bottle – TV Display screen Cleaner, Laptop Display screen Cleaner, for Laptop computer, Cellphone, Ipad – Laptop Cleansing package Digital Cleaner (1 Pack)
- Display screen Cleaner is Your Display screen’s New Bestfriend! – EVEO is proud to current a display cleaner that’s completely suited to your TV. Meet your new display cleaner, laptop display cleaner, laptop computer cleaner, iPad cleaner, Macbook,television cleaner or another digital machine. Our display cleaner spray and wipe together with the included plush microfiber fabric, simply removes mud, fingerprints & different smudges on the display’s floor. Clear successfully for a streak-free display
- Mild in your Screens- Our display cleaner spray and wipes is suitable for use even for essentially the most delicate LCD, LED, CRT, and OLED screens in correct use. Be relaxed figuring out that this product is suitable with all the key manufacturers: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC screens – we’ve obtained you coated! Can be utilized as LCD display cleaner, television cleaner, sensible television display cleaner, and extra
- Premium Tremendous Delicate Plush Microfiber Fabric – Included on this environment friendly display cleansing package. This display cleaner spray and wipe has our signature plush microfiber fabric specifically designed to adjust to screens and screens and go away them streak-free. Has been proven to successfully absorbs cussed stains, zero streaks, and no fiber shedding. At all times use this along with our display cleaner for the perfect outcomes
- Straightforward-to-Use Display screen Cleaner Package + microfiber cleansing cloth- The EVEO Display screen Cleansing Package will simply be your new favourite instrument in terms of taking good care of the stuff you love most, fast and simple resolution for a streak-free display. Merely screw on the sprayer gun on the display cleaner bottle. Spray the cleansing liquid onto the microfiber fabric, then wipe the display till desired cleanliness & shine is achieved.
- High quality Display screen Care Package Value Buying – Take pleasure in a handy Display screen Cleaner anytime, anyplace you want it. Your satisfaction is our prime precedence. We stand behind the standard of our merchandise and that’s why, you shouldn’t be worrying in any respect. We manufacture the Finest Display screen Cleaner. and can be utilized for laptop computer cleansing package, laptop computer display cleaner, television display cleaner for sensible television. MacBook display cleaner, monitor cleaner or display cleaner spray for digital gadgets with microfiber cleansing fabric
Lastly, I made a decision to create a customized perform that may examine two textual content strings. I referred to as the perform Evaluate-TextStrings.
Syntaxes

The Evaluate-TextStrings perform has two syntaxes. Right here they’re…
Evaluate-TextStrings [-FirstTextString] <String[]> [-SecondTextString] <String> [[-DisplaySimilar]] [[-DisplayDifference]] [<CommonParameters>]
Evaluate-TextStrings [-FirstTextString] <String[]> [-SecondTextString] <String> [[-DisplaySimilar]] [[-DisplayDifference]] [[-OutFile]] [[-Path] <String>] [<CommonParameters>]
You employ the primary syntax to show the results of the command on the PowerShell console. Quite the opposite, you should utilize the second syntax to ship the output of the command to a textual content file.
To study extra, learn the subsequent part…
Parameters

To successfully use the PowerShell perform, Evaluate-TextStrings to check two textual content strings, it’s essential to perceive the parameters of the perform.
Within the desk under, I’ve defined all of the parameters and tips on how to use them.
| Parameters of Evaluate-TextStrings | Feedback/Notes |
|---|---|
| FirstTextString | This parameter is used to specify the primary textual content string you wish to examine. It’s a required parameter |
| SecondTextString | Use the SecondTextString to specify the second textual content string you wish to examine in PowerShell. Just like the FirstTextString parameter, SecondTextString is a required parameter |
| DisplaySimilar | The DisplaySimilar parameter is a Change parameter. It implies that it doesn’t require any enter. You simply have to specify the parameter. So, once you specify the DisplaySimilar parameter, Evaluate-TextStrings shows the elements of each texts which might be related or the identical. |
| DisplayDifference | That is additionally a Change parameter. In the event you specify the DisplayDifference parameter, Evaluate-TextStrings shows the texts which might be totally different within the texts strings you’re evaluating |
| OutFile | You need to use this parameter to ship the output of Evaluate-TextStrings to a textual content file. The OutFile parameter is a Change; so it doesn’t require enter. The parameter is optionally available |
| Path | Use the Path parameter to specify the trail to save lots of the textual content file. If the OutFile parameter is specified however the Path parameter shouldn’t be specified, Evaluate-TextStrings will save the textual content file within the person’s temp folder, normally situated in [Windows Install Drive]CustomersAppDataLocalTempCompareString. In any case, the identify of the textfile is within the format dd-MM-yyyy.txt
Alternatively, in the event you specify a path with the Path parameter, Evaluate-TextStrings will save the textfile in $Path + “CompareString” |
Examples

Now that you recognize the syntaxes and parameters of Evaluate-TextStrings, it’s time to see some examples.
Rank #2
Compressed Air Duster,130000RPM Tremendous Energy Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Mini Blower with LED Mild,Mud Remover for Laptop/Home/Outside/Automobile
- Highly effective Turbo Fan:CAGIWIRU Electrical Air Duster have reached velocity as much as 130000RPM,Can environment friendly take away mud and particles.With LED mild and Three Adjustable Velocity to fulfill with totally different cleansing duties.
- With Hooked up USB C Fasting Charging cable.Charing 3 hours,Take pleasure in as much as 240 minutes of use on the bottom setting, For third velocity can use for 25mins.with 4 charging choices to fulfill together with your wants.
- Large Software:Upgraded hooked up 5 totally different nozzles,making it appropriate for quite a lot of scenes, comparable to automobile,pet, laptop, keyboards, and different digital gadgets. It additionally serves for workplace and residential clear duster.
- Useful Design & Transportable:Cordless air duster electrical nozzle is Mild weight and small measurement, design and comfy to carry and area saving, handy to hold round. You’ll be able to put it in your room or contained in the automobile with out taking on area.
- Guarantee & Help: Our Electrical air duster comes with 5 years guarantee and 24/7 customer support. Throughout this era, when you’ve got any questions,pls kindly be happy to contact us.
Earlier than then although, I’ll present you tips on how to obtain and set up the perform.
1. Obtain and Set up
Observe the steps under to obtain and set up the Evaluate-TextStrings perform:
- Click on the Obtain Evaluate-TextStrings hyperlink. Then, save the zip file to a folder
- Subsequent, unzip the file and reserve it in:
C:Program FilesWindowsPowerShellModules
To make sure you get the precise path, enter the command under in PowerShell and press enter.
$env:ProgramFiles + "WindowsPowerShellModules"
If this path doesn’t exist, you need to create the total one. To create the trail, you may open PowerShell as administrator and run the next instructions:
$ModulesFolder = $env:ProgramFiles + "WindowsPowerShellModules" New-Merchandise -Path $ModulesFolder -ItemType Listing -Drive | Out-Null
When you create the trail, copy the unzipped folder, Evaluate-TextStrings to the final folder within the path…
To offer you a visible presentation of what the trail appears to be like like, see the screenshot under.
Rank #3
WOLFBOX MegaFlow 50 Compressed Air Duster-110000RPM Tremendous Energy Electrical Air Duster, 3-Gear Adjustable Mini Blower with Quick Charging, Mud Blower for Laptop, Keyboard, Home, Outside and Automobile
- Highly effective Turbo Fan:WOLFBOX MegaFlow 50 electrical air duster reaches speeds of as much as 110,000 RPM, successfully eradicating mud and particles. It options three adjustable velocity settings to go well with totally different cleansing duties.
- Economical and Reusable: Constructed from sturdy supplies with a long-lasting battery, the WOLFBOX MegaFlow 50 is a sustainable different to disposable air cans, enhancing your cleansing expertise.
- Transportable and Light-weight: Weighing solely 0.45 lb, this compact air duster is simple to hold. The included lanyard ensures handy use each indoors and outdoor.
- Large Software: WOLFBOX MegaFlow 50 electrical air duster comes with 4 nozzles, making it appropriate for quite a lot of scenes, comparable to laptop, keyboards, or different digital gadgets. It additionally serves effectively for dwelling clear and automobile duster.
- 3.5 Hours Quick Charging: WOLFBOX MegaFlow 50 electrical air duster recharges in simply 3.5 hours with a type-C cable. Take pleasure in as much as 240 minutes of use on the bottom setting, with 4 charging choices to fit your wants.To make sure optimum efficiency of your MF50, please totally cost the battery earlier than use.

- After getting copied the folder to the Modules folder, open PowerShell as administrator and run the next instructions
Import-Module Evaluate-TextStrings -Drive
Whenever you run the command, you’ll be prompted to substantiate that you simply wish to set up the module. Sort R and press enter key.

Now that you’ve got downloaded and put in Evaluate-TextStrings, proceed to the subsequent sub-sections to see tips on how to use the PowerShell perform to check two textual content strings.
Earlier than then, although, you may run the command under to show all of the examples…
Get-Assist Evaluate-TextStrings -Examples
The command shows all of the examples I talk about within the subsequent sub-sections. Nonetheless, for particulars, see the sub-sections under this screenshot.

2. Show the Similarity Between Two Textual content Strings
On this instance, I wish to show the similarity between the 2 textual content strings, “My identify is Victor” and “My identify is Ashiedu”. Right here is the command…
Evaluate-TextStrings -FirstTextString "My identify is Victor" -SecondTextString "My identify is Ashiedu" -DisplaySimilar
Right here is the end in PowerShell…

3. Show the Distinction Between Two Textual content Strings
Within the final instance, I in contrast two textual content strings and displayed the distinction between the textual content strings. On this instance, I wish to show the distinction between two textual content strings.
Rank #4
Vaydeer Wrist Relaxation for Keyboard and Mouse, Laptop Ergonomic Wrist Help Pad, Delicate Reminiscence Foam Arm Cushion for Desk, Palm Hand Workplace Laptop computer Typing
- 【Softer and Extra Comfy】Vaydeer wrist relaxation has distinctive diamond sample, which is the mixture of softness and aesthetics. The supplies of wrist relaxation are improved into larger high quality reminiscence foam and coated with silky clean lycra. The pc wrist relaxation makes you as comfy and cushiony as like relaxation your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist help. Based mostly on ergonomic design, the distinctive concave form is the proper match to your wrist joints. The wrist relaxation pad suits most laptop keyboards and laptops, enhance hand and wrist posture, launch your wrist and arm stress.
- 【Non-Slip Rubber Backside】That includes an anti-skid silicone base on the underside, this wrist keyboard help stays firmly in place in your desk, stopping the padding from sliding round, making certain secure and constant wrist help throughout prolonged laptop periods.
- 【Higher Expertise & Ache Reduction】Our keyboard arm relaxation is useful to alleviate the soreness brought on by direct contact and friction between your arm and a tough desk floor, lowering the chance of wrist fatigue or carpal tunnel. The delicate texture of reminiscence foam can evenly distribute the stress round your wrists and supply good help with simply sufficient give.
- 【Useful in A number of Situations】Whether or not you are working, learning, writing, typing, gaming, this keyboard and mouse relaxation combo is a necessary accent so as to add consolation and help to your palms and wrists. It’s additionally an amazing reward for males, ladies, household, buddy, coworker, gamer, trainer, and many others.
Particularly, I wish to show the distinction between two textual content strings, “My identify is Victor” and “My identify is Ashiedu”. Right here is the command…
Evaluate-TextStrings -FirstTextString "My identify is Victor" -SecondTextString "My identify is Ashiedu" -DisplayDifference
The distinction between this final command and the earlier one are the parameters, DisplaySimilar and DisplayDifference.

4. Show the Similarity and the Distinction Between Two Textual content Strings
This instance combines the final two examples. This time, I wish to show the similarities and variations between two textual content strings.
Just like the opposite examples, my two textual content strings are: “My identify is Victor” and “My identify is Ashiedu”. Right here is the command:
Evaluate-TextStrings -FirstTextString "My identify is Victor" -SecondTextString "My identify is Ashiedu" -DisplaySimilar -DisplayDifference

5. Ship the Similarity and the Distinction Between Two Textual content Strings to a Textual content with No Path Parameter
In the event you slightly ship the output of the Evaluate-TextStrings perform to a textual content file, specify the OutFile parameter. Optionally, you may specify the Path parameter.
If you don’t specify the Path parameter, the perform will save the file in your Temp folder. See the parameters part of this information for extra particulars.
Finest Worth
Underneath Desk Cable Administration Tray No Drill, Metallic Mesh Cable Administration Underneath Desk with Clamp Mount, 2 Gap Cable Tray with Wire Administration and Wire Organizer for Residence Workplace Standing Desk
- 【No Drill Mounted】Cable administration tray may be assembled in as little as 3 minutes or less-simply. Aspect clips simply clampe the sting of desk, go by the holes on the perimeters, and safe extra cables with baskets. Desk cable administration helps inward or outward set up to fulfill your wants in numerous situations, and gives you with nice comfort when accumulating and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer below desk built-in delicate rubber pads on the clamp shield your desk from scratches, so you’ll not harm your furnishings or workplace.
- 【Sturdy and Lovely】Wire administration below desk is fabricated from high-quality carbon metal and holds about 15 lbs. The wire basket has 2 holes on all sides of the tray to allow your cables to go freely. Cable baskets are appropriate for desk thickness use from 0.4″ to 2″.
- 【House Saving & Maintain Organized】Desk cable administration tray holds all of your energy cords, outlet strips, USB hubs and laptop transformers hidden out of your ft, and the information cables is not going to enter the vacuum cleaner to maintain your desk clear and tidy. Desk wire organizer can also be appropriate to be used within the kitchen and outdoor.
- 【Cut back Security Dangers】Cable tray below desk retains all plugs away out of your youngsters, no extra fear about tripping. Utilizing 2 holes wire tray saves additional area, helps you simply cabling and wire safety. The mesh design shouldn’t be straightforward to build up mud, however avoids security accidents brought on by messy wires.
Right here is the command…
Evaluate-TextStrings -FirstTextString "My identify is Victor" -SecondTextString "My identify shouldn't be Bunmi" -DisplaySimilar -DisplayDifference -OutFile
The command doesn’t return any outcome on the PowerShell console. Moderately, it creates a textual content file. Here’s a screenshot of the textual content file…

6. Ship the Similarity and the Distinction Between Two Textual content Strings to a Textual content File with the Path Parameter
Within the final instance, I didn’t specify the Path parameter. So, the perform saved the textual content file report in $env:TEMPCompareString.
Nonetheless, in order for you the perform to save lots of the textual content file in a location you specify, use the Path parameter. Right here is an instance command:
Evaluate-TextStrings -FirstTextString "My identify is Victor" -SecondTextString "My identify shouldn't be Bunmi" -DisplaySimilar -DisplayDifference -OutFile -Path D:G-Drive-P
The command saves the textual content file in D:G-Drive-P.

Conclusion
Identical to you, I needed to check two textual content strings with PowerShell however I couldn’t discover a Cmdlet. So, I created a perform referred to as Evaluate-TextStrings.
You need to use this perform to check any two textual content strings. The perform can both show the outcome within the console or ship it to a textual content file.
Along with that, you may show the similarity between the textual content strings. Alternatively, you may show the distinction between the 2 textual content strings.
I hope you discovered this practice perform helpful. I additionally hope that I used to be capable of clarify how the perform works.
In that case, click on on “Sure” beside the “Was this web page useful” query under. You might also categorical your ideas and opinions through the use of the “Depart a Remark” type on the backside of this web page.
Lastly, to obtain extra free PowerShell scripts and features, go to our PowerShell Script Repository web page.
Product costs and availability are correct as of the date/time indicated and are topic to vary. Any worth and availability info displayed on Amazon on the time of buy will apply.





