Getting the current working directory
cd /d %~dp0
Comment: %0 is the name of the batch file. ~dp gives you the drive and path.
Vista and WIN7 now supports symbolic links, a feature that has been enjoyed in UNIX for a long time.
Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file
/H Creates a hard link instead of a symbolic link.
/J Creates a Directory Junction.
Link specifies the new symbolic link name.
Target specifies the path (relative or absolute) that the new link
This useful command lets you wait for signals from other command windows or even across the network.
waitfor.exe is in windows\system32 directory.
The simple case for the tool is in one command window you do a “waitfor foobar” and it’ll block until in another window you do a “waitfor /SI foobar”.
powercfg.exe is a windows built in tool to config power management. powercfg.exe is a command line utility, it’s easy to integrate powercfg.exe into scripts.
Turn hibernation off
powercfg -hibernate OFF
Set the power configuration to High Performance
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
Set the absentia power scheme (the scheme used when no one is logged in)
powercfg.exe -setabsentia 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c
Enabling the built-in administrator account:
net user administrator /active:yes
Disabling the built-in administrator account:
net user administrator /active:no
Note: Must use an elevated command prompt for this command to work.
netdom.exe renamecomputer %computername% /NewName:<new name> /userd:domain\user /passwordd:*
wmic.exe computersystem where name="%computername%" rename name="<new name>"