3
I have the following script:
$ExistPath = Test-Path -PathType container C:\Publicação\SQL-Release\Services
if ($ExistPath)
{
Write-Host "Removendo diretorio!"
Remove-Item -Path C:\Publicação\SQL-Release\Services -Recurse -Force
}
Write-Host "Criando diretorio!"
New-Item -ItemType Directory -Force -Path C:\Publicação\SQL-Release\Services
Copy-Item .\Services\MyServices\bin\Release C:\Publicação\SQL-Release\Services\Nalin -Recurse
But when I run it creates a directory with very different characters than expected. In this case:
C:\Publicação
How to solve?
Thank you.
I ran the script here on my computer and it worked, created the directory correctly [C: SQL-Release Services publication], it is normal to have this divergence of encoding?
– Mathiasfc
I put the command as the first line of my script and it did not work as expected. But when I changed the way the script file from UTF-8 to UTF-8 with BOM worked.
– Rodolpho Sa
@Mathias as far as I know the Powershell console already opens with a selected default encoding. I don’t know if this behavior is repeated in all versions of the console, or even Windows (because this may be the system and not Powershell itself).
– Oralista de Sistemas
@Rodolphosa o BOM alters the encoding of the file, so that must be it.
– Oralista de Sistemas