Total Pageviews

20/11/2015

Favourite softwares

My Wifi Router......httrack......foobar........nestopia......google photos......media drug..........srecorder

01/10/2015

PowerShell commands

An A-Z Index of Windows PowerShell commands

        %                     Alias for ForEach-Object
        ?                     Alias for Where-Object
a
    Get-Acl                   Get permission settings for a file or registry key
    Set-Acl                   Set permissions
        Active Directory      Account, Computer, Group and User cmdlets
    Get-Alias           gal   Return alias names for Cmdlets
 Import-Alias          ipal   Import an alias list from a file
    New-Alias           nal   Create a new alias.
    Set-Alias           sal   Create or change an alias
   Get-AuthenticodeSignature  Get the signature object associated with a file
   Set-AuthenticodeSignature  Place a signature in a .ps1 script or other file
b
       Begin                  Function BEGIN block
       BITS                   Background Intelligent Transfer Service cmdlets
       Break                  Exit a program loop
c
     Catch                    Handle a terminating error within a scriptblock
   Set-Location  cd/chdir/sl  Set the current working location
   Get-ChildItem   dir/ls/gci Get child items (contents of a folder or registry key)
     Clear-Host    clear/cls  Clear the screen
     Clear-Item         cli   Remove content from a variable or an alias
       Get-Command      gcm   Retrieve basic information about a command
   Measure-Command            Measure running time
     Trace-Command            Trace an expression or command
        Add-Computer          Add a computer to the domain
 Checkpoint-Computer          Create a system restore point (XP)
     Remove-Computer          Remove the local computer from a workgroup or domain
    Restart-Computer          Restart the operating system on a computer
    Restore-Computer          Restore the computer to a previous state
       Stop-Computer          Stop (shut down) a computer
Reset-ComputerMachinePassword Reset the machine account password for the computer
 Test-ComputerSecureChannel   Test and repair the secure channel to the domain
     Add-Content         ac   Add to the content of the item
     Get-Content cat/type/gc  Get content from item (specific location)
     Set-Content         sc   Set content in the item (specific location)
   Clear-Content        clc   Remove content from a file/item
         Continue             Skip just this iteration of a loop
     Get-Command        gcm   Get basic information about cmdlets
  Invoke-Command        icm   Run command
   Enable-ComputerRestore     Enable System Restore on a drive
   Disable-ComputerRestore    Disable System Restore on a drive
  Get-ComputerRestorePoint    Get the restore points on the local computer
 Test-Connection              Ping one or more computers
   ConvertFrom-CSV            Convert object properties (in CSV format) into CSV objects
   ConvertTo-CSV              Convert .NET Framework objects into CSV variable-length strings
   ConvertTo-Html             Convert the input into an HTML table
   ConvertTo-Xml              Convert the input into XML
   ConvertFrom-SecureString   Convert a secure string into an encrypted standard string
   ConvertTo-SecureString     Convert an encrypted standard string into a secure string
   Copy-Item     copy/cp/ci   Copy an item from a namespace location
   Export-Counter             Export Performance Counter data to log files
      Get-Counter             Get performance counter data
   Import-Counter             Import performance counter log files
   Get-Credential             Get a security credential (username/password)
   Get-Culture                Get region information (language and keyboard layout)
d
   Get-ChildItem   Dir/ls/gci Get child items (contents of a folder or registry key)
   Get-Date                   Get current date and time
   Set-Date                   Set system time on the host system
   Remove-Item  Del/erase/rd/rm/rmdir   Delete an item
   Compare-Object diff/compare   Compare the properties of objects
   Do                         Loop while a condition is True
     Get-DscConfiguration     Get the current config. of a node
     Get-DscLocalConfigurationManager   Get Local Config Manager settings
     Get-DscResource          Get Desired State Config. resources from a computer
     New-DSCCheckSum          Create checksum files for DSC docs/resources
   Start-DscConfiguration     Apply Desired State config to nodes
e
         End                  Function END block
     Get-Event                Get events in the PowerShell event queue
     New-Event                Create a new event
  Remove-Event                Delete events from the event queue
 Unregister-Event             Cancel an event subscription
    Wait-Event                Wait until a particular event is raised
   Clear-EventLog             Delete all entries from an event log
     Get-Eventlog             Get event log data (2003)
   Limit-EventLog             Limit the size of the event log
     New-Eventlog             Create a new event log and a new event source
  Remove-EventLog             Delete an event log
    Show-EventLog             Display an event log
   Write-EventLog             Write an event to an event log
     Get-WinEvent             Get event log data (Vista+)
   Get-EventSubscriber        Get event subscribers
Register-EngineEvent          Subscribe to PowerShell events
Register-ObjectEvent          Subscribe to .NET events
   Register-WmiEvent          Subscribe to a WMI event
   Get-ExecutionPolicy        Get the execution policy for the shell
   Set-ExecutionPolicy        Change the execution policy (user preference)
   Export-Alias         epal  Export an alias list to a file
   Export-Clixml              Produce a clixml representation of PowerShell objects
   Export-Console             Export console configuration to a file
   Export-Csv          epcsv  Export to Comma Separated Values (spreadsheet)
   Exit-PSSession       Exit  Exit PowerShell (or exit a script)
f
   -F operator                Format operator
   ForEach-Object    foreach  Loop through each item in the pipeline ( % )
   ForEach                    Loop through each item in a collection
   For                        Loop through items that match a condition
   Format-Custom         fc   Format output using a customized view
   Format-List           fl   Format output as a list of properties, each on a new line
   Format-Table          ft   Format output as a table
   Format-Wide           fw   Format output as a table listing one property only
  Export-FormatData           Save formatting data from the current session 
     Get-FormatData           Get the formatting data in the current session
g
   Get-Item              gi   Get a file/registry object (or any other namespace object)
   Get-ChildItem   dir/ls/gci Get child items (contents of a folder or registry key)
h
   Get-Help            help   Open the help file
     Add-History              Add entries to the session history
   Clear-History       clhy   Delete entries from the session history
     Get-History  history/h/ghy Get a listing of the session history
  Invoke-History     r/ihy    Invoke a previously executed Cmdlet
     Get-Host                 Get host information (PowerShell Version and Region)
   Clear-Host      clear/cls  Clear the screen
    Read-Host                 Read a line of input from the host console
   Write-Host                 Write customized output to the host/screen
     Get-HotFix               Get Installed hotfixes
i
   if                         Conditionally perform a command
   Import-Clixml              Import a clixml file and rebuild the PS object
   Import-Csv         ipcsv   Take values from a CSV list and send objects down the pipeline
   Invoke-Command             Run commands on local and remote computers
   Invoke-Expression    iex   Run a PowerShell expression
      Get-Item           gi   Get a file object or get a registry (or other namespace) object
   Invoke-Item           ii   Invoke an executable or open a file (START)
      New-Item   md/mkdir/ni  Create a new item in a namespace
   Remove-Item  rm/del/erase/rd/ri/rmdir   Remove an item
      Set-Item           si   Change the value of an item
    Clear-ItemProperty  clp   Remove the property value from a property
     Copy-ItemProperty  cpp   Copy a property along with it's value
      Get-ItemProperty   gp   Retrieve the properties of an object
     Move-ItemProperty   mp   Move a property from one location to another
      New-ItemProperty        Set a new property
   Remove-ItemProperty   rp   Remove a property and its value
   Rename-ItemProperty  rnp   Renames a property at its location
      Set-ItemProperty   sp   Set a property at the specified location to a specified value
j
       Get-Job          gjb   Get PowerShell background jobs that are running
   Receive-Job         rcjb   Get PowerShell background job results
    Remove-Job          rjb   Delete a PowerShell background job
     Start-Job         sajb   Start a PowerShell background job
      Stop-Job         spjb   Stop a PowerShell background job
      Wait-Job          wjb   Wait for a background job
   Job Trigger cmdlets        Get/Set Scheduled job triggers
k
   Stop-Process    kill/spps  Stop a running process
l
Update-List                   Add and remove items from a collection
   Get-Location    pwd / gl   Get and display the current location
   Pop-Location        popd   Set the current working location from the stack
  Push-Location       pushd   Push a location to the stack
   Set-Location  cd/chdir/sl  Set the current working location
m
  Send-MailMessage            Send an email message
   Add-Member                 Add a member to an instance of a PowerShell object
   Get-Member            gm   Enumerate the properties of an object
    Get-Module          gmo   Get the modules imported to the session
 Import-Module         ipmo   Add a module to the session
    New-Module          nmo   Create a new dynamic module (only in memory)
 Remove-Module          rmo   Remove a module from the current session
 Export-ModuleMember          Export specific module members
   Move-Item      mv/move/mi  Move an item from one location to another
o
  Compare-Object diff/compare Compare the properties of objects
    Group-Object       group  Group objects that contain the same value
  Measure-Object              Measure the properties of an object
      New-Object              Create a new .Net object
   Select-Object      select  Select properties of objects
     Sort-Object        sort  Sort objects by property value
    Where-Object              Filter the objects passed along the command pipeline
   Out-Default                Send output to default
   Out-File                   Send output to a file
   Out-GridView         ogv   Send output to an interactive table
   Out-Host              oh   Send output to the host
   Out-Null                   Send output to null
   Out-Printer           lp   Send the output to a printer
   Out-String                 Send objects to the host as strings
p
           Param              Script Parameters
           Pause              Pause and display the message "Press Enter to continue"
           Powershell         Launch a PowerShell session
   Convert-Path        cvpa   Convert a ps path to a provider path
      Join-Path               Combine a path and child-path
   Resolve-Path        rvpa   Resolves the wildcards in a path
     Split-Path               Return part of a path
      Test-Path               Return true if the path exists, otherwise return false
 Get-Pfxcertificate         Get pfx certificate information
    Pop-Location       popd   Set the current working location from the stack
   Push-Location      pushd   Push a location to the stack
         Process              Function PROCESS block
     Get-Process     ps/gps   Get a list of processes on a machine
   Debug-Process              Attach a debugger to a running process
   Start-Process  start/saps  Start one or more processes
    Stop-Process   kill/spps  Stop a running process
    Wait-Process              Wait for a process to stop
   Enable-PSBreakpoint  ebp   Enable a breakpoint in the current console
  Disable-PSBreakpoint  dbp   Disable a breakpoint in the current console
      Get-PSBreakpoint  gbp   Get the currently set breakpoints
      Set-PSBreakpoint  sbp   Set a breakpoint on a line, command, or variable
   Remove-PSBreakpoint  rbp   Delete breakpoints from the current console
      Get-PSDrive       gdr   Get drive information (DriveInfo)
      New-PSDrive   mount/ndr Create a mapped network drive.
   Remove-PSDrive       rdr   Remove a provider/drive from its location
      Get-PSProvider          Get information for the specified provider
      Set-PSdebug             Turn script debugging on or off
    Enter-PSSession  etsn     Start an interactive session with a remote computer
     Exit-PSSession  exsn     End an interactive session with a remote computer
   Export-PSSession  epsn     Import commands and save them in a PowerShell module
      Get-PSSession   gsn     Get the PSSessions in the current session
   Import-PSSession  ipsn     Import commands from another session
      New-PSSession   nsn     Create a persistent connection to a local or remote computer
   Remove-PSSession   rsn     Close PowerShell sessions
    Disable-PSSessionConfiguration  Deny access to PS session configuration
     Enable-PSSessionConfiguration  Enable PS session configuration
        Get-PSSessionConfiguration  Get the registered PS session configuration
   Register-PSSessionConfiguration  Create and register a new PS session configuration
        Set-PSSessionConfiguration  Change properties of a registered session configuration
 Unregister-PSSessionConfiguration  Delete registered PS session configuration
        New-PSSessionOption         Advanced options for a PSSession
   Add-PsSnapIn        asnp   Add snap-ins to the console
   Get-PsSnapin        gsnp   List PowerShell snap-ins on this computer
   Remove-PSSnapin     rsnp   Remove PowerShell snap-ins from the console
q
   Quest AD cmdlets           Read and write to Active Directory
r
   Get-Random                 Get a random number
   Read-Host                  Read a line of input from the host console
   Remove-Item  rm/del/erase/rd/ri/rmdir   Remove an item
   Rename-Item      ren/rni   Change the name of an existing item
   Rename-ItemProperty        Rename a property of an item
   Return                     Exit the current scope, (function, script, or script block)
   Run/Call             &     Run a command (call operator)
s
   Scheduler cmdlets          Get/Set scheduled jobs
   Select-Object     select   Select properties of objects
   Select-XML                 Find text in an XML string or document
   Send-MailMessage           Send an email message
       Get-Service      gsv   Get a list of services
       New-Service            Create a new service
   Restart-Service            Stop and then restart a service
    Resume-Service            Resume a suspended service
       Set-Service            Change the start mode/properties of a service
     Start-Service     sasv   Start a stopped service
      Stop-Service     spsv   Stop a running service
   Suspend-Service            Suspend a running service
   Sort-Object         sort   Sort objects by property value
   Set-StrictMode             Enforce coding rules in expressions & scripts
   Start-Sleep        sleep   Suspend shell, script, or runspace activity
   Switch                     Multiple if statements
   ConvertFrom-StringData     Convert a here-string into a hash table
   Select-String              Search through strings or files for patterns
t
   Tee-Object           tee   Send input objects to two places
   New-Timespan               Create a timespan object
   Trace-Command              Trace an expression or command
   Get-Tracesource            Get components that are instrumented for tracing.
   Set-Tracesource            Trace a PowerShell component
     Start-Transaction        Start a new transaction 
  Complete-Transaction        Commit the transaction
       Get-Transaction        Get information about the active transaction
       Use-Transaction        Add a command or expression to the transaction
      Undo-Transaction        Roll back a transaction
   Start-Transcript           Start a transcript of a command shell session
    Stop-Transcript           Stop the transcription process
         Trap                 Handle a terminating error
         Try ... Catch        Handle a terminating error within a scriptblock
     Add-Type                 Add a .NET Framework type to a PowerShell session
   Update-TypeData            Update extended type configuration
u
   Get-Uiculture              Get the ui culture information
   Get-Unique            gu   Get the unique items in a collection
    Update-Formatdata         Update and append format data files
    Update-Help               Download and install help files
    Update-Typedata           Update the current extended type configuration
v
   Clear-Variable       clv   Remove the value from a variable
     Get-Variable        gv   Get a PowerShell variable
     New-Variable        nv   Create a new variable
  Remove-Variable        rv   Remove a variable and its value
     Set-Variable    set/sv   Set a variable and a value
w
Checkpoint-WebApplicationMonitoring Create a checkpoint for an IIS web app
 Get-WebApplicationMonitoringStatus Get the monitoring status of web apps
 New-WebServiceProxy          Create a Web service proxy object
   Where-Object      where/?  Filter input from the pipeline
   Where                      Filter objects from the pipeline
   While                      Loop while a condition is True
 Add-WindowsFeature           Install roles, role services, and features
 Get-WindowsFeature           Retrieve roles, role services, and features
 Remove-WindowsFeature        Remove roles, role services, and features
   Write-Debug                Write a debug message to the host display
   Write-Error                Write an object to the error pipeline
   Write-Host                 Display text on screen
   Write-Output   write/echo  Write an object to the pipeline
   Write-Progress             Display a progress bar
   Write-Verbose              Write a string to the host's verbose display
   Write-Warning              Write a string in reverse video to the display
    Set-WmiInstance           Create or update an instance of an existing WMI class
 Invoke-WmiMethod      iwmi   Call WMI methods
    Get-WmiObject      gwmi   Get WMI class information
 Remove-WmiObject      rwmi   Delete an instance of a WMI class
    Connect-WSMan             Connect to the WinRM service on a remote computer
 Disconnect-WSMan             Disconnect from the WinRM service on a remote computer
       Test-WSMan             Test whether the WinRM service is running
  Invoke-WSManAction          Invoke an action on a specified object
 Disable-WSManCredSSP         Disable Credential Security Service Provider (SSP) authentication
  Enable-WSManCredSSP         Enable Credential SSP authentication
     Get-WSManCredSSP         Get the Credential SSP configuration
   New-WSManInstance          Create a new instance of a management resource
   Get-WSManInstance          Display management information (XML or value)
   Set-WSManInstance          Modify the management information related to a resource
Remove-WSManInstance          Delete a management resource instance
   Set-WSManQuickConfig       Configure the local computer for remote management
   New-WSManSessionOption     Options for WSMan commands
   Zipfile                    Compress or Extract zip files
       #                      Comment / Remark
       . (source)             Run a command script in the current shell
       & (call)               Run a command, script or function
       %                      Alias for ForEach-Object
       --%                    Stop parsing input
       ?                      Alias for Where-Object
       $variable = "value"    Define a variable  also: ${n!a#me} = "value"
       $_                     The current pipeline object 
       @(...)                 Force an expression to be evaluated as an array
The cmdlets on this page are listed in A-Z order, matching either the Verb- or -Noun or Alias of the cmdlet (some are listed more than once). In addition to the above, PowerShell can also run all the standard CMD commands (apart from internal commands), plus VBScript and Resource kit utilities. Call batch files with CMD.exe and VBScripts with cscript.
Microsoft: PowerShell 5.0 cmdlets, core cmdlets, Windows 2008 R2 cmdlets... more optional cmdlets.
Discussion forum
Links to other websites & books

© Copyright SS64.com 1999-2015
Some rights reserved

VBSCRIPT


VBScript - Syntax


Advertisements


Your First VBScript

Let us write a VBScript to print out "Hello World".
<html>
<body>
<script language="vbscript" type="text/vbscript">
   document.write("Hello World!")
</script>
</body>
</html>
In the above example, we called a function document.write, which writes a string into the HTML document. This function can be used to write text, HTML or both. So, above code will display following result:
Hello World!

Whitespace and Line Breaks

VBScript ignores spaces, tabs and newlines that appear within VBScript programs.
Because one can use spaces, tabs and newlines freely within the program so you are free to format and indent your programs in a neat and consistent way that makes the code easy to read and understand.

Formatting

VBScript is based on Microsoft's Visual Basic. Unlike JavaScript, no statement terminators such as semicolon is used to terminate a particular statement.

Single Line Syntax

Colons are used when two or more lines of VBScript ought to be written in a single line. Hence, in VBScript, Colons act as a line separator.
<script language="vbscript" type="text/vbscript">
  var1 = 10 : var2 = 20
</script>

Multiple Line Syntax

When a statement in VBScript is lengthy and if user wishes to break it into multiple lines, then the user has to use underscore "_".
This improves the readability of the code. The following example illustrates how to work with multiple lines.
<script language="vbscript" type="text/vbscript">
  var1 = 10 
  var2 = 20
  Sum = var1 + var2  
  document.write("The Sum of two numbers"&_
  "var1 and var2 is " & Sum)
</script>

Reserved Words

The following list shows the reserved words in VBscripting. These reserved words SHOULD NOT be used as a constant or variable or any other identifier names.
Loop LSet Me
Mod New Next
Not Nothing Null
On Option Optional
Or ParamArray Preserve
Private Public RaiseEvent
ReDim Rem Resume
RSet Select Set
Shared Single Static
Stop Sub Then
To True Type
And As Boolean
ByRef Byte ByVal
Call Case Class
Const Currency Debug
Dim Do Double
Each Else ElseIf
Empty End EndIf
Enum Eqv Event
Exit False For
Function Get GoTo
If Imp Implements
In Integer Is
Let Like Long
TypeOf Until Variant
Wend While With
Xor Eval Execute
Msgbox Erase ExecuteGlobal
Option Explicit Randomize SendKeys

Case Sensitivity

VBScript is a case-insensitive language. This means that language keywords, variables, function names and any other identifiers need NOT be typed with a consistent capitalization of letters.
So identifiers int_counter, INT_Counter and INT_COUNTER have the same meaning within VBScript.

Comments in VBScript

Comments are used to document the program logic and the user information with which other programmers can seamlessly work on the same code in future.
It can include information such as developed by, modified by and it can also include incorporated logic. Comments are ignored by the interpreter while execution.
Comments in VBScript are denoted by two methods.
1. Any statement that starts with a Single Quote (‘) is treated as comment. Following is the example:
<script language="vbscript" type="text/vbscript">
<!—
  ' This Script is invoked after successful login
  ' Written by : TutorialsPoint
  ' Return Value : True / False
//- >
</script>
2. Any statement that starts with the keyword “REM”. Following is the example:
<script language="vbscript" type="text/vbscript">
<!—
  REM This Script is written to Validate the Entered Input
  REM Modified by  : Tutorials point/user2
//- >
</script>


Advertisements

CMD COMMANDS_1


15 CMD Commands Every Windows User Should Know

Microsoft has slowly but surely pushed the command line aside in the Windows interface. This is not without reason, as it’s an antiquated and mostly unnecessary tool from an era of text-based input that has long passed.
But there still are some commands that remain useful, and Windows 8 even added new features. Here are the commands every Windows user needs to know.
In case you’re not sure how to access the command prompt, forgot basic commands, or would like to know how to see a list of  switches for each command, you can refer to our beginners guide to the Windows command line for instructions.

ASSOC

assoccmd2
Most files in Windows are associated with a specific program that is assigned to open the file by default. At times, remembering these associations can become confusing. You can remind yourself by entering the command “assoc” to display a full list of file extensions and the programs they’re connected with.
You can also extend the command to change file associations. For example, “assoc .txt=” will change the file association for text files to whatever program you enter after the equal sign. The ASSOC command itself will reveal both the extension names and program names, which will help you properly use this command. You can probably do this more easily in the GUI, but the command line interface is a perfectly functional alternative.

Cipher

ciphercmd
Deleting files on a mechanical hard drive doesn’t really delete them at all. Instead, it marks the files as no longer accessible and the space they took up as free. The files remain recoverable until they’re overwritten with new data, which can take some time.
The cipher command, however, can be used to wipe a directory by writing random data to it. To wipe your C drive, for example, you’d use the command “cipher /w:c”, which will wipe free space on the drive. The command does not overwrite undeleted data, so you will not wipe out files you need by running this command.
There’s also a host of other cipher commands, however, they are generally redundant with Bitlocker enabled versions of Windows.

Driverquery

driverquerycmd
Drivers remain among the most important software installed on a PC. Improperly configured or missing drivers can cause all sorts of trouble, so its good to have access to a list of what’s on your PC. That’s exactly what the “driverquery” command does. You can extend it to “driverquery -v” to obtain more information including the directory in which the driver is installed.

File Compare

This command can be used to identify differences in text between two files, and is particularly useful for writers and programmers trying to find small changes between two versions of a file. Simply type “fc” and then the directory path and file name of the two files you want to compare.
fccmd
You can also extend the command in several ways. Typing “/b” compares only binary output, “/c” disregards the case of text in the comparison, and “/l” only compares ASCII text.
So, for example, you could use the following:
fc /l "C:\Program Files (x86)\example1.doc" "C:\Program Files (x86)\example2.doc"
to compare ASCII text in two word documents.

Ipconfig

This command relays the IP address that your computer is currently using. However, if you’re behind a router (like most computers today), you’ll instead receive the local network address of the router.
Still, ipconfig is useful because of its extensions. “ipconfig /release” followed by “ipconfig /renew” can force your Windows PC into asking for a new IP address, which is useful if your computer claims one isn’t available. You can also use “ipconfig /flushdns” to refresh your DNS address. These commands are great if the Windows network troubleshooter chokes, which does happen on occasion.

Netstat

Entering the command “netstat -an” will provide you with a list of currently open ports and related IP addresses. You’ll also be told what state the port is in – listening, established or closed. This is a great command if you’re trying to troubleshoot the devices your PC is connected to or you’re afraid you’re infected with a Trojan and are trying to locate a malicious connection.

Ping

pingcmd
Sometimes, you need to know whether or not packets are making it to a specific networked device. That’s where ping comes in handy. Typing “ping” followed by an IP address or web domain will send a series of test packets to the specified address. If they arrive and are returned, you know the device is capable of communicating with your PC; if it fails, you know that there’s something blocking communication between the device and your computer. This can help you decide if an issue is caused by improper configuration or a failure of network hardware.

Pathping

This is a more advanced version of ping that’s useful if there are multiple routers between your PC and the device you’re testing. Like ping, you use this command by typing “pathping” followed by the IP address, but unlike ping, pathping also relays some information about the route the test packets take.

Tracert

tracertcmd
The “tracert” command is similar to pathping. Once again, type “tracert” followed by the IP address or domain you’d like to trace. You’ll receive information about each step in the route between your PC and the target. Unlike pathping, however, tracert also tracks how much time (in milliseconds) each hop between servers or devices takes.

Powercfg

Powercfg is a very powerful command for managing and tracking how your computer uses energy. You can use the command “powercfg /hibernate on” and “powercfg /hibernate off” to manage hibernation, and you can also use the command “powercfg /a” to view the power-saving states currently available on your PC.
Another useful command is “powercfg /devicequery s1_supported” which displays a list of devices on your computer that support connected standby. When enabled, these devices can be used to bring your computer out of standby – even remotely. You can enable this by selecting the device in Device Manager, opening its properties, going to the Power Management tab and then checking the “Allow this device to wake the computer” box.
“Powercfg /lastwake” will show you what device last woke your PC from a sleep state. You can use this command to troubleshoot your PC if it seems to wake from sleep at random.
powercfgcmd
The “powercfg /energy” command can be used to build a detailed power consumption report for your PC, which is output to a directory indicated after the command finishes. This report will let you know of any system faults that might increase power consumption, like devices that are blocking certain sleep modes, or which aren’t properly configured to respond to your power management settings.
Windows 8 added “powercfg /batteryreport”, which provides a detailed analysis of battery use, if applicable. Normally output to your Windows user directory, the report provides details about the time and length of charge and discharge cycles, lifetime average battery life, and estimated battery capacity.

Shutdown

As of Windows 8/8.1 there is now a shutdown command that – you guessed it! – shuts down your computer. This is of course redundant with the already easily accessed shutdown button, but what’s not redundant is the “shutdown /r /o” command, which restarts your PC and launches the Advanced Start Options menu, which is where you can access Safe Mode and Windows recovery utilities. This is useful if you want to restart your computer for troubleshooting purposes.

System File Checker

System File Checker is an automatic scan and repair tool that focuses on Windows system files. You will need to run the command prompt with administrator privileges and enter the command “sfc /scannow”. If any corrupt or missing files are found, they’ll be automatically replaced using cached copies kept by Windows for just that purpose. The command can require a half-hour to run on older notebooks.

Recovery Image

recimgcmd
Virtually all Windows 8/8.1 computers ship from the factory with a recovery image, but the image may include bloatware you’d rather not have re-installed. Once you’ve un-installed the software you can create a new image using the “recimg” command. Entering this command presents a very detailed explanation of how to use it. You must have administrator privileges to use the recimg command, and you can only access the custom recovery image you create via the Windows 8 “refresh” feature.

Tasklist

The “tasklist” command can be used to provide a current list of all tasks running on your PC. Though somewhat redundant with Task Manager, the command may sometimes find tasks hidden from view in that utility.
tasklist
There’s also a wide range of modifiers. “Tasklist -svc” shows services related to each task, “tasklist -v” can be used to obtain more detail on each task, and “tasklist -m” can be used to locate .dll files associated with active tasks. These commands are useful for advanced troubleshooting.

Taskkill

Tasks that appear in the “tasklist” command will have an executable and process ID (a four-digit number) associated with them. You can force stop a program using “taskkill -im” followed by the executable’s name, or “taskkill -pid” followed by the process ID. Again, this is a bit redundant with Task Manager, but may be used to kill otherwise unresponsive or hidden programs.

Conclusion

This article doesn’t cover every Windows command available. There are literally hundreds of them when all variables are included. Most, however, are no longer useful because they’ve been replaced by more convenient menus in the Windows GUI or simply aren’t commonly used (telnet, for example).
You can check out our Windows command cheat sheet for an expanded list or download Microsoft’s command line reference guide for advanced support and troubleshooting.
Which commands do you find yourself using frequently?
Comments (50)
  • GuccizBud
    Very useful list?;??I took the ones I like the most and documented them in a file of my own for later reference.
    ?One thing, though?:? I’m not sure why you’re under the impression the Shutdown command exists “as of Windows 8/8.1″. It’s that very same Shutdown routine that the OS itself has been invoking every time a user logged off, powered down, or restarted his system since *at least* Windows XP.? I can’t recall before that, but for all I know it was around before then too.? But I can absolutely confirm its existence since XP since I’ve been using it since then to log off, power down, or restart my system through keyboard shortcuts assigned to “.cmd” scripts that use the Shutdown command.? So for example one can create a text file called “reboot.cmd” containing the one line “shutdown /r /t 10″, create a shortcut to “reboot.cmd” and store it in his personal ?%?appdata?%? Start Menu folder, and associate the keyboard shortcut ?Ctrl+Shift+R? (for example) to that shortcut.? Now whenever he does ?Ctrl+Shift+R? his computer will power down and restart after a 10 second delay.? I’ve been doing that kind of thing since XP.
    ?Other than that though, highly useful piece, like I said.
    • Phill Heath
      yeah the shutdown command is quite a useful one, i didn’t make use of it when i was using XP, although in win 7 there is the task scheduler, if i was say downloading something that was going to take a few hours like a game update or a whole client and I wanted to go to sleep, you can set a ‘/shutdown /s’ task to fire at a specific time and have your pc turn off instead of staying on until you wake up.
  • jimtech
    it good to make this
  • Derek
    Is there a command to check how long a program has been running? sorry if I missed it in the original post, new to running things from the cmd.
  • Gr3nD
    I Just Know Hacking Another Pc ON My Network.. By Type ‘shutdown -i’ but.. i cant to shut to diferent network… And I Want Talk Something Too. How To Control Another PC… I Mean Like Open Files… Like 100% Controling
    • Krutik Shah
      that’s extremely illegal and you will most likely be sent to jail.. and thats coming from a guy who pirates..
  • N. Cognito
    I use it to stop unnecessary programs from loading at startup.
Load 10 more
Affiliate Disclamer
This review may contain affiliate links, which pays us a small compensation if you do decide to make a purchase based on our recommendation. Our judgement is in no way biased, and our recommendations are always based on the merits of the items.
For more details, please read our disclosure.

CMD CODES

An A-Z Index of the Windows CMD command line

   ADDUSERS Add or list users to/from a CSV file
   ADmodcmd Active Directory Bulk Modify
   ARP      Address Resolution Protocol
   ASSOC    Change file extension associations•
   ASSOCIAT One step file association
   AT       Schedule a command to run at a specific time
   ATTRIB   Change file attributes
b
   BCDBOOT  Create or repair a system partition
   BCDEDIT  Manage Boot Configuration Data
   BITSADMIN Background Intelligent Transfer Service
   BOOTCFG  Edit Windows boot settings
   BROWSTAT Get domain, browser and PDC info
c
   CACLS    Change file permissions
   CALL     Call one batch program from another•
   CERTREQ  Request certificate from a certification authority
   CERTUTIL Utility for certification authority (CA) files and services
   CD       Change Directory - move to a specific Folder•
   CHANGE   Change Terminal Server Session properties
   CHKDSK   Check Disk - check and repair disk problems
   CHKNTFS  Check the NTFS file system
   CHOICE   Accept keyboard input to a batch file
   CIPHER   Encrypt or Decrypt files/folders
   CleanMgr Automated cleanup of Temp files, recycle bin
   CLIP     Copy STDIN to the Windows clipboard
   CLS      Clear the screen•
   CMD      Start a new CMD shell
   CMDKEY   Manage stored usernames/passwords
   COLOR    Change colors of the CMD window•
   COMP     Compare the contents of two files or sets of files
   COMPACT  Compress files or folders on an NTFS partition
   COMPRESS Compress one or more files
   CONVERT  Convert a FAT drive to NTFS
   COPY     Copy one or more files to another location•
   Coreinfo Show the mapping between logical & physical processors
   CSCcmd   Client-side caching (Offline Files)
   CSVDE    Import or Export Active Directory data 
d
   DATE     Display or set the date•
   DEFRAG   Defragment hard drive
   DEL      Delete one or more files•
   DELPROF  Delete user profiles
   DELTREE  Delete a folder and all subfolders
   DevCon   Device Manager Command Line Utility 
   DIR      Display a list of files and folders•
   DIRQUOTA File Server Resource Manager Disk quotas
   DIRUSE   Display disk usage
   DISKPART Disk Administration
   DISKSHADOW Volume Shadow Copy Service
   DISKUSE  Show the space used in folders
   DOSKEY   Edit command line, recall commands, and create macros
   DriverQuery Display installed device drivers
   DSACLs   Active Directory ACLs
   DSAdd    Add items to active directory (user group computer) 
   DSGet    View items in active directory (user group computer)
   DSQuery  Search for items in active directory (user group computer)
   DSMod    Modify items in active directory (user group computer)
   DSMove   Move an Active directory Object
   DSRM     Remove items from Active Directory
e
   ECHO     Display message on screen•
   ENDLOCAL End localisation of environment changes in a batch file•
   ERASE    Delete one or more files•
   EVENTCREATE Add a message to the Windows event log
   EXIT     Quit the current script/routine and set an errorlevel•
   EXPAND   Uncompress CAB files
   EXTRACT  Uncompress CAB files
f
   FC       Compare two files
   FIND     Search for a text string in a file
   FINDSTR  Search for strings in files
   FOR /F   Loop command: against a set of files•
   FOR /F   Loop command: against the results of another command•
   FOR      Loop command: all options Files, Directory, List•
   FORFILES Batch process multiple files
   FORMAT   Format a disk
   FREEDISK Check free disk space
   FSUTIL   File and Volume utilities
   FTP      File Transfer Protocol
   FTYPE    File extension file type associations•
g
   GETMAC   Display the Media Access Control (MAC) address
   GOTO     Direct a batch program to jump to a labelled line•
   GPRESULT Display Resultant Set of Policy information
   GPUPDATE Update Group Policy settings
h
   HELP     Online Help
   HOSTNAME Display the host name of the computer
i
   iCACLS   Change file and folder permissions
   IEXPRESS Create a self extracting ZIP file archive
   IF       Conditionally perform a command•
   IFMEMBER Is the current user a member of a group
   IPCONFIG Configure IP
   INUSE    Replace files that are in use by the OS
l
   LABEL    Edit a disk label
   LODCTR   Load PerfMon performance counters
   LOGMAN   Manage Performance Monitor logs
   LOGOFF   Log a user off
   LOGTIME  Log the date and time in a file
m
   MAKECAB  Create .CAB files
   MAPISEND Send email from the command line
   MBSAcli  Baseline Security Analyzer
   MEM      Display memory usage
   MD       Create new folders•
   MKLINK   Create a symbolic link (linkd) •
   MODE     Configure a system device COM/LPT/CON
   MORE     Display output, one screen at a time
   MOUNTVOL Manage a volume mount point
   MOVE     Move files from one folder to another•
   MOVEUSER Move a user from one domain to another
   MSG      Send a message
   MSIEXEC  Microsoft Windows Installer
   MSINFO32 System Information
   MSTSC    Terminal Server Connection (Remote Desktop Protocol)
n
   NET      Manage network resources
   NETDOM   Domain Manager
   NETSH    Configure Network Interfaces, Windows Firewall & Remote access
   NBTSTAT  Display networking statistics (NetBIOS over TCP/IP)
   NETSTAT  Display networking statistics (TCP/IP)
   NLSINFO  Display locale information (reskit).
   NLTEST   Network Location Test (AD)
   NOW      Display the current Date and Time 
   NSLOOKUP Name server lookup
   NTBACKUP Backup folders to tape
   NTDSUtil Active Directory Domain Services management
   NTRIGHTS Edit user account rights
   NVSPBIND Modify network bindings
o
   OPENFILES Query or display open files
p
   PATH     Display or set a search path for executable files•
   PATHPING Trace route plus network latency and packet loss
   PAUSE    Suspend processing of a batch file and display a message•
   PERMS    Show permissions for a user
   PERFMON  Performance Monitor
   PING     Test a network connection
   POPD     Return to a previous directory saved by PUSHD•
   PORTQRY  Display the status of ports and services
   POWERCFG Configure power settings
   PRINT    Print a text file
   PRINTBRM Print queue Backup/Recovery
   PRNCNFG  Configure or rename a printer
   PRNMNGR  Add, delete, list printers and printer connections
   ProcDump Monitor an application for CPU spikes
   PROMPT   Change the command prompt•
   PsExec     Execute process remotely
   PsFile     Show files opened remotely
   PsGetSid   Display the SID of a computer or a user
   PsInfo     List information about a system
   PsKill     Kill processes by name or process ID
   PsList     List detailed information about processes
   PsLoggedOn Who's logged on (locally or via resource sharing)
   PsLogList  Event log records
   PsPasswd   Change account password
   PsPing     Measure network performance
   PsService  View and control services
   PsShutdown Shutdown or reboot a computer
   PsSuspend  Suspend processes
   PUSHD    Save and then change the current directory•
q
   QGREP    Search file(s) for lines that match a given pattern
   Query Process / QPROCESS  Display processes
   Query Session / QWinsta   Display all sessions (TS/Remote Desktop)
   Query TermServer /QAppSrv List all servers (TS/Remote Desktop)
   Query User    / QUSER     Display user sessions (TS/Remote Desktop)
r
   RASDIAL  Manage RAS connections
   RASPHONE Manage RAS connections
   RECOVER  Recover a damaged file from a defective disk
   REG      Registry: Read, Set, Export, Delete keys and values
   REGEDIT  Import or export registry settings
   REGSVR32 Register or unregister a DLL
   REGINI   Change Registry Permissions
   REM      Record comments (remarks) in a batch file•
   REN      Rename a file or files•
   REPLACE  Replace or update one file with another
   Reset Session  Delete a Remote Desktop Session
   RD       Delete folder(s)•
   RMTSHARE Share a folder or a printer
   ROBOCOPY Robust File and Folder Copy
   ROUTE    Manipulate network routing tables
   RUN      Start | RUN commands
   RUNAS    Execute a program under a different user account
   RUNDLL32 Run a DLL command (add/remove print connections)

s
   SC       Service Control
   SCHTASKS Schedule a command to run at a specific time
   SET      Display, set, or remove session environment variables•
   SETLOCAL Control the visibility of environment variables•
   SetSPN   Edit Service Principal Names
   SETX     Set environment variables
   SFC      System File Checker 
   SHARE    List or edit a file share or print share
   ShellRunAs Run a command under a different user account
   SHIFT    Shift the position of batch file parameters•
   SHORTCUT Create a windows shortcut (.LNK file)
   SHUTDOWN Shutdown the computer
   SLEEP    Wait for x seconds
   SLMGR    Software Licensing Management (Vista/2008)
   SORT     Sort input
   START    Start a program, command or batch file•
   STRINGS  Search for ANSI and UNICODE strings in binary files
   SUBINACL Edit file and folder Permissions, Ownership and Domain
   SUBST    Associate a path with a drive letter
   SYSMON   Monitor and log system activity to the Windows event log
   SYSTEMINFO List system configuration
t
   TAKEOWN  Take ownership of a file
   TASKLIST List running applications and services
   TASKKILL End a running process
   TELNET   Communicate with another host using the TELNET protocol
   TIME     Display or set the system time•
   TIMEOUT  Delay processing of a batch file
   TITLE    Set the window title for a CMD.EXE session•
   TLIST    Task list with full path
   TOUCH    Change file timestamps    
   TRACERT  Trace route to a remote host
   TREE     Graphical display of folder structure
   TSDISCON Disconnect a Remote Desktop Session
   TSKILL   End a running process
   TSSHUTDN Remotely shut down or reboot a terminal server
   TYPE     Display the contents of a text file•
   TypePerf Write performance data to a log file
   TZUTIL   Time Zone Utility
v
   VER      Display version information•
   VERIFY   Verify that files have been saved•
   VOL      Display a disk label•
w
   W32TM    Time Service
   WAITFOR  Wait for or send a signal
   WEVTUTIL Clear event logs, enable/disable/query logs
   WHERE    Locate and display files in a directory tree
   WHOAMI   Output the current UserName and domain
   WINDIFF  Compare the contents of two files or sets of files
   WINRM    Windows Remote Management
   WINRS    Windows Remote Shell
   WMIC     WMI Commands
   WUAUCLT  Windows Update
x
   XCACLS   Change file and folder permissions
   XCOPY    Copy files and folders
   ::       Comment / Remark•
Commands marked • are Internal commands only available within the CMD shell.
All other commands (not marked with •) are external commands.
External commands may be used under the CMD shell, PowerShell, or directly from START-RUN.
See also: a categorized list of Windows CMD commands
Microsoft Help pages: XP , 2003 Server, 2008 Server, Windows 7/Server 2012 / Technology
Discussion forum
Links to other sites, books etc...


© Copyright SS64.com 1999-2015
Some rights reserved