Advertisement
This is comment for paste
SD JPG
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lmao, thanks chatgpt
- > Alternatively, you can cast the variable to a string with [string]::Concat()
- No. No no no.
- > The script you've provided uses the $_ variable to reference the current item in the pipeline during the ForEach-Object loop. This variable contains the current file name, so you can use it to reference the file in your commands.
- >
- > If the filenames contain special characters such as { or [, you need to make sure that PowerShell treats them as literal strings and not as special characters.
- >
- > You can use the -LiteralPath parameter when calling Get-Item and magick convert commands, like this:
- >
- >Copy code
- >$PNG = Get-Item -LiteralPath $_
- > magick convert -LiteralPath .\$_ -quality 88 -define preserve-timestamp=true .\$($_.BaseName).jpg
- I'm pretty sure magick convert isn't a PowerShell commandlet, but it's got the spirit. It works now, lmao.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement