Applies to:
- Windows 7
- Windows 2008
- Windows Vista
pow·er·cram noun, \ˈpau̇(-ə)r\ˈkram\
Consise, useful information about computers, networks and cloud.
iisreset /restart
net statistics workstation | find "Statistics"You can shortcut it as well using:
net stats work | find "Stat"Result:
net stats work
netstats work |more
systeminfo | find "System Boot Time"Result:
systeminfo | find "Up Time"
wmic OS Get LastBootUpTime
cscript c:\windows\system32\eventquery.vbs /fi "ID eq 6005" /l systemOver the years I have found system event log event 6005, "The Event log service was started." to be the the most consistent entry after a computer restarts, even from a power outage, BSOD or other event. This command will also give you a history of system startups listed in the System event log.
[Shell]Save the file as 'Show Desktop.scf' and make sure theat 'All Files' is selected in the File Type list. Save this file on your desktop, then drag it to the Quick Launch toolbar.
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop
IconFile='PATH_TO_ICON',0See also Create Windows Shortcuts With a Script at the Command Line.
| -c | Zero free space (good for virtual disk optimization). |
| -p passes | Specifies number of overwrite passes. |
| -s | Recurse subdirectories. |
| -q | Don't print errors (quiet). |
| -z | Cleanse free space. |
wscript xyz.vbsNote: These scripts were all tested on Windows 7, Windows 2008 and 2003. They should run fine on earlier versions of Windows (XP, Vista, 2000, etc.) as well.
set WshShell = WScript.CreateObject("WScript.Shell" )Example 2 - Shortcut to Windows Explorer in the "All Users" Start Menu folder. I named the script Explorer_Shortcut_in_AU_Startmenu.vbs.
strDesktop = WshShell.SpecialFolders("AllUsersDesktop" )
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Windows Explorer.lnk" )
oShellLink.TargetPath = "%SYSTEMROOT%\explorer.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%SystemRoot%\explorer.exe"
oShellLink.Description = "Windows Explorer"
oShellLink.WorkingDirectory = "%HOMEPATH%"
oShellLink.Save
set WshShell = WScript.CreateObject("WScript.Shell" )Example 3 - Shortcut to Windows Explorer in the "All Users" Startup folder. I named the script Explorer_Shortcut_in_AU_Startup.vbs. This will cause one instance of Windows Explorer to launch during logon. If you're like me you will be using it anyway, so why not have it open automatically.
strStartMenu = WshShell.SpecialFolders("AllUsersStartmenu" )
set oShellLink = WshShell.CreateShortcut(strStartMenu & "\Windows Explorer.lnk" )
oShellLink.TargetPath = "%SYSTEMROOT%\explorer.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%SystemRoot%\explorer.exe"
oShellLink.Description = "Windows Explorer"
oShellLink.WorkingDirectory = "%HOMEPATH%"
oShellLink.Save
set WshShell = WScript.CreateObject("WScript.Shell" )Example 4 - Shortcut to Windows Explorer in the "Current User" Quick Launch toolbar. I named the script Explorer_Shortcut_in_CU_QuickLaunch.vbs.
strStartup = WshShell.SpecialFolders("AllUsersStartmenu" )
set oShellLink = WshShell.CreateShortcut(strStartup & "\programs\startup\Windows Explorer.lnk" )
oShellLink.TargetPath = "%SYSTEMROOT%\explorer.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%SystemRoot%\explorer.exe"
oShellLink.Description = "Windows Explorer"
oShellLink.WorkingDirectory = "%HOMEPATH%"
oShellLink.Save
set WshShell = WScript.CreateObject("WScript.Shell" )Example 5 - Shortcut to Command Prompt in the Quick Launch toolbar for you, the current user. I named the script CMD_Shortcut_in_CU_QuickLaunch.vbs.
strStartup = WshShell.SpecialFolders("AppData" )
set oShellLink = WshShell.CreateShortcut(strStartup & "\Microsoft\Internet Explorer\Quick Launch\Windows Explorer.lnk" )
oShellLink.TargetPath = "%SYSTEMROOT%\explorer.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "%SystemRoot%\explorer.exe"
oShellLink.Description = "Windows Explorer"
oShellLink.WorkingDirectory = "%HOMEPATH%"
oShellLink.Save
set WshShell = WScript.CreateObject("WScript.Shell" )See also:
strStartup = WshShell.SpecialFolders("AppData" )
set oShellLink = WshShell.CreateShortcut(strStartup & "\Microsoft\Internet Explorer\Quick Launch\Command Prompt.lnk" )
oShellLink.TargetPath = "%SYSTEMROOT%\system32\cmd.exe"
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "Ctrl+Alt+C"
oShellLink.IconLocation = "%SystemRoot%\system32\cmd.exe"
oShellLink.Description = "Windows Command Prompt"
oShellLink.WorkingDirectory = "%HOMEPATH%"
oShellLink.Save
xterm terminal emulator.%systemroot%\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /fEnable UAC from the command line
%systemroot%\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 1 /fA couple caveats
%SystemDrive%\inetpub\logs\LogFilesIIS 6 Log files location
%windir%\System32\LogFiles
Step 1: Format the Drive
Warning: This will erase everything on your USB drive.
Step 2: Make the Drive Bootable
Next we’ll use the bootsect utility that comes on the Vista or Windows 7 disk to make the flash drive bootable. In the same command window that you were using in Step 1:
Step 3: Set your BIOS to boot from USB
This is where you’re on your own since every computer is different. Most BIOS’s allow you to hit a key at boot and select a boot option.
schtasks /create /tn "Reboot" /tr "shutdown /r /t 1" /sc once /st 01:00:00 /sd 08/18/2009 /ru "System"Create scheduled task to run twice daily:
schtasks /create /tn "TTF" /tr "C:\Temp\T\ttf.bat" /sc daily /st 06:00:00 /sd 08/25/2009 /ri 720 /du 720 /ru "System"Create scheduled task to run every weekday, M-F:
schtasks /create /tn "Reboot" /tr "shutdown /r /t 1" /sc WEEKLY /d "MON, TUE, WED, THU, FRI" /st 01:00:00 /sd 08/18/2009 /ru "System"
schtasks /change /tn "Reboot" /st 04:00:00 /sd 12/11/2009
Here is a great list Windows XP/2000 commands that will make any Linux user feel at home at the command prompt. A lot of these commands are intended for administrating a network, but they are great for savvy home users as well.
Of course this list in note exhaustive, I just wanted to focus on tools that are particularly helpful that everyone might use. For the official list, please visit Microsoft Windows XP Pro Command Reference.