Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

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?




Date Votes
  • Deploy executes Command steps as a batch file, so variables need 2 % symbols:

    This PowerShell code should do the same thing:

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