Planifier une tache qui exécute un .bat
florimon10
Messages postés
1
Date d'inscription
Statut
Membre
Dernière intervention
-
WcsSkwal Messages postés 107 Date d'inscription Statut Membre Dernière intervention -
WcsSkwal Messages postés 107 Date d'inscription Statut Membre Dernière intervention -
Bonjour, à tous
Voila pour une raison professionnel j'ai besoins de lancer un fichier .bat au démarrage d'une session.
Le problème est le suivant :
La tache doit ce lancer en admin et doit donc etre créée depuis un compte admin mais le .bat doit s'ouvrir sur un compte utilisateur. j'ai créé ma tache planifié avec donc comme sessions pour exécuter ma session admin et en déclencheur l'ouverture de ma session user. En action démarrer un programme avec le chemin (le programme ce trouve sur le bureau de la session admin). la tache est bien en excécuter avec les autorisations maximales.
en complément voici ce qui ce trouve dans le .bat :
@echo off
set carte="Ethernet"
set adrfixe=192.168.0.14
set masque=255.255.255.0
:question
SET /P Ethernet=Adressage IP 1/DCHP 2/FIXE 3/QUITTER (1/2/3)? :
if %Ethernet%==1 goto IPDHCP
if %Ethernet%==2 goto IPfixe
if %Ethernet%==3 goto Nfin
goto question
:IPfixe
SET /P Ethernet=confirmer l'adressage en IP Fixe 192.168.0.14 (O/N)? :
if %Ethernet%==o goto OKFixe
if %Ethernet%==O goto OKFixe
if %Ethernet%==n goto Nfin
if %Ethernet%==N goto Nfin
goto IPfixe
:OKFixe
netsh interface ip set address %carte% static %adrfixe% %masque%
goto Ofin
:IPDHCP
SET /P Ethernet=confirmer l'adressage en IP Dynamique (O/N)? :
if %Ethernet%==o goto OKDHCP
if %Ethernet%==O goto OKDHCP
if %Ethernet%==n goto Nfin
if %Ethernet%==N goto Nfin
goto IPDHCP
:OKDHCP
netsh interface ip set address %carte% dhcp
goto Ofin
:Nfin
@echo Aucune modification n'a ete appliquee
@echo -
SET /P Ethernet=appuyez sur [ENTREE] pour quitter
goto fin
:Ofin
@echo La nouvelle configuration vient d'etre appliquee
@echo -
SET /P Ethernet=appuyer sur [ENTREE] pour quitter
goto fin
:fin
Pour toutes autres informations je reste a votre disposition.
Voila pour une raison professionnel j'ai besoins de lancer un fichier .bat au démarrage d'une session.
Le problème est le suivant :
La tache doit ce lancer en admin et doit donc etre créée depuis un compte admin mais le .bat doit s'ouvrir sur un compte utilisateur. j'ai créé ma tache planifié avec donc comme sessions pour exécuter ma session admin et en déclencheur l'ouverture de ma session user. En action démarrer un programme avec le chemin (le programme ce trouve sur le bureau de la session admin). la tache est bien en excécuter avec les autorisations maximales.
en complément voici ce qui ce trouve dans le .bat :
@echo off
set carte="Ethernet"
set adrfixe=192.168.0.14
set masque=255.255.255.0
:question
SET /P Ethernet=Adressage IP 1/DCHP 2/FIXE 3/QUITTER (1/2/3)? :
if %Ethernet%==1 goto IPDHCP
if %Ethernet%==2 goto IPfixe
if %Ethernet%==3 goto Nfin
goto question
:IPfixe
SET /P Ethernet=confirmer l'adressage en IP Fixe 192.168.0.14 (O/N)? :
if %Ethernet%==o goto OKFixe
if %Ethernet%==O goto OKFixe
if %Ethernet%==n goto Nfin
if %Ethernet%==N goto Nfin
goto IPfixe
:OKFixe
netsh interface ip set address %carte% static %adrfixe% %masque%
goto Ofin
:IPDHCP
SET /P Ethernet=confirmer l'adressage en IP Dynamique (O/N)? :
if %Ethernet%==o goto OKDHCP
if %Ethernet%==O goto OKDHCP
if %Ethernet%==n goto Nfin
if %Ethernet%==N goto Nfin
goto IPDHCP
:OKDHCP
netsh interface ip set address %carte% dhcp
goto Ofin
:Nfin
@echo Aucune modification n'a ete appliquee
@echo -
SET /P Ethernet=appuyez sur [ENTREE] pour quitter
goto fin
:Ofin
@echo La nouvelle configuration vient d'etre appliquee
@echo -
SET /P Ethernet=appuyer sur [ENTREE] pour quitter
goto fin
:fin
Pour toutes autres informations je reste a votre disposition.
A voir également:
- Planifier une tache qui exécute un .bat
- Creer un fichier .bat - Guide
- Bat to exe converter - Télécharger - Édition & Programmation
- Deplacer barre de tache windows 11 - Guide
- Planifier envoi mail gmail - Guide
- Gestionnaire de tache - Guide