PowerShell does not run when right-clicked to run PowerShell.

Asked 5 months ago, Updated 5 months ago, 13 views

If you copy the following to PowerShell, the script will run without any problems.
If you put a space between ★, the screen will drop without processing when you run it in powershell.
Even if you put pause in ●, it will fall off without stopping.

if (-not(Test-Path$TargetLogFolder)){
    Add-Type-Assembly System.Windows.Forms
    System.Windows.Forms.MessageBox::Show("The file does not exist., "Caution", "OK", "Warning", "Button 3")
$g = "C:\hoge"
$o = Get-Date-format "yyyyMMdd_HHmmss"


2022-09-30 11:43

1 Answers

I was able to solve this question. The solution is to save the script itself from UTF-8 to ANSI and run Powershell to ensure it works.

2022-09-30 11:43

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.