Answer the question
In order to leave comments, you need to log in
PowerShell script not working. Where is the mistake?
What's wrong? I did everything, as in the example from one site. I do not understand.
And in general, the script from the file is somehow strangely launched. First displays the contents of the file, and then the result. I work from under Visual Studio Code.
[string]$file = Get-Item C:\Windows\explorer.exe
"Размер файла $file составляет $($file.Length) байт"
"Размер: {0:n3} мегабайт" -f ($file.Length / 1mb)
F:\Programming\PowerShell\TextFormat.ps1:8 char:17
+ "P P°P·RјPµSЂ S„P°P#P»P° $file SЃPsSЃS‚P°PIR»SЏPµS‚ $($file.Length) P ...
+ ~~~~~~~~
Unexpected token "P°P#P"P°" in expression or statement.
F:\Programming\PowerShell\TextFormat.ps1:9 char:39
+ "P P° P·PјPµСЂ: {0:n3} PјPµPіR°P±P°P#C‚" -f ($file.Length / 1mb)
+ ~~~~~~~~~~~~~~~~~~~ ~~~~~~
The string is missing a trailing character: ".
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question