Skip to main content

All Questions

Tagged with
799 votes
8 answers
2.6m views

How can I display the contents of an environment variable from the command prompt in Windows 7?

In Windows 7, when I start the Command prompt, is there any command to display the contents of an environment variable (such as the JAVA_HOME or PATH variables)? I have tried with echo $PATH, echo ...
Jonas's user avatar
  • 27.9k
160 votes
16 answers
736k views

How can I find out when Windows was last restarted?

How can I know when my computer running Windows 7 was last restarted? I prefer a solution that doesn't involve searching the event log, but something like wmic or maybe cmd commands.
Royi Namir's user avatar
  • 5,788
130 votes
6 answers
674k views

Restart a Windows service from the command line

Is there a way to restart a Windows service from the command prompt?
Joe's user avatar
  • 1,311
114 votes
14 answers
259k views

How can I always run the command prompt as administrator?

As a developer, I often have the need to open a command prompt for various purposes. For example, I use iisreset to restart my local web server. I typically open the command window in one of two ways:...
Kevin's user avatar
  • 1,623
105 votes
2 answers
454k views

CMD cd to other drives except C:\ not working [duplicate]

Possible Duplicate: Using cd Command in Windows Command Line, Can't Navigate to D:\ I am unable to cd D:\ or cd D: or to any other drives. I am facing this problem from last 2 months but ...
Shishant's user avatar
  • 1,395
105 votes
6 answers
350k views

Turn off display in Windows on command

Is there a way to turn off the display in Windows (7), preferably without using additional software? Powershell script works fine, but leaves command-line window after turning on the display.
unicoio's user avatar
  • 1,059
98 votes
22 answers
745k views

How can I delete all files/subfolders in a given folder via the command prompt?

I would like to delete all files and subfolders using a batch file in Windows 7 and keep the top folder. Basically emptying the folder.
Tony_Henrich's user avatar
  • 11.9k
98 votes
10 answers
330k views

How to check if a directory exists in Windows?

I would like to translate this Linux/Bash script to Windows shell: if test -d myDirName; then echo "ok"; else mkdir myDirName; fi It tests if a directory exists, and if it doesn't it creates it.
Pietro's user avatar
  • 1,789
88 votes
5 answers
1.1m views

How do I locate the MAC address of my computer?

I am unable to locate the MAC address in a new computer with Windows 7. I've tried ipconfig /all in the console to which I got no items match your search. I also tried getmac. A screen flashed very ...
user avatar
87 votes
8 answers
598k views

Can I get more information on what Windows Update is doing?

It often happens that I have to watch this screen for minutes: I have no clue what's happening in the back. And I'm also not interested in watching the WindowsUpdate.log for changes. I would love to ...
Oliver Salzburg's user avatar
86 votes
14 answers
223k views

Hibernate computer with a timeout from command line on Windows 7

I am trying to hibernate my computer from the command. I was using shutdown /s /t 20 to shutdown the the computer. I change /s to /h to hibernate and now it just returns the usage text as if it doesn'...
A Jackson's user avatar
  • 1,027
76 votes
6 answers
19k views

How can I permanently change the Command Prompt in Windows 7?

I would like to change the prompt to $p$g$_$f permanently, but it resets itself every time I reopen the command window. How can I get it to stay the same forever?
oscilatingcretin's user avatar
75 votes
8 answers
113k views

Less or More in Windows?

Is there a command in the Windows DOS prompt that is equivalent to the UNIX less or more? Basically, the problem is that when I type hg log, the output has too many lines to fit on the screen and I ...
Jeffrey Greenham's user avatar
71 votes
4 answers
40k views

Which special variables are available when writing a shell command for a context menu

When extending the Windows' shell context menu (e.g. for adding an 'Open command here' prompt on directories), a 'command' key needs to be created in the registry. The value of this 'command' key ...
Gio's user avatar
  • 813
71 votes
3 answers
64k views

Command prompt hangs until keypress?

Problem: For some reason once in a while my command prompt would hang until I press a random key, and it would continue operation as if nothing happened. Occurrence: This happens when I am running a ...
Razor Storm's user avatar

15 30 50 per page
1
2 3 4 5
73