# Batch script command to by pass pressing OK.



## S.H.A.D.O. (Mar 17, 2018)

Good evening,

I hope this is the right place to post this?

I want to run the below command in a batch script.
It does actually work fine but I have to press "*OK*" for it to continue or "*Cancel*" to not.
How can I adapt the script below so it automatically presses the "*OK*" for me in the script please?
I don't want the popup box to appear.
I have tried */Q* at the end, I have also tried *Click [OK]* but to no avail.
Any help will be greatly appreciated.


```
echo off
echo.
echo [12] Running extended cleanup...
cd C:\windows\system32 
%SystemRoot%\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
echo. & echo This process completed successfully. & echo. & pause & cls
exit
```

Thanks in advance.


----------



## B___P (Mar 18, 2018)

Hi S.H.A.D.O.,
not tested but give it a go


```
echo off
echo.
echo [12] Running extended cleanup...
cd C:\windows\system32 
[COLOR=#ff0000]Shell("[/COLOR]%SystemRoot%\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535[COLOR=#ff0000]")[/COLOR]
echo. & echo This process completed successfully. & echo. & pause & cls
exit
```

Have a nice evening


----------



## S.H.A.D.O. (Mar 18, 2018)

Thanks for the reply *B___P*, it is appreciated.

Unfortunately that gives me an error saying:

'_*Shell' is not recognised as an internal or external command, operable program or batch file.
*_
Thanks in advance.


----------



## B___P (Mar 18, 2018)

Sorry S.H.A.D.O.,
I thought it was a kind of vb script but it is part of a bat file.
Change

```
%SystemRoot%\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
```
to
 Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
I think you do not need to run cmd.exe ...

Hope this helps


----------

