MoonPoint Support Logo

 


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
September
Sun Mon Tue Wed Thu Fri Sat
         
22 23
24 25 26 27 28 29 30
2017
Months
Sep
Oct Nov Dec


Sat, Sep 16, 2017 11:05 pm

Determining the antivirus software on a Windows system from the command line

You can determine the antivirus software present on a system, if the antivirus software is registered with the Windows Security Center, using Windows Management Instrumentation Command-line (WMIC). E.g., for a Windows 10 system using Microsoft Windows Defender:

C:\>WMIC /Node:localhost /Namespace:\\root\SecurityCenter2 Path AntiVirusProduct Get displayName
displayName
Windows Defender


C:\>

[ More Info ]

[/os/windows/commands/wmic] permanent link

Sun, Aug 27, 2017 11:14 pm

Displaying date and time information on a Microsoft Windows system

You can use the date and time commands on a Microsoft Windows system to display current date and time information:

C:\Users\Lila>date /t
Sat 08/26/2017

C:\Users\Lila>time /t
02:07 PM

C:\Users\Lila>

Placing /t after the commands results in the current date and time information being displayed without an accompanying prompt to change the current settings.

You can display the information in a different format using the Windows Management Instrumentation Command-line (WMIC) command shown below:

C:\Users\Lila>wmic path win32_utctime get * /format:list


Day=26
DayOfWeek=6
Hour=18
Milliseconds=
Minute=16
Month=8
Quarter=3
Second=19
WeekInMonth=4
Year=2017




C:\Users\Lila>

[ More Info ]

[/os/windows/commands] permanent link

Mon, Jul 10, 2017 10:47 pm

Viewing Partition Information on a Windows System

One way to see how disks are partitioned on a Microsoft Windws system is to view the information using Disk Management. You can start the utility from a command prompt with administrator privileges by typing diskmgmt.msc. That will provide a graphical display of the partitions on the drives in the system and externally attached to the system.

Another method is to use the diskpart command, which can be run from a command prompt - obtain a command prompt with administrator privileges. You can obtain help on using the utility by typing help at the DISKPART prompt.

[ More Info ]

[/os/windows/commands] permanent link

Sun, Jun 25, 2017 9:27 pm

icacls

On Microsoft Windows Vista and Windows Server 2003 and later systems, you can use the Integrity Control Access Control List (icacls) program to display, modify, backup and restore Access Control Lists (ACLs) for files and folders. E.g.:

C:\>icacls C:\WINDOWS\system32\mmc.exe
C:\WINDOWS\system32\mmc.exe NT SERVICE\TrustedInstaller:(F)
                            BUILTIN\Administrators:(RX)
                            NT AUTHORITY\SYSTEM:(RX)
                            BUILTIN\Users:(RX)
                            APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(RX)
                            APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(RX)

Successfully processed 1 files; Failed processing 0 files

C:\>

In the above example, the "RX" indicates read and execute access for the file for the specified accounts.

[ More Info ]

[/os/windows/commands] permanent link

Sat, May 20, 2017 8:24 pm

Finding open files on a Windows SBS server

If you need to find files open on a Small Business Server (SBS) system, e.g., perhaps files have been opened on the server from other computers in the windows domain, you can do so by taking the following steps:
  1. Click on Start
  2. Select Administrative Tools then select Computer Management and then, under Sytem Tools, click on Shared Folders
  3. Double-click on Open Files. You will then see the files open on the server from other systems. You will see the files being accessed, who is accessing them, the locks, if any, and the mode in which it files have been accessed, e.g., whether they are open only for reading or whether they are open in read and write mode. Right-clicking on a file will give you the ability to close the open file.

[ More Info ]

[/os/windows/commands] permanent link

Thu, May 18, 2017 10:08 pm

Batch file to ping several hosts and log results

Since a connectivity issue between a Windows XP system in another country and systems in the United States seemed to correlate with the time of day that connectivity attempts were taking place, I wanted to have a batch file that would periodically ping from the source to the destination hosts and record the results, so that I could determine if packet loss was occurring at particular times every day because of contention with other traffic. So I created the following batch file (pinghosts.bat):

@echo off

set pingCount=5
set timeOut=500
set dirPath=%HOMEPATH%\Documents

REM ping google.com, apple.com, and cisco.com
for %%i in ("216.58.217.142" "17.142.160.59" "72.163.4.161") do (
   if not exist %dirPath%\%%i.txt (
      systeminfo | find "Time Zone:" > %dirPath%\%%i.txt
   )
   echo. >> %dirPath%\%%i.txt
   echo %date% %time% >> %dirPath%\%%i.txt
   ping -n %pingCount% -w %timeOut% %%i >> %dirPath%\%%i.txt
)

[ More Info ]

[/os/windows/commands/batch] permanent link

Thu, Apr 13, 2017 10:37 pm

Counting the number of instances of a process on Microsoft Windows

If you need to know the number of instances of a particular process running on a Microsoft Windows system, you can see all of the instances by using the tasklist /fi option to filter the output from the tasklist command by imagename. E.g., I could view information on the PuTTY processes currently running on a Windows system with the command below:

C:\>tasklist /fi "IMAGENAME eq putty.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
putty.exe                    57380 Console                    1      4,404 K
putty.exe                    49012 Console                    1      3,584 K
putty.exe                    72424 Console                    1      3,060 K
putty.exe                     8028 Console                    1      3,992 K
putty.exe                    96136 Console                    1      4,632 K
putty.exe                   102860 Console                    1      2,936 K
putty.exe                    87200 Console                    1      4,572 K
putty.exe                   121020 Console                    1      2,908 K
putty.exe                   100348 Console                    1      4,228 K
putty.exe                    81692 Console                    1      3,068 K
putty.exe                   118448 Console                    1      2,020 K
putty.exe                   102856 Console                    1      2,544 K
putty.exe                   126692 Console                    1      4,332 K
putty.exe                   133004 Console                    1      3,664 K
putty.exe                   136344 Console                    1      5,204 K
putty.exe                   126408 Console                    1      3,620 K
putty.exe                   114896 Console                    1      2,880 K
putty.exe                   132868 Console                    1      2,972 K
putty.exe                   133048 Console                    1      3,860 K
putty.exe                   139232 Console                    1      3,732 K
putty.exe                   132756 Console                    1      2,928 K
putty.exe                   136484 Console                    1      3,576 K
putty.exe                   147964 Console                    1      2,960 K
putty.exe                   142800 Console                    1      6,136 K
putty.exe                   139192 Console                    1      2,952 K
putty.exe                    32748 Console                    1      2,896 K
putty.exe                    78048 Console                    1      3,596 K
putty.exe                   113756 Console                    1      3,304 K
putty.exe                    62572 Console                    1      4,120 K
putty.exe                    17620 Console                    1      3,376 K
putty.exe                    36156 Console                    1      1,756 K
putty.exe                    86144 Console                    1      3,528 K
putty.exe                     4600 Console                    1      4,440 K
putty.exe                    46532 Console                    1      6,048 K
putty.exe                    49572 Console                    1      2,884 K
putty.exe                    69560 Console                    1      3,268 K
putty.exe                    67948 Console                    1      4,120 K
putty.exe                   139328 Console                    1      2,948 K
putty.exe                    25888 Console                    1      6,552 K
putty.exe                   119096 Console                    1      3,676 K
putty.exe                    48572 Console                    1      3,084 K
putty.exe                   132724 Console                    1      6,720 K
putty.exe                   123480 Console                    1      2,944 K
putty.exe                   148548 Console                    1      3,704 K
putty.exe                    46280 Console                    1      7,860 K
putty.exe                   146844 Console                    1      4,648 K
putty.exe                    47612 Console                    1      6,548 K
putty.exe                    84404 Console                    1      3,060 K
putty.exe                    35920 Console                    1     15,780 K
putty.exe                    91288 Console                    1     14,832 K
putty.exe                   115612 Console                    1      5,216 K
putty.exe                    85164 Console                    1      6,972 K
putty.exe                    22796 Console                    1      9,640 K
putty.exe                    87868 Console                    1     15,596 K

C:\>

If I don't want to manually count the instances, I can use the find command as shown below:

C:\>tasklist /fi "IMAGENAME eq putty.exe" | find /i /c "putty.exe"

54

C:\>

The /i option to the find command tells find that the case of letters is unimportant, i.e., it should match either lowercase or uppercase letters. The /c option instructs it to display a count for the number of matching lines it found.

If I want to put the count in a variable in a batch file, I can use the the command noted in Setting a Variable to be the Output of a Command.

Alternatively, you can use a Windows Management Instrumentation Command-line (WMIC) command. E.g.:

C:\>wmic process where name="putty.exe" get name | find /c "putty.exe"
54

C:\>

Related articles:

  1. Obtaining a list of running processes and their associated PIDs Date: April 8, 2017
    MoonPoint Support

[/os/windows/commands] permanent link

Sat, Apr 08, 2017 11:26 pm

Obtaining a list of running processes and their associated PIDs

If you need to get a list of the processes running on a Microsoft Windows system and the process identifier (PID) for each of those processes, you can get the information from a command line interface (CLI), e.g., a command prompt, using the tasklist command or the Windows Management Instrumentation Command-line (WMIC) command wmic process get name, processid. If you wish to filter the output so that you only see information for a specific process, you can use the /fi option for the tasklist command. E.g., if I only wanted to determine the PID for the QuickBooks QBW32.exe process, I could use the command tasklist /fi "imagename eq QBW32.exe". With WMIC, you can include a "where" option, e.g., wmic process where name='QBW32.exe' get name, processid.

[ More Info ]

[/os/windows/commands] permanent link

Thu, Feb 23, 2017 10:08 pm

Determining and setting group membership from a command prompt

On a Microsoft Windows system, you can determine the username for an account from a command prompt window using the whoami command as shown below.

C:\Users\enzo\Documents>whoami
slartibartfast\enzo

C:\Users\enzo\Documents>

In the example above, the account name is enzo and the system name is slartibartfast.

If you want to determine what groups the account belongs to, which would enable you to determine if the account is in the administrators group, you could add the /groups argument to the command as shown below. I added the /fo list option as well to format the output as a list; if that option isn't specified the output will be in table format.

[ More Info ]

[/os/windows/commands] permanent link

Sun, Feb 19, 2017 10:45 pm

Deleting a hidden file from a command prompt on a Windows system

The del command can be used at a command prompt on a Microsoft Windows system to delete files. But, if you try to delete a file using that command without specifically specifying that you wish to apply the command to a hidden file, you will receive a message stating windows could not find the file. To delete a hidden file, you need to use the /ah parameter before the file name as shown below.
C:\Users\enzo\Documents>dir /ah *.swp
 Volume in drive C is Windows
 Volume Serial Number is B688-ED25

 Directory of C:\Users\enzo\Documents

02/18/2017  12:51 PM            12,288 .system.html.swp
               1 File(s)         12,288 bytes
               0 Dir(s)  1,954,264,215,552 bytes free

C:\Users\enzo\Documents>del .system.html.swp
Could Not Find C:\Users\enzo\Documents\.system.html.swp

C:\Users\enzo\Documents>del /ah .system.html.swp

C:\Users\enzo\Documents>

The syntax for the del command is shown below:

C:\>del /?
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

  names         Specifies a list of one or more files or directories.
                Wildcards may be used to delete multiple files. If a
                directory is specified, all files within the directory
                will be deleted.

  /P            Prompts for confirmation before deleting each file.
  /F            Force deleting of read-only files.
  /S            Delete specified files from all subdirectories.
  /Q            Quiet mode, do not ask if ok to delete on global wildcard
  /A            Selects files to delete based on attributes
  attributes    R  Read-only files            S  System files
                H  Hidden files               A  Files ready for archiving
                I  Not content indexed Files  L  Reparse Points
                -  Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.

C:\>

[/os/windows/commands] permanent link

Once You Know, You Newegg AliExpress by Alibaba.com

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo