0

I took a java class a few semesters ago, and in order to do things like compile the code, they had us modify a number of things.

I wasn't paying attention to what I was changing and I no longer have access to the course to look it up and reverse it. Unfortunately, my command prompt (and power shell - they both went through the same processes) no longer recognizes commands like "ping" or "tracert" or any of those other super handy-dandy things. If I try to ping, it simply says the command was not recognized. I get the same thing for tracert and other similar commands.

I'm just wondering if there's a way to reset everything on the command prompt so that it's just like it was the day I installed the OS. Any thoughts?

2 Answers 2

0

"No longer recognises"? What happens when you try? What's the output?

I suspect your PATH environment variable got changed (side note: this is why I always either refuse to make these changes or do it in a VM).

  1. Open the environment variable editor (search environment variable in the start menu, select the "edit the system env...", click the Environment Variables button in the dialog that comes up)

  2. Look for the PATH variable in both the user and system boxes. Those are what gets searched to find executables like ping. The user PATH is appended to the SYSTEM one automatically.

  3. Copy the contents to a text editor for easier reading. You'll want to remove the extraneous ones - we'll have to see the contents before providing more specific advice.

  4. Set those variables again with the edited ones.


When you type a command like ping, the system will first search the current directory, followed by each path in PATH until it finds a match. The first match is the one that is used. This is the most likely change to affect both cmd and PowerShell.

3
  • If this answer seems somewhat vague, that's because your question is vague. You'll need to provide either the output when you attempt the command, or the contents of the PATHs, preferably both, before I can give you a more concrete answer.
    – Bob
    Dec 10, 2014 at 4:58
  • You're correct - the PATH is screwed up. If I try to ping, it just says the command wasn't recognized. There's no User variable called "PATH", just "javac" (the one my teacher had us add), TEMP, and TMP. For System variables, there's a Path variable, but it goes to my nvidia folder (for some reason) and my leftover JDK. Where do I find the correct variable values?
    – Kulahan
    Dec 10, 2014 at 5:53
  • @DanCallahan So there's nothing but those two? ...yea, that's completely, utterly broken. You should at the very least have C:\Windows and C:\Windows\System32. However, there's also more than that, even in a default installation. Do you know when this happened? How long ago? How many times have you restarted since then? If it's recent enough, you might be able to recover the original from the automatic registry backup, or from System Restore.
    – Bob
    Dec 10, 2014 at 6:11
0

For those of you wondering, I was able to fix it using Bob's PATH suggestion. I appended the following to my PATH: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .