简体   繁体   中英

opening file directory by not using a string

Ok I may have the title wrong. But this is what I want to do. I know how to open file directories. What I was wander can I use

System.Diagnostic.Process.Start(@" ");

Now the empty quotes is my question. Instead of me manually imputing each application in code. Can is it possible that I can leave it blank.

I am using speech.synthesis and I was wanting to try to avoid if and else statements. However, if I add a new app to my desktop, I would have to update the program for the new app to be apart of the system.

My original way is like this

if (speech == "open notepad")
{
system.Diagnostic.Process.Start(@"notepad.exe);
}
else
{
if (speech == "open wordpad")
{
Sytem.Diagnostic.Process.Start(@"wordpad.exe);
}

So on and so on.. Is there a way to have an open " " that will automatically open the directory when called. So I do not have to keep doing program updates and releases..

This is done in winforms, and is for my own personal use.. The reason why I ask is, if I do release it to the public, then the programs I have listed, the user may or may not have my programs.

if you have the speech-to-text dictionary, why not store the user input into a string, then attempt to open a program with that string. Obviously you'll need to verify it's an installed program. I wish I could give you demo code, but I have no idea what StoT you're using.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM