powershell命令没有在.bat文件中运行?
发布时间:2020-12-15 21:32:08 所属栏目:安全 来源:网络整理
导读:我正在尝试制作一个简单的脚本来设置我的 gcc变量.作为.bat文件. 变量设置如下 $env:Path += ";C:UsersBrettCompilersMinGWbin" 当我输入/粘贴到电源外壳时运行正常. 但当我粘贴到脚本myscript.bat,并通过powershell运行它时,我收到此错误: C:UsersB
我正在尝试制作一个简单的脚本来设置我的
gcc变量.作为.bat文件.
变量设置如下 $env:Path += ";C:UsersBrettCompilersMinGWbin" 当我输入/粘贴到电源外壳时运行正常. 但当我粘贴到脚本myscript.bat,并通过powershell运行它时,我收到此错误: C:UsersBrettCompilers>"$env:Path += ";C:UsersBrettCompilersMinGWbin"" The filename,directory name,or volume label syntax is incorrect. PS C:UsersScruffyCompilers> 解决方法
PowerShell是Windows命令行(cmd.exe)的独立执行环境
如果要从批处理文件运行powershell命令,则需要保存powershell脚本(.ps1)并将其作为命令行参数传递给powershell.exe. 例: powershell.exe -noexit c:scriptstest.ps1 More Information is available here on Microsoft TechNet (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |