I am doing a powershell task manually i.e. opening the powershell as an administrator and executing the command pushd D:\PowerShellTry
and command .\FileWatcher.ps1
in powershell.
I wrote a myScript.bat
to automate the manual task through a bat file. Below is the code which I wrote for my bat file to automate it:
powershell -Command "& {Start-Process powershell.exe -Verb RunAs; pushd D:\PowerShellTry; .\FileWatcher.ps1}"
But it is not working. How can I do this correctly?