Windows 10, trouble running executable from cmd

swankster

New Member
Joined
Apr 25, 2024
Messages
3
windows 10 64 bit environment When starting an executable program from cmd line it will not appear in task manager. but it is running just not showing any signs of it running. but after closing the cmd shell then my program appears in task manager. If I enter something like start chome, it works as expected.
And yet if I execute the program from file explorer it works perfectly.

also it will not start at all if i indicated the absolute path. I must be in the directory in which my program lives.

any ideas as to the cause of this?

for example when attempting to start my program from cmd OPC-UAServer.exe. it acts as if it is not running however I know that it is because I can connect to the server with my client. once I close cmd shell OPC-UAServer appears in task manager.

what i expect to see is the OPC-UAServer appear in task manager once it is running. not appearing after the cmd shell is closed.
 


Solution
This issue can be caused by different factors, so let's try to apply few solutions to determine the root of the problem:
  1. The User Permissions: In some cases, the problem can be overcome by explicitly running the command prompt as an administrator. To do so, search for "cmd" in the start menu, right-click on "Command Prompt" and select "Run as administrator".
  2. The PATH environment variable: The system might not be able to find your program because its directory isn't included in the PATH environment variable. You can verify this by trying to execute your program from another directory. If it doesn't start, then its directory isn't in PATH. To add an absolute path to the PATH variable permanently, use the command...
This issue can be caused by different factors, so let's try to apply few solutions to determine the root of the problem:
  1. The User Permissions: In some cases, the problem can be overcome by explicitly running the command prompt as an administrator. To do so, search for "cmd" in the start menu, right-click on "Command Prompt" and select "Run as administrator".
  2. The PATH environment variable: The system might not be able to find your program because its directory isn't included in the PATH environment variable. You can verify this by trying to execute your program from another directory. If it doesn't start, then its directory isn't in PATH. To add an absolute path to the PATH variable permanently, use the command: setx PATH "%PATH%;C:\your\path\here" – replacing the example path with the path to your program, of course.
  3. The Executable Dependencies: Your executable may have dependencies on DLLs or other executables that live in the same directory. If you start the program from a different directory or via an absolute path, those dependencies might not be picked up correctly. You would need to make sure any needed DLLs are also within a directory listed in your PATH environment variable.
  4. Improve your command line: For the purpose of seeing your server in task manager immediately, you can consider changing your command a bit. Instead of using start OPC-UAServer.exe, try using start /B OPC-UAServer.exe. The /B Parameter will start an application without creating a new window.
  5. Task Manager issue: Sometimes, Task Manager might be having issues refreshing its view. Try to sort processes by name or sort them by PID, also click on "view" within Task Manager and select 'update speed' to high. Try these steps, see which one helps. If it still doesn’t work, please give more information about the program and your system environment. Also, keep in mind that it's recommended to run such applications not from the command line, but as a Windows service.
 


Solution
None of the above worked. had already tried all before except for item 4.
This program executes fine from file explorer. but my client program will attempt to start the server if it is not running. for that it needs to access from cmd line.
 


To the second part of your question the directory path must exist in the system or user PATH environment variable. If it does not work make sure the directory path is correct, also setting it from an existing cmd session will not work since PATH will not re-read the new value of PATH.

Under normal conditions any binary will show up under the task manager. Under the process tab it will only show up under it's parent cmd process or go to the details tab to see all processes in a flat format.
 


This process is working as expected on another win10 VM. how is it that directing a absolute path to the exe would not work. it has since the beginning of windows 3.1. if i run c:\TSL\UaServer\pulpheat\TSL-PacPulpHeat_UaServer.exe in cmd nothing happens. but if i am at start c:\TSL\UaServer\pulpheat and then run TSL-PacPulpHeat_UaServer.exe. it acts as if nothing has happened but i am able to talk to the server with the client. I do see it running under windows command prompt, but then on closing the command prompt it continues to run as its own process. if it is running under cmd then it should close when the cmd is closed. correct?
why does my process work in one VM but not in the other?
 


Back
Top