Page 1 sur 1
question sur l'invité de commande
Publié : sam. 03/nov./2007 18:32
par venom
bonjour,
voila les fonction que l'on tape dans l'invité de commande exemple:
ipconfig
sa n'est pas possible d'inclure sa dans purebasic et d'afficher le resultat dans une fenentre ??
per exemple j'ai une fenetre avec un stringgadget ou je marque ipconfig. ensuite j'appuie sur ok et sa me renvoie dans un autre stringgadget les resultat souhaité ?
j'espert avoir etais assez claire désolé

.
@++
Re: question sur l'invité de commande
Publié : sam. 03/nov./2007 21:13
par Backup
.......
Publié : dim. 04/nov./2007 3:56
par venom

merci bien dobro c'est parfait
@++
Publié : dim. 04/nov./2007 13:02
par Ar-S
Venom,
Pour avoir un éventail de détails plus complet, tape "ipconfig /all" plutôt qu'ipconfig tout seul.
Publié : dim. 04/nov./2007 13:25
par venom
Pour avoir un éventail de détails plus complet, tape "ipconfig /all" plutôt qu'ipconfig tout seul.
oui merci Ar-S moi c'est plutot pour me servir de la fonction
tracert 
.
mais merci du conseille.
@++
Publié : lun. 15/juin/2009 0:20
par Fortix
salut, je viens de tomber sur ce post et justement je veux créer un program pouvant s'executer via l'invite de commande tout en lui passant ses arguments, donc si vous pouvez au moin m'expliquer comment faire passer des arguments sa serait intéressant, merci à vous
ProgramParameter
Publié : lun. 15/juin/2009 11:31
par meganet
Salut, tu peux recuperer les paramètres passe en ligne de commande en utilisant ProgramParameter.
Exemple :
Code : Tout sélectionner
; Creation d'une liste chainée pour stocker les parametres passes au programme.
NewList Parameters.s()
; Boucle pour ajouter chaque parametres dans la liste chainee.
For i=0 To CountProgramParameters()-1
; Ajout d'un element a la liste chainee.
AddElement(Parameters())
; Ajout du parametre dans l'élément précédemment cree.
Parameters() = ProgramParameter(i)
; Fin de la boucle.
Next i
; Code pour traiter les parametres ici.
; ...
; ...
; Vidage de la liste chainee contenant les parametres.
ClearList(Parameters())
; Fin du programme.
End
Voila, bonne journee!
Publié : mar. 16/juin/2009 15:30
par TazNormand
Essaies le code proposé ici par ABBKlaus sur le forum Anglais : [ur=
http://www.purebasic.fr/english/viewtop ... ptersinfol]GETMAC[/url]
Je le republie pour t'éviter de naviguer :
Code : Tout sélectionner
; ABBKlaus Mon May 17, 2004 20:16
; http://msdn2.microsoft.com/en-us/library/aa365917.aspx
; with the help of IPHlpAPI.inc from the Powerbasic include-file for the structures
; Microsoft isn´t quite a help here :-)
; modified by PSW Wed Sep 06, 2006 07:49
; PB4.02 compatible since 29.05.2007 19:48
; PB4.10 compatible on 23.12.2007 21:03
ImportC "msvcrt.lib"
asctime.l(a.l)
localtime.l(a.l)
strftime.l(a.l,b.l,c.p-ascii,d.l)
EndImport
Structure IP_ADDR_STRING
pNext.l
IpAddress.b[16]
IpMask.b[16]
Context.l
EndStructure
Structure TM
tm_sec.l
tm_min.l
tm_hour.l
tm_mday.l
tm_mon.l
tm_year.l
tm_wday.l
tm_yday.l
tm_isdst.l
EndStructure
#MAX_ADAPTER_NAME_LENGTH=256
#MAX_ADAPTER_DESCRIPTION_LENGTH=128
#MAX_ADAPTER_ADDRESS_LENGTH=8
#MIB_IF_TYPE_OTHER = 0
#MIB_IF_TYPE_ETHERNET = 1
#MIB_IF_TYPE_TOKENRING = 2
#MIB_IF_TYPE_FDDI = 3
#MIB_IF_TYPE_PPP = 4
#MIB_IF_TYPE_LOOPBACK = 5
#MIB_IF_TYPE_SLIP = 6
Structure IP_ADAPTER_INFO
pNext.l
ComboIndex.l
AdapterName.b[#MAX_ADAPTER_NAME_LENGTH+4]
Description.b[#MAX_ADAPTER_DESCRIPTION_LENGTH+4]
AddressLength.l
Address.b[#MAX_ADAPTER_ADDRESS_LENGTH]
Index.l
Type.l
DhcpEnabled.l
CurrentIpAddressPTR.l
IpAddressList.IP_ADDR_STRING
GatewayList.IP_ADDR_STRING
DhcpServer.IP_ADDR_STRING
HaveWins.l
PrimaryWinsServer.IP_ADDR_STRING
SecondaryWinsServer.IP_ADDR_STRING
LeaseObtained.l
LeaseExpires.l
EndStructure
Structure MyIP_ADAPTER_INFO
AdapterName.s
Description.s
MACAddress.s
IPAdress.s
EndStructure
length.l=0
Result=GetAdaptersInfo_(0,@length) ; Get the length for Buffer
If Result=#ERROR_BUFFER_OVERFLOW And length
*Buffer=AllocateMemory(length)
If *Buffer And GetAdaptersInfo_(*Buffer,@length)=#ERROR_SUCCESS
*ipinfo.IP_ADAPTER_INFO=*Buffer
Global NewList MyIPAdapterList.MyIP_ADAPTER_INFO() ; declare list here
While *ipinfo
AddElement(MyIPAdapterList()) ; add one element
Debug "Index : "+Str(*ipinfo\Index)
Select *ipinfo\Type
Case #MIB_IF_TYPE_OTHER
Debug "Type : #MIB_IF_TYPE_OTHER"
Case #MIB_IF_TYPE_ETHERNET
Debug "Type : #MIB_IF_TYPE_ETHERNET"
Case #MIB_IF_TYPE_TOKENRING
Debug "Type : #MIB_IF_TYPE_TOKENRING"
Case #MIB_IF_TYPE_FDDI
Debug "Type : #MIB_IF_TYPE_FDDI"
Case #MIB_IF_TYPE_PPP
Debug "Type : #MIB_IF_TYPE_PPP"
Case #MIB_IF_TYPE_LOOPBACK
Debug "Type : #MIB_IF_TYPE_LOOPBACK"
Case #MIB_IF_TYPE_SLIP
Debug "Type : #MIB_IF_TYPE_SLIP"
Default
Debug "Type : unknown"
EndSelect
Debug "Name : "+PeekS(@*ipinfo\AdapterName,-1,#PB_Ascii)
MyIPAdapterList()\AdapterName=PeekS(@*ipinfo\AdapterName,-1,#PB_Ascii)
MyIPAdapterList()\Description=PeekS(@*ipinfo\Description,-1,#PB_Ascii)
Debug "Desc : "+PeekS(@*ipinfo\Description,-1,#PB_Ascii)
;IP-Adress
*iplist.IP_ADDR_STRING=*ipinfo\IpAddressList
While *iplist
Debug "IP-Adress : "+PeekS(@*iplist\IpAddress,-1,#PB_Ascii)
MyIPAdapterList()\IPAdress+PeekS(@*iplist\IpAddress,-1,#PB_Ascii)+Chr(13)
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
;Gateway
*iplist.IP_ADDR_STRING=*ipinfo\GatewayList
While *iplist
Debug "Gateway : "+PeekS(@*iplist\IpAddress,-1,#PB_Ascii)
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
;Wins
If *ipinfo\HaveWins
;PrimaryWinsServer
*iplist.IP_ADDR_STRING=*ipinfo\PrimaryWinsServer
While *iplist
Debug "P-Wins : "+PeekS(@*iplist\IpAddress,-1,#PB_Ascii)
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
;SecondaryWinsServer
*iplist.IP_ADDR_STRING=*ipinfo\SecondaryWinsServer
While *iplist
Debug "S-Wins : "+PeekS(@*iplist\IpAddress,-1,#PB_Ascii)
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
EndIf
;DHCP
If *ipinfo\DhcpEnabled
;DhcpServer
*iplist.IP_ADDR_STRING=*ipinfo\DhcpServer
While *iplist
Debug "DHCP Server Adress : " +PeekS(@*iplist\IpAddress,-1,#PB_Ascii)
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
;LeaseObtained
*Buffer2=AllocateMemory(#MAXCHAR)
If *Buffer2
strftime(*Buffer2,#MAXCHAR,"%d.%m.%Y %H:%M:%S",localtime(@*ipinfo\LeaseObtained))
Debug "Lease optained : "+PeekS(*Buffer2,-1,#PB_Ascii)
FreeMemory(*Buffer2)
EndIf
;LeaseExpires
*Buffer2=AllocateMemory(#MAXCHAR)
If *Buffer2
strftime(*Buffer2,#MAXCHAR,"%d.%m.%Y %H:%M:%S",localtime(@*ipinfo\LeaseExpires))
Debug "Lease expires : "+PeekS(*Buffer2,-1,#PB_Ascii)
FreeMemory(*Buffer2)
EndIf
Else
Debug "STATIC IP Configuration"
EndIf
;MAC-Adress
If *ipinfo\AddressLength
mac$=""
For i=0 To *ipinfo\AddressLength-1
If i
mac$+":"
EndIf
byte.b=PeekB(@*ipinfo\Address+i)
If byte>=0
mac$+RSet(Hex(byte),2,"0")
Else
mac$+RSet(Hex(byte+256),2,"0")
EndIf
Next
Debug "MAC-Address "+mac$
MyIPAdapterList()\MACAddress=mac$
EndIf
*ipinfo.IP_ADAPTER_INFO=*ipinfo\pNext
Wend
ForEach MyIPAdapterList()
Debug "-------------------------------------------"
Debug ListIndex(MyIPAdapterList())
Debug MyIPAdapterList()\AdapterName
Debug MyIPAdapterList()\Description
Debug MyIPAdapterList()\IPAdress
Debug MyIPAdapterList()\MACAddress
Next
Else
Debug "GetLastError="+Str(GetLastError_())
EndIf
If *Buffer
FreeMemory(*Buffer)
EndIf
EndIf
Publié : mer. 17/juin/2009 9:18
par Fortix
excellent, merci à vous tous

, pour la rapiditée de réponse
maintenant je vais de suite tester vos codes, puis je vous tiendrais au courant, merci encore

Publié : mer. 17/juin/2009 10:52
par Fortix
ok super sa marche

, vous êtes les meilleurs
