Bonjour à tous,
Tout est dans le titre. Est-il possible d'afficher dans une variable le nom du PC... Si possible sans plugin payant!
Merci d'avance
Afficher le nom du PC [resolu]
Moderator: Neosoft Support
-
- Posts: 13
- Joined: Wed Nov 19, 2014 3:36 am
Afficher le nom du PC [resolu]
Last edited by elcoco6262 on Tue Jun 21, 2016 2:53 am, edited 1 time in total.
Re: Afficher le nom du PC
You can get the machine name using a DOS variable and either copy it to the clipboard or to a file.
Example:
In a cmd.exe window type this:
echo %computername% |clip
and then paste the result from the clipboard
or
echo %computername% > file.txt
and then read the value from the file.txt file.
You can do this from a NB RUN command using cmd.exe as the executable and the info above as the parameters
Example:
In a cmd.exe window type this:
echo %computername% |clip
and then paste the result from the clipboard
or
echo %computername% > file.txt
and then read the value from the file.txt file.
You can do this from a NB RUN command using cmd.exe as the executable and the info above as the parameters
David Payer
Des Moines, Iowa
USA
Des Moines, Iowa
USA
-
- Posts: 13
- Joined: Wed Nov 19, 2014 3:36 am
Re: Afficher le nom du PC
Mille mercis Dpayer, ça fonctionne bien.
Mon collègue a trouvé une autre solution, pour ceux que cela pourrait intéresser.
Créer une nouvelle fonction VB (F11) :
set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
publication.nbSetVar "[thecomputername]", sComputername
enregistrer la nouvelle commande, par exemple: ComputerName.
Ensuite dans les actions du bouton (ou autre) appeler la fonction avec la commande: call
Pour finir, il ne reste plus qu'à afficher ma variable [thecomputername] dans une zone texte (ou autre) et le tour est joué.
Je n'y pense pas assez à cette bibliothèque de fonctions.
Mon collègue a trouvé une autre solution, pour ceux que cela pourrait intéresser.
Créer une nouvelle fonction VB (F11) :
set oNetwork = CreateObject("WScript.Network")
sComputerName = oNetwork.ComputerName
publication.nbSetVar "[thecomputername]", sComputername
enregistrer la nouvelle commande, par exemple: ComputerName.
Ensuite dans les actions du bouton (ou autre) appeler la fonction avec la commande: call
Pour finir, il ne reste plus qu'à afficher ma variable [thecomputername] dans une zone texte (ou autre) et le tour est joué.
Je n'y pense pas assez à cette bibliothèque de fonctions.