Tag Info

Hot answers tagged


A little known one is getmac It shows the MAC address(es) of your network adapter(s).


You could run it silently using a Windows Script file instead. The Run Method allows you running a script in invisible mode. Create a .vbs file like this one Dim WinScriptHost Set WinScriptHost = CreateObject("WScript.Shell") WinScriptHost.Run Chr(34) & "C:\Scheduled Jobs\mybat.bat" & Chr(34), 0 Set WinScriptHost = Nothing and schedule it. The ...


In the command prompt type: C:\> start . It opens the current directory in the Windows Explorer.


A list I use a lot: nbtstat - List NetBIOS stats and information netstat - List TCP/IP stats and information ipconfig - List TCP/IP configuration for a system netsh - Network configuration for a system sc - manage services net - whole slew of commands to manage users and groups, shares, connections, etc. ping - makes sure a system is up on the network ...


Are you running this as a scheduled task? If so set it to run as a different user account then it won't be visible to the logged on user. If the script needs no network access to items that need windows auth (like file shares or printers), you can run it as "nt authority\system" and leave the password blank. On Windows 7, just set the user to SYSTEM, and ...


%~p0 Will return the path only. %~dp0 Will return the drive+path. More info on the subject can be found on Microsofts site


shutdown.exe allow you to shutdown or reboot a machine. You can even reboot a remote machine with shutdown -m \\server -t 0 -r It even comes with a graphical user interface shutdown -i and you can abort a shutdown with shutdown -a


Robocopy is really useful. It mirrors directories. It is great for backups, restoring, and transferring large amounts of files. It only transfers files which have changed and can resume from where it left off. It comes standard in Windows Vista and later, but Windows XP users can get it as part of the Windows Server 2003 Resource Kit (free) or later.


The poster wants to ensure the service is stopped before trying to restart it. You can use a loop on the output of "sc query" doing something like this: :stop sc stop myservice rem cause a ~10 second sleep before checking the service state ping -n 10 -w 1000 > nul sc query myservice | find /I "STATE" | find "STOPPED" if errorlevel 1 goto ...


(Not really a command per-se, but a way to get there.) For those of you that find yourself going to Start > Run > "cmd" a lot, you can cut down some steps. Say you want to get your IP address. You would normally go Start > Run > "cmd" [enter] then... ipconfig [enter] Now instead, go... Start > Run > "cmd /k ipconfig" This will run cmd and the command ...


Powershell and WMI. Get-WmiObject Win32_Process | Select ProcessId,CommandLine Or Get-WmiObject -Query "SELECT CommandLine FROM Win32_Process WHERE ProcessID = 3352" Note that you have to have permissions to access this information about a process. So you might have to run the command as admin if the process you want to know about is running in a ...


The forgotten art: DOS String Manipulation! set mydate=%date:~10,4%_%date:~4,2%_%date:~7,2% echo %mydate% Output will be YYYY_MM_DD. Copy and paste this into a .bat file and be amazed! This is especially useful for creating backups, or any time/date series of directories and files. An example: @echo off :: Yes, this looks bad, but it works, it sets ...


This will get most of it: Net Use If you have any drives mapped via subst you would also need to get those: Subst For completeness, you would do it like this in Powershell (if you are on windows 7 or have installed it): gwmi win32_LogicalDisk -filter DriveType=4 You can also do it from the command prompt or a batch file using WMI like this: wmic ...


tasklist.exe will list processes on local or a remote machine. tasklist.exe /S server It can display which Services the scvhost.exe processes are hosting with tasklist /SVC You can also do some filtering. This will display the processes on a remote machine that have used more than 15 minutes of CPU time tasklist /S server /FI "CPUTIME gt 00:15:00"


control userpasswords2 Opens the classic User Accounts dialog:


Powershell. PS C:\> netstat | Select -First 20 Edit: I have a feeling that you're going to insist that you're only able to use cmd.exe circa 1989, but that's not true. Powershell is baked into every OS version Vista+, and is installable on XP/2003. It is the future of Windows. Edit: Alright, have it your way. C:\> netstat -an > temp.txt ...


I find that I use findstr a lot to find stuff in logs, error files, etc. A simple example: in the log file ex0905.log we find all lines that have 2009-05-05 in them: findstr "2009-05-05" ex0905.log


Programs and Features (Formerly known as "Add or Remove Programs") appwiz.cpl Opens


Sometimes I have to worry about too few free sessions for a Terminal Server connection to a server. quser displays information about user sessions on a terminal server. quser /SERVER:myserver Output C:\Documents and Settings\sysmanager01>quser /SERVER:serverx USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME usr_hot1 ...


Monitor the event logs on the domain controllers for event 672. It will show all successful logon events for AD users and which computer they logged on from. Filter by computer to get logon events for only those computers that you are interested in.


May be missing something, but I use this all the time: net stop "myservice" net start "myservice" or shorter: net stop "myservice" && net start "myservice"


If you're considering scripting it, it's always helpful to learn about the pushd and popd commands. Sometimes you can't be sure what drives letters are already used on the machine that the script will run on and you simply need to take the next available drive letter. Since net use will require you to specify the drive, you can simply use pushd ...


You can use the WMI subsystem, using WMIC.EXE to get to this information. Assuming a PID of 600: wmic.exe path Win32_Process where handle='600' get name, commandline /format:list You can also search for name, or other characteristic of the process. Use this command to list all attributes: wmic.exe path Win32_Process get /format:list


Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page: Powerful Bash-like line editing from GNU's Readline library. Superior path completion (TAB). Paste from clipboard (Ctrl-V). Support for the completion of executables/commands, and environment variables. Undo/Redo (Ctrl-_ ...


I use qwinsta to see disconnected remote desktop sessions and logoff to end them. It works on Windows 2000, Windows XP, Windows Vista, Windows Server 2003 and probably Windows Server 2008 (never tried).


systeminfo Displays a ton of information about the system at hand. The following are what it outputs on Vista: Host Name OS Name OS Version OS Manufacturer OS Configuration OS Build Type Registered Owner Registered Organization Product ID Original Install Date System Boot Time System Manufacturer System Model System Type Processor(s) BIOS Version ...

Only top voted, non community-wiki answers of a minimum length are eligible