0

I have a scheduled task to rebuild site cache every 10 minutes, and I use powershell to do so. However it's annoying when the powershell command promt pops up while im in middle of something, so I was wondering if it's possible to automatically run it in the background so it doesnt interrupt anything. If not, is there any other command I can use to run a webpage without interrupting?

Heres my line

powershell -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadString(\"http://localhost/rebuildcache.php\")"
Chriham
  • 49
  • 5

1 Answers1

0

You can add -WindowType to your command line. The parameter would be hidden. Your code would look like this:

powershell -ExecutionPolicy unrestricted -WindowType Hidden -Command "(New-Object Net.WebClient).DownloadString(\"http://localhost/rebuildcache.php\")"

That should run the command with the powershell window hidden. You will see a flash of the command window but you can remove that as well by using the system account to run the job if it you don't need any particular account to run it.

I hope this helps.