Delete file in Windows


I am trying to delete file in the path. I run the below script it’s showing completed, but it not removing the file.

script 1
delete “{C:\Windows\System32\GroupPolicy\DataStore\0\SysVol\\Policies{79718A1B-F63F-40D6-B205-386866D8292D}\Machine\Scripts\Startup}\KcsSetup72886737.exe”

script 2
delete “C:\Windows\System32\GroupPolicy\DataStore\0\SysVol\\Policies{79718A1B-F63F-40D6-B205-386866D8292D}\Machine\Scripts\Startup\KcsSetup72886737.exe”

The exact issue is that the path containing curl bracket, could any one help on this?


You should try escaping the curly braces to disable relevance substitution

delete "C:\Windows\System32\GroupPolicy\DataStore\0\SysVol\\Policies{{79718A1B-F63F-40D6-B205-386866D8292D}\Machine\Scripts\Startup\KcsSetup72886737.exe"

You may also need to disable wow64 redirection as “System32” folder may be redirected to “Syswow64”

1 Like