zoolfree
Goto Top

Ras Einwahl suchen und nutzen

hallo und sonnige grüße aus starnberg (bei münchen)

Ich bin gerade an einem script, welches im phonebook nach einträgen suchen soll und diese dann zu einwahl nutzen.

bei mir sieht das gerade im moment so aus:

:predial
cls
FIND "[FIRMA MPLS]" "C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Microsoft\Network\Connections\Pbk\rasphone.pbk" > nul
if errorlevel=1 goto predialnotfound
if not errorlevel=1 goto dialin

:predialnotfound
cls
Echo The VPN connection is not correct installed / has a wrong name.
Echo Please contact the Helpdesk under (-000) for further help.
Echo The Tool will close in 10 seconds.
ping -n 10 localhost > NUL
goto done

:dialin
REM Einwahl ins Firmennetz
cls
Echo Please click on EN=(connect) DE=(Verbinden) for VPN
Echo.
Echo If the connection is established please be patient.
Echo The Tool will proceed automatically as soon as the
Echo network could be reached.
rasphone -d "FIRMA MPLS"
if errorlevel=623 goto predialnotfound
ping -n 10 localhost > NUL
goto network

:network
usw....


Mein Problem ist nun, dass ich nicht genau weiß wie die MPLS Verbindung eingebunden wurde.
Ich möchte nun variablen eingeben können, nach denen gesucht werden soll und diese sollen dann,
falls sie gefunden werden zu einwahl genutzt werden.

also in etwas so

parameter nach denen gesucht werden soll: mpls arcor firma einwahl
nach diesen sol gesucht werden (stehen immer in eckigen klammern
z.B. bei Find /N /I "C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Microsoft\Network\Connections\Pbk\rasphone.pbk"
erhallte ich zwei Zeilen
[1 ] [Firma MPLS]
[89] [Mobile VPN]

nutzen möchte ich aber nur die [Firma MPLS] welche dann als variable übergeben werden soll:

also rasdial %variable%

Ich hoffe sehr auf hilfe und gebe gerne auch noch ein paar infos ...

edit:
wir haben nun das erarbeitet - geht aber nicht:
@echo off
cls
rem :: Set file name to use
SET FILE="C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Microsoft\Network\Connections\Pbk\rasphone.pbk"
REM SET FILE="C:\rasphone.pbk"

rem :: find all section names [...] and remove with for command
For /F "skip=2 delims=" %%i in ('find "[" %FILE%') Do (

set meine_variable=%%i
echo %meine_variable%

if "%meine_variable%" == "Arcor VPN" echo 1
if "%meine_variable%" == "Firma MPLS" echo 2
if "%meine_variable%" == "Mobile VPN" echo 3
)

pause


gruß aus starnberg

Zool

Content-Key: 119431

Url: https://administrator.de/contentid/119431

Printed on: April 19, 2024 at 23:04 o'clock