1

Created a GPO to run a batch file on shutdown for domain XP computers - with the purpose of deleting old user profiles.

For this I am using an application called DeleteProfiles from OptimumX.

cd C:\
if exist "Program Files (x86)" GOTO Exit (Checks if XP or not)
if exist DeleteProfiles GOTO COMMAND

:CopyDeleteProfiles
md DeleteProfiles
copy /Y \\SomeShare\SomeFolder\DeleteProfiles\DeleteProfiles.exe 
C:\DeleteProfiles\

:COMMAND
pushd C:\DeleteProfiles\
start /Wait DeleteProfiles.exe /MIN:14 /Y  

(/Min: # = Delete profiles older than # and /y removes yes or no prompts)

:Exit
End

It works alright, but, a CMD screen appears appears at shutdown, with the output of the program. How do I make it go away?

The real problem here is that users can close the program which causes the script to stop. If I can't make that go away, I would like at least to make the screen not close-able.

3
  • Have you tried the start /b option? "/B Start application without creating a new window. "
    – DavidPostill
    May 26, 2017 at 12:42
  • Wow, thanks! that was it! should have looked up start /? haha
    – Alex.T
    May 26, 2017 at 13:03
  • Great. I shall add an answer, which you will able to accept.
    – DavidPostill
    May 26, 2017 at 13:05

1 Answer 1

0

How do I make it go away?

You can use start with the /b option:

start /b /Wait DeleteProfiles.exe /MIN:14 /Y

/B - Start application without creating a new window. In this case ^C will be ignored - leaving ^Break as the only way to interrupt the application.

Source - start


Further Reading

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .