Jump to content

Problems with Dos commands


Guest Guest_TimBs
 Share

Recommended Posts

Guest Guest_TimBs

Hi,

I'm trying to display results from a Doc command to a window eg Net View. I'm using the following code which I found on your site

Run(@comspec,"")

winwait(@comspec)

controlsend(@comspec,"","","Net view{enter}")

sleep(1000)

controlsend(@comspec,"","","!{space}es{enter}") --- not sure what this is doing

winclose(@comspec)

msgbox(1,"Info",clipget())

Problem are:

1. I want to hide the Dos window but don't seem to be able to get a result if I use @SW_HIDE in the first line

ie Run(@comspec,"",@SW_HIDE)

2. This code works on a Win 2000 box but not NT

Can anyone help please

Link to comment
Share on other sites

;Stock standard AU3
    $sResultsFile = "C:\results.txt"
    RunWait(@comspec & " /c net view >" & $sResultsFile,"",@SW_HIDE)   
    $sResults = FileRead($sResultsFile, FileGetSize($sResultsFile))
    
    Msgbox(4096 + 48,"net view >" & $sResultsFile,$sResults)

;Alternative using CB
    RunWait(@comspec & " /c net view|cb","",@SW_HIDE)   
    $sResults = ClipGet()
    
    Msgbox(4096 + 48,"net view|cb",$sResults)
   
EXIT

For CB.EXE add-on utility, see here in the Scripts And Scraps Forum

HTH :D

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...