Jump to content
TanjimReza

Combining string and varibale to run in CMD

Recommended Posts

Hello, it's me struggling again. Here's what I want to do: 

I have a textbox named, I want to get the text that user inputed into that box and combine it with a string to run in CMD. 

I'm getting the text using 

$code = GUICtrlRead($Name_of_my_Variable)

Now I want to run in CMD something like 

Quote

slmgr /ipk $code

 

My expected output is

2032171791_Screenshot(11).png.c1747f777f2a850e7c08b4a28f4a1d29.png

Share this post


Link to post
Share on other sites

Read the help file, it tells you how to do it.  It truly helps reading it ;)

run (@ComSpec & ' /c slmgr /ipk ' & $code, "", @SW_HIDE, $STDERR_MERGED)

Merry xmas...

Share this post


Link to post
Share on other sites
39 minutes ago, Nine said:

Read the help file, it tells you how to do it.  It truly helps reading it ;)

run (@ComSpec & ' /c slmgr /ipk ' & $code, "", @SW_HIDE, $STDERR_MERGED)

Merry xmas...

Merry xmas, you guys are great!

Edited by TanjimReza

Share this post


Link to post
Share on other sites

Even though I'm using the right code (as I know) the command window still shows. 

Run(@ScriptDir & "\batchFile.cmd","", @SW_HIDE, $STDERR_MERGED)

Is there anything I'm missing? Tried to do the same with ShellExecute. Tried Searching in Documentation. 
 

Edited by TanjimReza

Share this post


Link to post
Share on other sites
2 minutes ago, Nine said:

Depends what inside this batch file...

There's echo usage, but even if I remove all 'echo' still DOS window appears. Can't figure what to do. 

Share this post


Link to post
Share on other sites

I tried with multiple echo messages and it doesn't show for me. I also can read the messages :

#include <Constants.au3>

Opt ("MustDeclareVars", 1)

Local $pid = Run(@ScriptDir & "\batchFile.cmd","", @SW_HIDE, $STDERR_MERGED)
ProcessWaitClose ($pid)
MsgBox ($MB_SYSTEMMODAL,"",StdoutRead ($pid))

 

Share this post


Link to post
Share on other sites
3 hours ago, Nine said:

I tried with multiple echo messages and it doesn't show for me. I also can read the messages :

#include <Constants.au3>

Opt ("MustDeclareVars", 1)

Local $pid = Run(@ScriptDir & "\batchFile.cmd","", @SW_HIDE, $STDERR_MERGED)
ProcessWaitClose ($pid)
MsgBox ($MB_SYSTEMMODAL,"",StdoutRead ($pid))

 

Don't know why this isn't working for me

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...