【批处理】通过bat运行powershell脚本

通过bat运行powershell脚本

@echo off
pushd "%~dp0%"
for /f "delims=:" %%i in ('findstr /n "^:ps1$" "%~f0"') do (
	more +%%i "%~f0" > "%temp%\test.ps1"
)
powershell -executionpolicy remotesigned -file "%temp%\test.ps1"
goto :eof

:ps1

获取时间

$(get-date)

posted @ 2023-02-02 14:48  Janexiaoer  阅读(1212)  评论(0)    收藏  举报