Evening hours all,
PowerShell is definitely no different and I am going to take some time to cover the basics of PowerShell by looking at the If/Else/ElseIf statements to help you know when and where to use them. Working in PowerShell, there will be times that you need to perform some sort of comparison to determine what kind of action should take place. In PowerShell conditions, the elseif and else statements are optional. By default, all comparison operators (-eq, -lt, -gt, etc.) are case-insensitive. To make a comparison operator case-sensitive, precede the operator name with a 'c' (-ceq, -clt, -cgt, etc.). In PowerShell, zero is false and anything non-zero is true.
I'm slowly learing powershell so uncovered with mé!
ivé produced this program code to run a program (MetaX) when a file extension will be existing in a foIder. but whén it finds x quantity of document expansion it attempted to operate the plan x amount of moments.
i believe it can be something to do with the if else function but i actually could be incorrect. I initially attempted for each then tried where-object.
can be presently there any various other alternative to this as operating the plan 5 situations down to been 5 extensions in the folder it will be looking doesnt function well with the software?
very much valued
Cónnor BracegirdIe
Cónnor BracegirdleCónnor Bracegirdle
4 Solutions
Thé object is returning even more than one file with that expansion. After that you are usually doing the program each time that expansion appears. Merely check if the expansion is available, ie accurate or false. Based on that result, carry out your program.
KeItariKeltari
Managéd to obtain it partially to work Thanks a lot Keltan for the advice.
Functions fine to some respect but it doesnt appearance át.mp4 in the foIder and itll nevertheless operate the system if nothing at all is inside, one factor im confussed upon is usually the $fake and $genuine. id have even though on the series
would have been Accurate?
Cónnor BracegirdleCónnor Bracegirdle
lIUR you wish to run metax.exe as soon as offered there will be at least one.mp4 file in the route:
LótPingsLotPings
Lastly got my head round it. very first proceeded to go for real or false and after that slipped upon the Test-Path functionality, experienced a little play around and handled to get it to work for this instance. I think if I has been searching for something even more complex after that this would'nt work which I have discovered on another problem im getting (various question completely will place another post for this)
Many thanks for all you're assist, im savoring learning powersheIl
Cónnor BracegirdleCónnor Bracegirdle