Click here to Skip to main content
15,916,949 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to open the file name SymCorpUI.exe available in C drive but unable to execute the exe file directly without going through the whole directory path

What I have tried:

I use the code
Process.Start(My.Computer.FileSystem.CurrentDirectory & "\SymCorpUI.exe")

but it shows file not found
Posted
Updated 10-Oct-17 4:48am
Comments
Richard MacCutchan 10-Oct-17 11:51am    
You cannot. You must use the full path, unless the file is in the current working directory, or one of the directories listed in the PATH environment variable. And it is always much safer to use the full known path.

1 solution

Start by looking at exactly what file path you are trying to open.
C#
Dim path as String = My.Computer.FileSystem.CurrentDirectory & "\SymCorpUI.exe"
Process.Start(path);
Put a breakpoint on the Process.Start line, and run your app in the debugger. When it hits, look at the content of path.
It should be the full path to the executable, so check that folder holds the file. If it doesn't, then you need to specify a different folder ...
 
Share this answer
 
Comments
Member 10616186 10-Oct-17 11:11am    
Sir, Still shows same error as SymCorpUI.exe file is available in path
C:\Program Files\Symantec\Symantec Endpoint Protection\Bin
but I want to run without specify the path
OriginalGriff 10-Oct-17 11:29am    
Ah! The only way to run it without specifying the path is if it is in a location that Windows searches for executables. If you open a command prompt and type "path" it will show you where that is at present.

If it isn't in one of those folders, Windows won't find it and it won't get run without a path being specified.
Member 10616186 10-Oct-17 11:16am    
while Debugging then path shows Nothing
Member 10616186 11-Oct-17 3:24am    
Sir, I think we go with some alternate like firstly we access the full path of the Symantec File & then it appears on some label box then we call that label through Process. Start.

Currently I am not able to access the full path like file name- SymCorpUI.exe is available in "C:\Program Files\Symantec\Symantec Endpoint Protection\12.1.7061.6600.105\Bin" but how can we access the path or while form loading whether above path appeared

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900