Tag: powershell

Claude Code PowerShell tool

Tools reference - PowerShell

You can now opt-in to a new built-in PowerShell tool in Claude Code as of v2.1.84 by setting the CLAUDE_CODE_USE_POWERSHELL_TOOL environment variable.

Until this release, Claude Code on Windows would use Git Bash to run commands, which has caused some weird issues for me in the past, such as running the roslyn-language-server dotnet tool, because the entrypoint is a .cmd file which can't be run in a git bash shell.

Now, Claude Code will see an additional tool called "PowerShell"

  Built-in Tools

  - Read — Read files from the filesystem
  - Write — Write/create files
  - Edit — Make exact string replacements in files
  - Bash — Execute shell commands
  - Glob — Find files by pattern
  - Grep — Search file contents with regex
  - Agent — Launch specialized subagents
  - Skill — Invoke user-defined skills
  - ToolSearch — Fetch schemas for deferred tools
  - PowerShell — Execute PowerShell commands
It doesn't replace the Bash tool, it just adds PowerShell, so you may find that the agent defaults to using Bash for most things unless you ask it to use PowerShell explicitly.

You can also add { "defaultShell": "powershell" } to your settings.json file to make !commands run in PowerShell. This means you can now run cmdlets directly. For example: ! Write-Host "Hello" now works.
hello world
# / 2026 / 03 / 26

Splitting MKV files by chapter using ffmpeg

PowerShell Script

Created a small PowerShell scripts to split up MKV files by chapters. I wanted to avoid downloading yet another tool (handbrake or MKVToolNix) and I like the idea that I can use ffmpeg to do everything. For context, I have a DVD of Weird Al's ultimate music video collection that I got in middle school that I want available in Plex. I used MakeMKV to rip the DVD but all the music videos are in a single file, separated by chapters.

Weird Al
# / 2025 / 12 / 30

Set default pipe/redirect encoding in Python

[via] Changing default encoding of Python? - StackOverflow

I ran into an issue using llm today where I was unable to save a response to a file using a pipe

llm llm logs -n 1 | Out-File response.txt
This would give me the error "UnicodeEncodeError: 'charmap' codec can't encode character '\u2192' in position 2831: character maps to <undefined>"

If you set the "PYTHONIOENCODING" environment variable to "utf8", it will fix the issue. This is because Python's default encoding is ASCII. Since the last response I got back from the model contained a non-ASCII character, this error was thrown.

So now, in my PowerShell profile, I've added a line to set the default to utf8, which fixes the issue.

$env:PYTHONIOENCODING = 'utf8'
# / 2025 / 04 / 21