SDLBeginner
SDLBeginner

Reputation: 837

Getting error while executing PowerShell script from a .bat file

I have one PowerShell script test.ps1 and I am trying to execute it from a test.bat file. My batch file contains:

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

And I am getting the error:

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

Can someone point out what change I should make to run it correctly?

Upvotes: 3

Views: 1331

Answers (1)

Random206
Random206

Reputation: 826

  1. Rename your batch file to a .txt format
  2. Open the file in Notepad
  3. Change the Encoding to ANSI using the Save As method (encoding will be at the bottom of the save file window)
  4. Save the file again and rename it back to a .bat format

Upvotes: 3

Related Questions