Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for cdeject.ps

(view source code of cdeject.ps as plain text)

  1. param( [string] $help )
  2.  
  3. if ( $help -eq "" ) {
  4. 	if ( $HOME[0] -eq "/" ) {
  5. 		# Linux
  6. 		eject
  7. 	} else {
  8. 		# Windows
  9. 		$colCDROMs = ( new-object -COM WMPlayer.OCX.7 ).cdromCollection
  10. 		for ( $i = 0; $i -lt $colCDROMs.count ; $i++ ) { $colCDROMs.Item( $i ).eject( ) }
  11. 	}
  12. }
  13. else {
  14. 	write-host
  15. 	write-host "CDEject.ps1, Version 1.01"
  16. 	write-host "Eject all CDROMs"
  17. 	write-host
  18. 	write-host "Requires Windows Media Player in Windows."
  19. 	Write-Host "Uses native `"eject`" command in Linux."
  20. 	write-host
  21. 	write-host "Windows code based on VBScript code posted by Christoph Fricke"
  22. 	write-host "in the microsoft.public.de.german.scripting.wsh newsgroup"
  23. 	write-host
  24. 	write-host "Written by Rob van der Woude"
  25. 	write-host "http://www.robvanderwoude.com"
  26. 	write-host
  27. }
  28.  

page last uploaded: 2015-12-04, 16:51