I get this error while initiating a command that I created and has previously worked. I moved the files from my Macbook hard drive to a thumb drive and got the same message. I just upgraded to v22.3 and nstill the same message.
I found the problem, although seemingly unrelated. Two months ago, before this issue arose, I decided to backup my Desktop files to iCloud. I didn't know that this would remove all of my files from my Desktop. This started creating other issues for which I found work arounds. Today I reversed the process with the help of Apple Support. Now all is well with my PS Batch commands. It didn't occur to me that This might be the source of my PS issues since the files I was accessing were on an external hard drive. Thanks for your help.