我需要帮助修复正在执行到powershell的批处理文件
我尝试在批处理文件中调用这些powershell脚本,如下所示:我需要帮助修复正在执行到powershell的批处理文件,powershell,batch-file,Powershell,Batch File,我尝试在批处理文件中调用这些powershell脚本,如下所示: Powershell.exe -executionpolicy remotesigned -File d:\1.ps1 Powershell.exe -executionpolicy remotesigned -File d:\2.ps1 Powershell.exe -executionpolicy remotesigned -File d:\3.ps1 Powershell.exe -executionpolicy re
Powershell.exe -executionpolicy remotesigned -File d:\1.ps1
Powershell.exe -executionpolicy remotesigned -File d:\2.ps1
Powershell.exe -executionpolicy remotesigned -File d:\3.ps1
Powershell.exe -executionpolicy remotesigned -File d:\4.ps1
我运行了该批处理文件,并针对2.ps1
、3.ps1
和4.ps1
参数文件的参数d:\2.ps1不存在。提供文件d:\2.ps1(2.3.4)的访问路径,该文件作为参数-file的参数存在
文件位于我调用它们的驱动器中,3和4无法执行,因为它们连接到脚本2.ps1
我不知道在
1.ps1
之后调用2.ps1
有什么问题,因为它是同一个命令,如果我手动执行文件,它们运行得很好。尝试这样调用:
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File "d:\1.ps1"
基本上,我要做的是在批处理文件中调用网络使用,1)在2)在每行末尾添加“ok”和“microsoft bla bla”,3)在3)删除每一个空格和每一个空行,4)在请求每行网络使用时添加,并生成一个“mapped drives.bat”“这个等式的结尾示例是:net use x:\\server\drive/persistent yes。bat映射驱动器的名称。bat脚本是否都已签名?或者换句话说,为什么要将RemoteSigned指定为执行策略?不确定这是否与您的问题有关,因为错误消息暗示powershell无法打开2.ps1文件。只是问一下。即使我去掉了远程签名,也会给我同样的错误吗?我不知道为什么。当你把所有路径都用双引号括起来时会发生什么?比如说<代码>-文件“D:\2.ps1”您的powershell脚本的真实名称和路径是什么?因为,老实说,在现实世界中,没有头脑清醒的人会用一位数的名字来创建脚本。