I copied the script into a command console first and now it runs fine, does not bring up the error. But when I setup a schedule task, and copy the text into the task and then run it in schedule task, it gives no output, its like it does not run, even though the status is saying running which stays running, but nothing eventually happens.
The only thing I can think which maybe causing the issue might when i ran the script in the command line or when i run the script manually it prompts me with a security warning, and then I have to choose if I do not want to run, or run once, or suspend. I choose R to run once, and then the script runs.
Would this security warning cause the script not to run automatically, would I need to put something in the script to overcome this security warning.
Any advice thanks