Sign in to follow this  
Followers 0
Guest Guest_TimBs

Problems with Dos commands

3 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Hi, Thanks for that --- it's brilliant, just what I wanted

Share this post


Link to post
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
Sign in to follow this  
Followers 0