Skip to content

Windows Command Line

References

Useful thingies

Useful commands.

See current Logon sessions

RDP sessions are included.

PowerShell
1
2
3
4
5
6
PS> query session
    SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
    services                                    0  Disc
    >console           u6                        1  Active
    rdp-tcp#0         aet                       3  Active
    rdp-tcp                                 65536  Listen

Terminate a logon session

To completely terminate a logon session:

PowerShell
1
2
3
4
5
6
7
# to terminate the current logon session
PS> logoff
# or, equivalent
PS> shutdown -l

# to terminate another logon session, use "query session" as seen above to get the session ID, then run: logoff.exe <ID>
PS> logoff 3

To simply disconnect from within a remote (RDP) session, leaving the session on the remote machine open:

PowerShell
PS> tsdiscon

Control Panel, system dialogs, Microsoft Management Console

  • appwiz.cpl: opens "Programs and Features"
  • ncpa.cpl: opens "Network Connections"
  • systempropertiesadvanced: opens "System Properties", "Advanced" tab
  • services.msc: opens "Services"
  • compmgmt.msc: opens "Computer Management"
  • devmgmt.msc: opens "Device Manager"
  • diskmgmt.msc: opens "Disk Management"
  • gpedit.msc: opens "Local Group Policy Editor"
  • lusrmgr.msc: opens "Local Users and Groups"
  • mmc: opens Microsoft Management Console
  • mstsc: opens "Remote Desktop Connection"
  • taskmgr: opens Task Manager
  • mspaint: opens Paint
  • slui: opens "Windows Activation Center"
  • winver: opens "About Windows"
  • control: opens Control Panel