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.

Empfohlene Antworten

Veröffentlicht

Hallo Leute,

Ich habe auf meinem Rechner 2 SQL-Instanzen laufen und muss diese öfters wechseln. Dies würde ich gerne mit einer batch Datei machen.

Mein Entwurf sieht so aus

@echo off

set DIENST1="MySQL-Instance-1"

set DIENST2="MySQL-Instance-2"

net start %DIENST1% 2>nul

if errorlevel 1 (

  net stop %DIENST1%

  net start %DIENST2%

) else (

  net stop %DIENST2%

  net start %DIENST1%

) 

pause

Es funktioniert soweit auch, aber es ist nicht sehr elegant.

Beispielsweise kommen bei errorlevel 1 noch die Fehlermeldungen und auch die Tatsache, dass er immer erst den Dienst 1 versucht zu starten hält auf.

Wie sehe es mit einer Möglichkeit aus, erst abzufragen welcher Dienst grad läuft und danach drauf zu reagieren?

Hab es versucht mit sc query aber das habe ich nicht hinbekommen.

Wer schön wenn mir jemand helfen könnte, bin absoluter Laie mit batch-Dateien.

Danke schon mal.

Ich weis nicht, ob das dein Problem schon löst:

@echo off

set DIENST1="MySQL-Instance-1"

set DIENST2="MySQL-Instance-2"

net start |find "%DIENST1%" >nul

if errorlevel 0 (

  net stop %DIENST1%

  net start %DIENST2%

) else (

  net stop %DIENST2%

  net start %DIENST1%

) 

pause

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.