Jump to content

Passing parameters using RunWait


Iraj
 Share

Recommended Posts

Hi Team,

Greetings!

 

One silly doubt, I need to pass one parameter using RunWait to write an output to a file using Cmd Line, but the below isn't writing to the file specified. Kindly assist.

$pass = $CmdLine[1]

$CMD = "C:\Progra~1\bin\Encrypt.exe" &$pass& " > C:\temp\pwd.txt"   #write the parameter $pass in C:\temp\pwd.txt
RunWait(@ComSpec & " /c " & $CMD,"",@SW_HIDE)

Thank you!!

Link to comment
Share on other sites

  • Developers

..  and probably need to use @ComSpec to be able to pipe the output?

EDIT: is there already so ignore this comment. :) 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

3 minutes ago, Gianni said:

probably a space is missing after Encrypt.exe and before the quotes and a semicolon is also missing after pwd.txt "

I already tried giving space, but no luck. The semicolon is not required at the end I suppose.

Link to comment
Share on other sites

18 minutes ago, Iraj said:

... The semicolon is not required at the end I suppose.

wrong, as it is you generate an error put a semicolon here;               ... pwd.txt " ; #write ....

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

Change and experiment with the following commands:

Global $Pass_Encrypt = $CmdLine[1]
Global $Encrypt_exe = 'C:\Progra~1\bin\Encrypt.exe'
Global $OUT_pwd_txt = 'C:\temp\pwd.txt'
FileDelete($OUT_pwd_txt)
Local $CMD = '"' & $Encrypt_exe & '" "' & $Pass_Encrypt & '" > "' & $OUT_pwd_txt & '"' ;  #write the parameter $pass in C:\temp\pwd.txt
If Not FileExists($Encrypt_exe) Then Exit ConsoleWrite('! ERROR File not Exists: ' & $Encrypt_exe & @CRLF)
RunWait(@ComSpec & ' /c ' & $CMD, "", @SW_HIDE)
If FileExists($OUT_pwd_txt) Then ConsoleWrite('- Input: ' & $Pass_Encrypt & @CRLF & '- Output: ' & FileRead($OUT_pwd_txt) & @CRLF)

 

Regards,
 

Link to comment
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
 Share

×
×
  • Create New...