batch

A typical output of net user command produces 3 columns of usernames with the last row containing up to three columns. C:Users kreider>net user User accounts for \CTCRK-10 ——————————————————————————- Administrator DefaultAccount Guest LocalAdmin The command completed successfully. To filter this, I’ll use a for loop and set 3 tokens. Tokens 2 and/or 3 could be…

Read More Get Domain Users Last Logon and Account Status Windows Batch

The following batch script will add a group of users to Windows, set no password, and require a password change at first logon. @echo off setlocal enabledelayedexpansion set user1=John Q. Smith set user2=Jane Doe set user3=Joe Montana set user4=Alicia Silverstone set users=(user1 user2 user3 user4 user5 user6) for %%u in %users% do ( echo net…

Read More Batch Script Add Windows Users using Netsh

Rob van der Woude has a nice batch script to get disk usage of folders & subfolders in Windows since there isn’t a built-in function.  This could be similar to Linux du command.   @ECHO OFF :: Use local variables IF "%OS%"=="Windows_NT" SETLOCAL :: Check command line arguments and Windows version ECHO.%1 | FIND "/"…

Read More Batch Script to get Disk Usage of Folders Recursively

I’ve had this around for the longest time and figured I better put it here before I lose it forever to the dying Microsoft releases. Note: This also cleans up VMware temporary files which build up over time. See this post for more information:  VMware Tray Dump Files Chewing up Space Update: Added line to…

Read More Batch File to Cleanup Windows 2000, XP and Server 2003 User Profiles, Temp Folders, Internet Explorer Temporary Files

Batch rename files using Windows command line. for /d /r %x in (“*”) do pushd “%x” && ren *.eml *.msg && popd Recently restored about 18k emails in various folders from a PST file which exports as an .MSG formatted file. I then reconverted those .MSG to .EML format. Now, the mail server I’m using…

Read More Batch Rename Files and/or Folders in Windows Command Line