Jump to content

USe command : _RunDOS


DArkdjack
 Share

Recommended Posts

Hello All !

First you must to know I'm French so I don't Speak English very well.. i'm sorry for that. :)

I try to Use " _RunDos" command but it's don't work...

Can you help me please ? this is my code ... May you correct me please ? :

case $msg=$d

RunAsSet("Loggin","domain","password")

run("explorer \\"&GUICtrlRead($data40)&"\d$") OK

case $msg=$exprofile

_Rundos("md c:\TEST /computer="&GUICtrlRead($data40)&,"",@SW_MAXIMIZE) NOK

I will very happy if i can write Dos command in my code.. because i have a .BAT file and i want to change into a .AU3 file for make a .EXE file with a nice graphic windows ! ( not a Dos windows with choice)

I'm very sorry for my poor english ... :P

Thank you for your HELP ! :D

Link to comment
Share on other sites

:P Yes I can ! but it's Long code !

When you lunch my .Bat file you have 4 Choices.

1- Backup your Windows profil in P:

2- Restore your Windows profil

3- Backup your printer connection

4- Restore your Printer //

.........................................................-----------------------------

First I need to create a Backup folder in P: drive.

1- md p:\Backup\favorite

md p:\Backup\cookies

md p:\Backup\desktop

And copy the file :

xcopy "%userprofile%"\"favorite" p:\backup\favorite /E /I

xcopy "%userprofile%"\"cookies" p:\backup\cookies /E /I

xcopy "%userprofile%"\"desktop" p:\backup\desktop /E /I

--------------------------------------------------------------------------

In my AU3 file I create many Buttons. Look :

GUICtrlCreateLabel("HOSTNAME" :",50,150)

$data40=GUICtrlCreateInput ("",200,-1,100,20)

GUISetFont(9, 400)

$ping=GUICtrlCreateButton("Ping",310,-1,60,20) For ping "hostname" Computer

$c=GUICtrlCreateButton("C$",380,-1,60,20) For See all the file C: of "Hostname" Computer

$d=GUICtrlCreateButton("D$",380,180,60,20)

$exprofile=GUICtrlCreateButton("Backup Profil",520,150,87,20)

$improfile=GUICtrlCreateButton("Restore Profil",520,180,87,20)

$exprinter=GUICtrlCreateButton("Backup Printer",615,150,87,20)

$imprinter=GUICtrlCreateButton("Restore Printer",615,180,87,20)

------------------------------------------------------------------------------

case $msg=$ping

Run("cmd /k ping -t "&GUICtrlRead($data40),"",@SW_MAXIMIZE) Its Working

case $msg=$c

RunAsSet("Loggin","Domain","password")

run("explorer \\"&GUICtrlRead($data40)&"\c$") Its Working

case $msg=$d WORKING

case $msg=$exprofile

I Want to create all P: folder and lauch Xcopy for backup file.... same of the .bat !

Is it possible ??

--------------------------------------------------------------------------------------------

SOrry for BAd english :)

Thank You for your Help !

Link to comment
Share on other sites

:)

case $msg=$exprofile
        _Rundos("md c:\Restauration\bureau")
        _Rundos("md c:\Restauration\favoris")
        _rundos("md c:\restauration\cookies")
        _rundos("md c:\restauration\iseries")
        _RunDOS("xcopy "%userprofile%"\"favoris" c:\restauration\favoris /E /I")

It's OK !!

Only the last sentence... But it's work in .bat file. :P

THX

Link to comment
Share on other sites

It is possible to create a folder with a distant computer ?

In dos you either mount a drive from that computer onto your local one and than simply refer to that (remote) drive (see the dos-command "net use"), or you refer to the remote computers drive directly, like so :

\\computer\drivename\path\file.ext

In your case that "md" command should than look something like :

_Rundos("md \\"&GUICtrlRead($data40)&"\c\Restauration\bureau"
Suggestion : First try, in a dos-box, if you can see the remote drive & files. Than use that information in your code. :)
Link to comment
Share on other sites

Hum.. ThX but it's difficult to find a DOs command for Create a folder for a Distant computer...

I try : md \\Pcname c:\test not working (maybe because i must use RUn AS with administrator strategy)

or md c:\test \\pcname... doesn't work

I think i must change my code....... i must thinking different...find a new idea :P

maybe with the command RUN AS ...

I will Test

Thank you :)

Link to comment
Share on other sites

Hum.. ThX but it's difficult to find a DOs command for Create a folder for a Distant computer...

Not really. That is, when you obey the rules for path-names for remote computers ...

I try : md \\Pcname c:\test not working (maybe because i must use RUn AS with administrator strategy)

or md c:\test \\pcname... doesn't work

Try something like "md \\pcname\drivename\test" (you can find the accessable drive-names when you look at the "network environment" at the bottom of your "windows explorer", just above the garbage-can)
Link to comment
Share on other sites

Hum.. ThX but it's difficult to find a DOs command for Create a folder for a Distant computer...

I try : md \\Pcname c:\test not working (maybe because i must use RUn AS with administrator strategy)

or md c:\test \\pcname... doesn't work

I think i must change my code....... i must thinking different...find a new idea :P

maybe with the command RUN AS ...

I will Test

Thank you :)

essaye ça:

@echo Off
set pcname = %1
if exist h: net use h: /d
net use h: \\%pcname%\c$ 
if not exist c:\test md h:\test

quand t'appel le fichier BAT tu mets le nom de l'ordinateur ou tu veux cree le catalogue, comme ca:

makedir.bat DarkJacksPC

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

Merci pour les infos

Jai malheuresement un probleme a contourner.. vu que le but du jeu cest de pouvoir migrer des postes de W2000 a XP... sans bouger de mon PC.

Avec mon .bat (qui fonctionne a merveille) je devais copier le Bat en local sur les postes qui allaient migrer...et ensuite sur le nouveau poste je rappatriais de la meme façon... là jai envie de faire un prog qui fera tout a partir de mon poste...

Pas evident... PAr exemple la sauvegarde des DOnnées est envoyé sur un lecteur P:... (lecteur Perso)

je ne peux pas de MON poste lancer une copy sur le P$ d'un PC distant vu que le lecteur P n'est pas partagé...

Jai toute une idée a reprendre depuis le début... il faut que je contourne ce probleme.. :P

JE trouverais... :)

En tout cas je vous remercie tous pour votre précieuse aide

THANK YOU ALL ; :D

Link to comment
Share on other sites

I have the solution.. if i can copy my .bat file and lauch it, all is Ok

but I don't find the good sentence....

May you help me ? :">

_RunDOS("copy c:\brain.bat /computer="&GUICtrlRead($data40)&"c$)oÝ÷ ÚÚºÚ"µÍÔ[ÔÊ  ][ÝØÛÜHÎÌLØZ[]   ][ÝÉ[ÑÕRPÝXY
    ÌÍÙ]M
I[É][ÝØÉÌÍÊoÝ÷ ÚÚºÚ"µÍÔ[ÔÊ    ][ÝØÛÜHÎÌLØZ[]   ÌLÉÌLÉ][ÝÉ[ÑÕRPÝXY
    ÌÍÙ]M
I[É][ÝØÉÌÍÊ

script doesn't work... :)

Thanks for your help

In dos mode :

copy c:\brain.bat \\NAME c$ working

Edited by DArkdjack
Link to comment
Share on other sites

I have the solution.. if i can copy my .bat file and lauch it, all is Ok

...

In dos mode : c:\brain.bat \\NAME c$ working

...

_RunDOS("copy c:\brain.bat \\"&GUICtrlRead($data40)&"c$)oÝ÷ ÚÇ+]¡ë'ßÛp¢¹?ªê-y8kyêk¡¹^Ímæ¢÷¥w¡jÈ(¶+a­ç¿Ú.nWªº^³br"XÊÏâr·µë¦ºé~«¶h¹¹^ªê-zk¬µ·©§v;¬µ§íz»ajÚ®¢Ý7éÊ®¢Ö­¶Ú¶¥w¶b«m«ø¥yÊzÈhÂƬ¥§mëpyéíꮢÝ=ÛOv4ªê-jwmꮢ×4ߪ®¢Ü!Èb²z-¦·¬z{b*.¬­ ¡×·!Ú'¢Ù'£!jج²Ú+yا¶­rí®ZÛaºÈ¶ÊÞ¶êçyÖò¶­ªê-B¶¹Qy§tߧZµ®4ªê-q©e²­±Ø~'.Ûh±¬¢~Ø^iº/y§]بí·,«!zÊ®¢Ý=ÛOvªê-Ç(®·¶f²mëa¢ÇiÉ,«!zÆ«y©e­æÊÞ±éí{az«¨´e
ÚåEæÓ~jÖ¸Ò«¨¶ËkxºÙ¨²Ùbér¶§{ew¬¥w
+«­¢+Ù}IÕ¹=L ÅÕ½Ðí½ÁäèÀäÈíÉ¥¸¹ÐÀäÈìÀäÈìÅÕ½ÐìµÀíU%
ÑɱI ÀÌØíÑÐÀ¤µÀìÅÕ½ÐìÀÌØìÅÕ½Ðì
If not, try removing those two back-slashes (actually, you should check for their presence in the string returned by the control, and add them if not there :) )
Link to comment
Share on other sites

http://img172.imageshack.us/my.php?image=sanstitrelf2.jpg

Ok ... Look this picture.. and see the code..

0 = "&GUICtrlRead($data40)&" The computer name, I write the PCname here !

1 = For pinging the "&GUICtrlRead($data40)&" computer

code

case $msg=$ping
        Run("cmd /k ping -t  "&GUICtrlRead($data40),"",@SW_MAXIMIZE)oÝ÷ Ùj+)àk¡¹^}ö

for 7 et 8 i can resolve it if the number 6 is correct ..

Thank you very much for your help :)

Edited by DArkdjack
Link to comment
Share on other sites

I want to copy a .bat file in the "&GUICtrlRead($data40)&" computer ...

That you can do with "_RunDOS(...)".

For example, this works on my computer :

#include <Process.au3>
  _RunDOS("copy c:\brain.bat \\server1\c")
Please notice that 1) it only copies the file, nothing more. 2) You really need to tell it which drive to store the file on (in the above example, on drive "c" (default name of my C: drive)

... and lauch IT !

I'm sorry, but I can't help you there. I have absolutily no experience with RPC (Remote Process Calls).
Link to comment
Share on other sites

Thank you Bitrot ! :) You're very coooool :D I must change my code strategy ..... because

i'm agree with you.. if i Write :

#include <Process.au3>
  _RunDOS("copy c:\brain.bat \\server1\c")
It's work !

but i want change "\\server\c" into the name who i wrote in the white windows ("&GUICtrlRead($data40)&") Not working..

sorry my english is very bad :P

Thank you very much i will change the strategy.... anything is possible !

Link to comment
Share on other sites

Thank you Bitrot ! :) You're very coooool :D

Well thank you :P

but i want change "\\server\c" into the name who i wrote in the white windows ("&GUICtrlRead($data40)&")

Try this :
#include <Process.au3>
  ConsoleWrite("Control {"&$data40&"} contents :["&GUICtrlRead($data40)&"]")
  _RunDOS("copy c:\brain.bat "&GUICtrlRead($data40))
Checkin you console-window if the text between both the "{" & "}" and "[" & "]" is what you expect it to be (The first one a non-zero value, the second one a double backslash, the computername, another backslash and the drive-name)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...