ghetek Posted January 3, 2006 Posted January 3, 2006 im going crazy here, why wont the following line work? RunWait (@ComSpec & " /c " & '"' & @ScriptDir & '\devcon.exe"' & " find * > " & '"' & @ScriptDir & "\send.txt" & '"',@WindowsDir,@SW_HIDE)
greenmachine Posted January 3, 2006 Posted January 3, 2006 (edited) Try this and see what the cmd prompt says (if it has any errors of its own): Use Run instead of RunWait, use /k instead of /c (keep the cmd window open), and change @SW_HIDE to @SW_SHOW. [ EDIT ] Another good idea would be to break it down into a few lines, because that is definitely confusing as is. $DevconExe = @ScriptDir & "\devcon.exe" $SendTxt = @ScriptDir & "\send.txt" ... [ /EDIT ] Edited January 3, 2006 by greenmachine
Gigglestick Posted January 3, 2006 Posted January 3, 2006 (edited) For one, it's easier to read if you use the same quote type for all text. Use only single OR double quotes. Also, there's no need to close the quote just to append a quote, as in "some text " & '"' & @something. Just use 'some text "' & @something. Next, is "find *" supposed to be a parameter for devcon.exe or do you mean to pipe devcon.exe's output to the find command, as in: RunWait (@ComSpec & ' /c "' & @ScriptDir & '\devcon.exe" | find * > "' & @ScriptDir & '\send.txt"',@WindowsDir,@SW_HIDE) *EDIT* Typo Edited January 3, 2006 by c0deWorm My UDFs: ExitCodes
Moderators big_daddy Posted January 3, 2006 Moderators Posted January 3, 2006 (edited) This code here works Run("cmd") WinWaitActive("C:\WINDOWS\system32\") Send('"' & @ScriptDir & '\devcon.exe"' & " find * > " & '"' & @ScriptDir & "\send.txt" & '"') Send("{Enter}") Edited January 3, 2006 by big_daddy
greenmachine Posted January 4, 2006 Posted January 4, 2006 This code here works Run("cmd") WinWaitActive("C:\WINDOWS\system32\") Send('"' & @ScriptDir & '\devcon.exe"' & " find * > " & '"' & @ScriptDir & "\send.txt" & '"') Send("{Enter}") If I used that code, it wouldn't work for me. No window called "C:\WINDOWS\system32\" ever shows up for me when I open the command prompt. Mine's just called "Command Prompt". I would use ProcessWait("cmd.exe") instead of WinWaitActive("C:\WINDOWS\system32\"), just in case the title is different.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now