将下面的代码保存为复制代码 ,执行后发现前3个字符均被截掉了,请大佬指教- <# : Begin batch (batch script is in commentary of powershell v2.0+)
- @echo OFF
- chcp 65001
- : Use local variables
- setlocal
- : Change current directory to script location - useful for including .ps1 files
- cd %~dp0
- : Invoke this file as powershell expression
- powershell -executionpolicy remotesigned -Command "Invoke-Command -ScriptBlock ([scriptblock]::Create($([System.IO.File]::ReadAllText('%~f0')))) -ArgumentList ([string]'%*').split()"
- : Restore environment variables present before setlocal and restore current directory
- endlocal
- : End batch - go to end of file
- goto:eof
-
- #>
- # here start your powershell script
-
- # example: include another .ps1 scripts (commented, for quick copy-paste and test run)
- #. ".\anotherScript.ps1"
-
- # example: standard input from console
-
- Write-Host 'Running ...测试'
复制代码 最后发现是自己编辑器的问题 |