![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| | |||||||
| | Vista - What is the difference between -eq and = |
| |
| 12-10-2008 | #1 |
| | What is the difference between -eq and = I had a script that looked to see if $count = 0. It did not work until I tried $count -eq 0 What is the difference? |
| My System Specs |
| 12-10-2008 | #2 |
| | Re: What is the difference between -eq and = '=' is an assignment operator, assigns a value to a variable or property '-eq' is a comparison operator, cheks for equality -- Kiron |
| My System Specs |
| 12-10-2008 | #3 |
| | Re: What is the difference between -eq and = When you write $count = 0, PowerShell provide new value assignment to variable, but not value comparing. If you want to compare, has variable appropriate value or not, you must to use comparison operators ( -eq, -ne, -le, etc). Similar behaviour is in C++ language (when you compare variable value, then you must use double assignment operator: if variable == 0 ...). -- WBR, Vadims Podans PowerShell blog - www.sysadmins.lv "Jacob Sampson" <JacobSampson@xxxxxx> rakstīja ziņojumā "news:52AA9171-4E76-4C00-8447-73671C4F81B4@xxxxxx"... Quote: > I had a script that looked to see if $count = 0. It did not work until I > tried $count > -eq 0 > > What is the difference? |
| My System Specs |
![]() |
| Thread Tools | |
| |
| Similar Threads for: What is the difference between -eq and = | ||||
| Thread | Forum | |||
| Difference between 32-bit and 64-bit | General Discussion | |||
| I can't believe the difference | Vista General | |||
| What is the difference | Vista music pictures video | |||
| What is the difference? | Vista General | |||
| What is the difference between Pre-RC1 and RC1? | Vista installation & setup | |||