r/PowerShell • • Apr 24 '26

Solved Scripts not running but powershell doesn't show any errors

I am trying to run some scripts I wrote on my local system for file transfers and some other things. When I run them nothing happens. No error, no output just nothing. I've googled it for hours but all I can find is stuff about the execution policy which I already changed but didn't help. All of these scripts have run just fine before so I don't know what changed.

7 Upvotes

30 comments sorted by

View all comments

Show parent comment

1

u/Kirsh1793 Apr 25 '26 edited Apr 25 '26

If you don't break out of the switch in each case, you don't actually need the foreach loop around it. You can just do switch($nums) {} and PowerShell will run each case matching a value of $nums. :)

About Switch - flow control