/* close.cmd - uses sendmsg.exe 1.0 by Martin Vieregg */ /* */ /* Close any open program or folder from the command line by */ /* specifying its name (not the path!) */ /* Requires 'sendmsg.exe' to be in your path */ /* */ /* Parameters : name : the name of the program (folder) to close */ /* default is current directory */ /* */ /* Usage : close [name] */ '@echo off' parse arg objectName if objectName = "" then do /* no object name was given, so use the current directory */ objectName = substr(directory(),lastpos('\',directory())+1,) end if translate(objectName) = "DESKTOP" then do /* user really wants to close the desktop ? */ answer = "N" say "Do you really want to close the Desktop? (y/N) :" pull answer if answer <> "Y" then signal exit; end /* close it! */ 'sendmsg' objectName WM_CLOSE '> nul' exit: exit