怎样从 bat 批处理文件调用 PowerShell 脚本
2021-08-24 17:13 jetwill 阅读(1735) 评论(0) 编辑 收藏 举报https://stackoverflow.com/questions/19335004/how-to-run-a-powershell-script-from-a-batch-file
https://stackoverflow.com/questions/36135753/invalid-path-when-running-a-batch-command
P:\>powershell.exe -ExecutionPolicy ByPass "& 'P:\demo.ps1'"
P:\>type demo.ps1
get-service
P:\>
copy_ssh_from_p_to_c.bat
@echo off
powershell.exe -executionpolicy remotesigned -File P:\Script\copy_ssh_from_p_to_c.ps1
copy_ssh_from_p_to_c.ps1
copy-item P:\.ssh C:\Users\chenjo -recurse -force
copy-item P:\.bash_history C:\Users\chenjo\
copy-item P:\.bash_profile C:\Users\chenjo\
copy-item P:\.bashrc C:\Users\chenjo\
copy-item P:\.gitconfig C:\Users\chenjo\
copy-item P:\.minttyrc C:\Users\chenjo\
copy-item P:\.viminfo C:\Users\chenjo\
copy-item P:\_viminfo C:\Users\chenjo\