I have a folder with several subfolders. A powershell-script is located in each subfolder. The name of the powershell is the same in every subfolder ('execute.ps1'). How can i recursively iterate through all subdirectories and call 'execute.ps1' ?
I tried for /r %%i in (*) do execute.ps1
However this did not work. I got an error :
"Command execute.ps1 is either misspelled or could not be found."
Solution:
@echo off
for /r /d %%f in (*) do pushd "%%f" & Call powershell.exe -executionpolicy remotesigned -File execute.ps1 & popd
pause
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.