1

Somehow it seems that my windows 7 cmd prompt is only working correct sporadically. If I open a new cmd I can nearly always execute applications within PATH (sometimes this doesn't work either). But after a few executions the command which worked previously stops working and cmd is telling me:

The command "java.exe" is misspelled or couldn't be found (translated from german)

After opening a new cmd, the problem is gone. Can someone explain why this happens and how I can solve this?

8
  • Version of windows? Maybe example of programs you execute and afterwards cmd doesn't work anymore? Or is it just with java.exe?
    – Silviu
    Commented May 10, 2012 at 12:43
  • Windows is Win7 although cmd tells Microsoft Windows [Version 6.1.7601]. Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten. C:\Users\philipph>notepad.exe C:\Users\philipph> Second terminal Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten. C:\Users\philipph>notepad.exe Der Befehl "notepad.exe" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
    – philnate
    Commented May 10, 2012 at 12:53
  • I'm having the same problem sporadically on a Windows 2003 Server R2 Standard. My guess from the programmer's perspective is that the launching process (i.e. the shell, "Explorer") is induced to forget its environment and therefore doesn't pass it to child processes anymore. The reason could be shell extensions or any kind of DLL that can do this from within the shell process. Commented May 10, 2012 at 13:03
  • @STATUS_ACCESS_DENIED: It's possible, but according to philnate's description, it's a running cmd instance that suddenly forgets its environ, but ones created afterwards work fine again. Commented May 10, 2012 at 13:06
  • In this case the solution is even easier because any script can modify the environment of a running cmd.exe when it gets to run there. So check PATH before and after running the commands/scripts and then see which one is causing the issue and fix the script/program or wrap it into a script that will retain the environment ... Commented May 10, 2012 at 13:08

2 Answers 2

3

Have you checked the PATH after java not working? May be a batch file modified the PATH.

1
  • It's recommended to write batch scripts with setlocal as the first command to avoid this kind of problems. Commented May 11, 2012 at 12:28
0

try using the console and when it does work issue:

prompt:\> sfc /scannow

you will be probably asked for the Windows CD...

Maybe reverting to a previous system restore point can do the trick...

1
  • Luckily there's no need to use that heavy countermeasurement
    – philnate
    Commented May 11, 2012 at 5:55

You must log in to answer this question.

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