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

Saturday, January 10, 2015

Fast way to open CMD or Powershell from Windows Explorer

 

This is an amazing tip I found as a comment on the Rick Strahl’s Web Log (by peSHIr).

So, I’ve usually used Shift + Right Click to get to the “Open Command Window Here” option in the menu. It works, but the following tip is much nicer.

Just type cmd or powershell (overwrite the existing path) in the path field of the Windows Explorer, and hit Enter.

That is it! The cmd will just open directly in the path you were browsing in your Windows Explorer.

Great tip!

 

Thanks peSHIr

Friday, September 7, 2007

Tracking Down Svchost Process

In CMD window write:

tasklist /svc

Wednesday, June 20, 2007

NirCmd v2.00 - Freeware command-line tool

Windows only: Freeware command-line app NirCmd extends the functionality of the Command Prompt. NirCmd is a small command-line utility that allows you to accomplish tasks using the Command Prompt that would normally require a user interface. NirCmd has no "formal" installation process. All you need to do is copy "NirCmd.exe" to "C:\Windows" and then begin using it with Command Prompt. You can grab a list of the uses of NirCmd at the project homepage. NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface. By running NirCmd with simple command-line options, you can write and delete values and keys in the Registry, write values into INI files, dial to your internet account or connect to a VPN network, restart Windows or shut down the computer, create shortcuts to a file, change the created/modified date of a file, change your display settings, turn off your monitor, open the door of your CD-ROM drive, and more... NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface. By running NirCmd with simple command-line option, you can write and delete values and keys in the Registry, write values into INI file, dial to your internet account or connect to a VPN network, restart windows or shut down the computer, create shortcut to a file, change the created/modified date of a file, change your display settings, turn off your monitor, open the door of your CD-ROM drive, and more... Examples of what you can do with NirCmd Open the door of J: CD-ROM drive nircmd.exe cdrom open j: Close the door of Y: CD-ROM drive nircmd.exe cdrom close y: Increase the system volume by 2000 units (out of 65535) nircmd.exe changesysvolume 2000 Decrease the system volume by 5000 units (out of 65535) nircmd.exe changesysvolume -5000 Set the volume to the highest value nircmd.exe setsysvolume 65535 Mute the system volume nircmd.exe mutesysvolume 1 Unmute the system volume nircmd.exe mutesysvolume 0 Switch the system volume between the mute and normal state. nircmd.exe mutesysvolume 2 Create a shortcut on your desktop that switch the system volume between the mute and normal state. nircmd.exe cmdshortcut "~$folder.desktop$" "Switch Volume" mutesysvolume 2 Turn off the monitor nircmd.exe monitor off Start the default screen saver nircmd.exe screensaver Put your computer in 'standby' mode nircmd.exe standby log off the current user nircmd.exe exitwin logoff Ask if you want to reboot, and if you answer 'Yes', reboot the computer. nircmd.exe qboxcom "Do you want to reboot ?" "question" exitwin reboot Turn off your computer nircmd.exe exitwin poweroff Turn off all computers specified in computers.txt ! multiremote copy "c:\temp\computers.txt" exitwin poweroff force Dial to "My Internet" connection nircmd.exe rasdial "My Internet" Disconnect the "My Internet" connection nircmd.exe rashangup "My Internet" Make your Internet Explorer windows 75% transparent ! (192 / 256) nircmd.exe win trans ititle "internet explorer" 192 Minimize all your Internet Explorer windows nircmd.exe win min class "IEFrame" Close all your Internet Explorer windows nircmd.exe win close class "IEFrame" Close all your Explorer windows (My Computer, folders, and so on) nircmd.exe win close class "CabinetWClass" Hide all your Internet Explorer windows nircmd.exe win hide class "IEFrame" Show all your Internet Explorer windows (after you made them hidden with previous example) nircmd.exe win show class "IEFrame" Center all top-level windows nircmd.exe win center alltop Remove the title bar of My Computer window. nircmd.exe win -style title "my computer" 0x00C00000 Return the title bar of My Computer window that we removed in the previous example. nircmd.exe win +style title "my computer" 0x00C00000 Set the My Computer window to right-to-left order (For hebrew and arabic languages) nircmd win +exstyle title "my computer" 0x00400000 Set all child windows of My Computer window to right-to-left order (For hebrew and arabic languages) nircmd win child title "my computer" +exstyle all 0x00400000 Create a shortcut on your desktop that closes all your Internet Explorer windows nircmd.exe cmdshortcut " "~$folder.desktop$ "Close All IE" win close class "IEFrame" Create a shortcut on your desktop that hides all your Internet Explorer windows nircmd.exe cmdshortcut " "~$folder.desktop$ "Hide All IE" win hide class "IEFrame" Create a shortcut on your desktop that shows back all your Internet Explorer windows nircmd.exe cmdshortcut " "~$folder.desktop$ "Show All IE" win show class "IEFrame" Set the Windows Calculator as top-most window (above all other windows) nircmd.exe win settopmost title "Calculator" 1 Set the Windows Calculator back to regular window (non top-most window) nircmd.exe win settopmost title "Calculator" 0 Create a shortcut to Windows calculator under Start Menu->Programs->Calculators nircmd.exe shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator" Hide the desktop window nircmd.exe win hide class progman Show the desktop window (After hiding it in previous example) nircmd.exe win show class progman Hide the start button on the system tray nircmd.exe win child class "Shell_TrayWnd" hide class "button" Show the start button on the system tray nircmd.exe win child class "Shell_TrayWnd" show class "button" Hide the clock on the system tray nircmd.exe win child class "Shell_TrayWnd" hide class "TrayClockWClass" Show the clock on the system tray nircmd.exe win child class "Shell_TrayWnd" show class "TrayClockWClass" Kill (terminate) all instance of Internet Explorer processes nircmd.exe killprocess iexplore.exe Create a shortcut on your desktop that opens the door of K: CDROM drive when you run it. nircmd.exe cmdshortcut "~$folder.desktop$" "Open CDROM" cdrom open k: Create a shortcut to NirSoft Web site on your desktop nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.desktop$" "NirSoft" Add NirSoft Web site to your Favorities under Links folder. nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.favorites$\Links" "NirSoft" Create a shortcut to NirSoft Web site on the desktop of all computers listed in computers.txt nircmd.exe multiremote copy "c:\temp\computers.txt" urlshortcut "http://www.nirsoft.net" "~$folder.common_desktop$" "NirSoft" Set the display mode to 800x600x24bit colors nircmd.exe setdisplay 800 600 24 Create a shortcut on the desktop that set the display mode to 800x600x24bit colors nircmd.exe cmdshortcut "~$folder.desktop$" "800x600x24" setdisplay 800 600 24 Copy all shortcuts on your desktop to another folder (f:\temp\desktop). nircmd.exe execmd copy "~$folder.desktop$\*.lnk" f:\temp\desktop Restart your Apache server (under Windows NT/2000/XP/2003) nircmd.exe service restart apache Create a shortcut on your desktop that restarts the Apache server nircmd.exe cmdshortcut "~$folder.desktop$" "Restart Apache" service restart apache Restart your IIS nircmd.exe service restart w3svc Restart MySql nircmd.exe service restart MySql Open the desired Registry key/value in RegEdit nircmd.exe regedit "HKLM\Software\Microsoft\Windows\CurrentVersion" "CommonFilesDir" Open the Registry key that you copied to the clipboard in RegEdit. nircmd regedit "~$clipboard$" Disable the screen saver nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 0 Enable the screen saver nircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 1 Change the date/time of the specified filename (creation time and modified time) nircmd.exe setfiletime "c:\temp\myfile.txt" "24-06-2003 17:57:11" "22-11-2005 10:21:56" Copy your desktop folder path to the clipboard nircmd.exe clipboard set ~$folder.desktop$ Copy your start menu folder path to the clipboard nircmd.exe clipboard set ~$folder.start_menu$ Copy the content of info1.txt (simple text file) to the clipboard nircmd.exe clipboard readfile "c:\My Files\info1.txt" Add the text content of clipboard to info1.txt nircmd.exe clipboard addfile "c:\My Files\info1.txt" Clear the clipboard nircmd.exe clipboard clear Create all folders specified in "c:\temp\folders.txt". The folder path names are separated by CRLF characters. nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd md ~$fparam.1$ Install the specified .NET assembly in the global assembly cache (like gacutil) nircmd.exe gac install "C:\temp\MyAssembly\bin\MyAssembly.dll" Empty the recycle bin in all drives. nircmd.exe emptybin Answer 'Yes' to a standard Windows message-box. nircmd.exe dlg "" "" click yes

Tuesday, March 27, 2007

A beginners guide to the Command Prompt

Command Prompt small imageMost Windows users don’t know what the Command Prompt is or how to use it. This is a beginners guide to using the Command Prompt.

What is the Command Prompt? The Command Prompt is a native Windows program that lets you execute commands without using a GUI. You can accomplish pretty much every task you can do using Windows and the mouse from within the Command Prompt. The Command Prompt gets its roots (arguably) from a combination of MS-DOS and UNIX. Consider it “Windows without the windows. ” I will provide you with a beginners tutorial of some simple commands to familiarize you with the Command Prompt.



The first step is to actually open the Command Prompt. You can do this by going to Start >> All Programs >> Accessories >> Command Prompt. You should get a screen that resembles mine below:

Command Prompt image

You should see a blinking cursor after a line that says C:\Documents and Settings\username. This is used to identify what directory you are currently in. This also brings us to our first three commands cd, dir, and .. (two periods). Let’s start with dir — “dir” stands for directory. Type dir into the command prompt to see a listing of the directories and files located in your “username” directory.

After you type in dir you will see a listing of several folders including Desktop, Favorites and My Documents. “CD” stands for change directory. So in order to change to our “My Documents” folder we need to type cd My Documents, give it a try. You will now notice that your path has changed to C:\Documents and Settings\username\My Documents. To see a list of all the files in your My Documents directory type dir. If you want to move back into your username folder use the “back” command. You can move back by typing cd .. See the image below:

Command Prompt image



That’s a good introduction, but lets actually go over some useful commands: copy, del, mkdir, rmdir, ren. “CP” stands for copy and it can be used to copy individual files from one location to another. To copy a file, type copy filename destination. So if you had a file named test.txt in your My Documents folder and you wanted to copy it to the Desktop you would type copy test.txt ../Desktop

The del command stands for delete. So to delete the test.txt file from your desktop type cd ../Desktop and then type del test.txt

Command Prompt image 2

“mkdir” stands for make directory. To make a new folder type mkdir foldername

“rmdir” stands for remove directory. To remove a folder and its contents, type rmdir /s foldername

Command Prompt image 3

“ren” stands for rename. To rename a file type ren oldfilename newfilename



Let’s move on to a more difficult task. Let’s copy our My Videos folder from My Documents to the Desktop. To do this, navigate to your username directory by typing cd .. until you get there. Now type cd My Documents to get into the My Documents directory. To copy the My Videos directory to the Desktop you need to type xcopy “My Videos” “../Desktop/My Videos” /s /i

Command Prompt image 4



Here’s a summary of what you can now do using the command prompt:

cd change directories

dir see a list of all the files in one directory

copy copy a file from one location to another (don’t forget to include the file extension)

del delete a file (don’t forget to include the file extension)

mkdir make a new folder

rmdir remove a directory and its’ contents

ren rename a file

xcopy /s /i copy a directory and its contents from one location to another

NOTE: To see a list of many commands, just type help into the command prompt. To see a detailed list of all related commands type command/? so to see all the details of xcopy type xcopy/? If you would like to run an executable like Mozilla Firefox navigate to the directory containing the executable and simply type it in. So type: C:/Program Files/Mozilla Firefox/firefox.exe



If you would like to learn more about the command prompt here is the documentation from Microsoft. What other commands do you think are useful for beginners?



From