Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SearchPath in C#

Empfohlene Antworten

Veröffentlicht

Hallo,

Mein Problem ist dass ich eine Textbox habe, wo der user seinen Pfad eingibt um irgentein File zu starten. Das führe ich mit


//C_ComponentsDefault.Command = Pfad;

//C_ComponentsDefault.Parameter = Parameter;


System.Diagnostics.Process.Start(C_ComponentsDefault.Command, C_ComponentsDefault.Parameter);

aus.

Nun will ich das wenn der Benutzer notepad.exe, Editor.exe, Word, Excel ..... eingibt das dieser Process ausgeführt wird, wobei er selber sucht wo sich dieser Process befindet.

z.b

Soll er bei der Eingabe von notepad.exe in C:\Windows\system32 suchen und es dort ausführen.

Ich habe von einer Funktion SearchPath gehört die es aber in c# nicht gibt.

Wollte wissen wie man das lösen könnte.

mfg

  • Autor

Hallo,

habe mein Problem heute noch gelöst und zwar durch:

  

//String mit dem Inhalt der Umgebungsvariable Path   (cmd.exe set path)

string Paths = Environment.GetEnvironmentVariable("Path");

//Split der Directory Pfade mit ;

                        string[] MembersOfPath = Paths.Split(new Char[] { ';' });


                        foreach (string PathItem in MembersOfPath)

                        {

                            if (File.Exists((PathItem + "\\"+txtCommand.Text)))

                            {

                                string newPath = (PathItem + "\\"+ Convert.ToString(txtCommand.Text));

                                System.Diagnostics.Process.Start(newPath, txtParameter.Text);

                                break;

                            }

                        }

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.