Powershell Error when run the script automatically

Viewed 107

I was using the following code cmd /c $hash > $in 2>&1 to run a specific executable file using powershell. Here are the issues i face

  1. This commands works in PC but not servers.
  2. This commands can run perfectly in manually way in server, but when schedule, it hit into error as following

UnicodeEncodeError: 'charmap' codec cant encode characters in position 33-35: character maps to undefined

Kindly help.

1 Answers

As I know that I have faced same kind of issue when developing script in python & after lot of search I have found that I am facing charmap issue because of encoding issue.

What I need to do is set utf-8 as default encoding & after setting it in my python script I am able to solve above issue.

Try to set proper encoding while reading file or opening file & hope you will find solution for your problem.

Related