2016-11-30 646 views
1

我有一個PowerShell腳本test.ps1,我試圖從test.bat文件執行它。我的批處理文件包含:從.bat文件執行PowerShell腳本時出錯

@echo off 
Powershell.exe -File D:\Testfolder\testsubfolder\test.ps1 
pause 

而且我得到的錯誤:

'■@' is not recognized as an internal or external command, operable program or batch file.

有人能指出我應該正確地運行它什麼樣的變化?

+0

您能否發佈代碼請 – Miguel

+3

這看起來像一個編碼問題。爲了調試它,你應該考慮[創建一個MCVE](http://stackoverflow.com/help/mcve)。 – vonPryz

+0

包含腳本文件的第一對字節的hexdump。 –

回答

1
  1. 您的批處理文件重命名爲.txt格式
  2. 用記事本打開該文件
  3. 更改編碼使用另存爲方法ANSI(編碼將在保存文件窗口的底部)
  4. 再次保存該文件並將其重命名爲.bat格式
+0

它工作@ Random206,實際上我複製了舊的bat文件,並更新了它裏面的腳本,當我創建新文件時,你建議它的工作。謝謝 – SDLBeginner

+0

沒問題,樂意幫忙。 – Random206

相關問題