Advertisement
BuccoBruce
Jan 25th, 2023
19
0
Never
This is comment for paste SD JPG
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. lmao, thanks chatgpt
  2. > Alternatively, you can cast the variable to a string with [string]::Concat()
  3. No. No no no.
  4. > 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.
  5. >
  6. > 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.
  7. >
  8. > You can use the -LiteralPath parameter when calling Get-Item and magick convert commands, like this:
  9. >
  10. >Copy code
  11. >$PNG = Get-Item -LiteralPath $_
  12. > magick convert -LiteralPath .\$_ -quality 88 -define preserve-timestamp=true .\$($_.BaseName).jpg
  13. 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