Script Error in PDQ Deploy - Runs fine locally

I am trying to run a command that deletes folders that start with CefSharp* through PDQ Deploy on a computer and it keeps failing with the following error: LOCALAPPDATA~G" was unexpected at this time.

for /d %G in ("%LOCALAPPDATA%\Temp\CefSharp*") do rd /s /q "%~G"

When I run the above command on the computer in command prompt it works and deletes all the folders in the current user's appdata\local\temp folder that start with CefSharp.  

What am I missing?

 

1

Comments

2 comments
Date Votes
  • Deploy executes Command steps as a batch file, so variables need 2 % symbols: https://ss64.com/nt/for.html

    This PowerShell code should do the same thing:

    Remove-Item -Path "$env:LOCALAPPDATA\Temp\CefSharp*" -Recurse -Force
    1
  • Well *$#^ that worked beautifully!  Thanks, man!

    1

Please sign in to leave a comment.

Didn't find what you were looking for?

New post