Sign in to follow this  
Followers 0
ghetek

something with syntax?

5 posts in this topic

im going crazy here, why wont the following line work?

RunWait (@ComSpec & " /c " & '"' & @ScriptDir & '\devcon.exe"' & " find * > " & '"' & @ScriptDir & "\send.txt" & '"',@WindowsDir,@SW_HIDE)

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by greenmachine

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by c0deWorm

My UDFs: ExitCodes

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This code here works

Run("cmd")
WinWaitActive("C:\WINDOWS\system32\")
Send('"' & @ScriptDir & '\devcon.exe"' & " find * > " & '"' & @ScriptDir & "\send.txt" & '"')
Send("{Enter}")
Edited by big_daddy

Share this post


Link to post
Share on other sites

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.

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