Jump to content

Recommended Posts

Posted (edited)

I want to run cmd.exe and do some works. I used this code:

While 1
$m=GUIgetmsg()
select
case $m=$UF
Run("C:\WINDOWS\system32\cmd.exe" )
Send(" dir c:\*.* /s/b/a-d > Filesc.doc {ENTER}")
Send(" dir d: \*.* /s/b/a-d > Filesd.doc {ENTER}")
MsgBox(4096, "Information", "Update successfull")
ProcessClose("cmd.exe")
Endselect
Wend

But it repeats twice, two cmd windows and two message boxes appeared! :)

Who can help me?

Edited by billgatetlhai
Posted

is $UF being called more than ONCE

  • Moderators
Posted (edited)

No. I only called $UF in that code.

You say No, but something you are doing is definately pressing it twice (might even be that Send() command), if you're getting two message boxes.

To see, comment out the two send commands and see how many times you get it, and keep debugging that way until you find the culprit.

Edit:

Instead of your Run() + send commands... why not something like:

RunWait(@ComSpec & " /c dir " & "C:\*.* /s /b /a-d > Files.doc", "", @SW_HIDE)
RunWait(@ComSpec & " /c dir " & "D:\*.* /s /b /a-d > Files.doc", "", @SW_HIDE)
?

Edit2:

Just curious, why in the world you'd want to list every file on each drive?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
  • Recently Browsing   0 members

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