Showing posts with label cmd. Show all posts
Showing posts with label cmd. Show all posts

2023-04-05

Count files in a folder from Command Prompt / PowerShell

  • Command prompt 
    • dir *.* /a-d | find "File(s)"
    • dir *.* /b /a-d | find /c /v ""
  • PowerShell
    • (Get-ChildItem C:\csv -filter "*.*").Count
    • (Get-ChildItem C:\csv -recurse -filter "*.*").Count recursive search
    • (Get-ChildItem C:\csv -filter "*.*").Count
    • [System.IO.Directory]::GetFiles("c:\Path").Count

2021-04-12

Change wireless network priority from command line

Open a command prompt and enter:

netsh wlan set profileorder name="NetworkName" interface="Wi-Fi" priority=1

Delete network profile / wifi connection from command prompt

Open a command prompt and run the following command:

netsh wlan delete profile name=SSID

If you get the following error:

You do not have sufficient privileges or the profile "YourProfile" on interface "wifi" is a group policy profile.
then try this:
  • stop the WlanSvc service (WLAN AutoConfig)
  • delete all files in the \Windows\wlansvc\Policies folder
  • try again to delete the profile
    • netsh wlan delete profile name=SSID
  • restart the WlanSvc service

2018-07-27

List / add NTP servers from command line

List NTP servers:
  • w32tm /query /peers
Add NTP servers:
  • w32tm /config /update /manualpeerlist:"ntp.server1.edu ntp.server2.edu ..."