Jump to content

Recommended Posts

Posted

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!!

Posted

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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

  • Developers
Posted (edited)

..  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.
  :)

Posted
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.

Posted
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....

Posted

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,
 

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
×
×
  • Create New...