| (pipe) in batchscript or in command line

i am new here and i have a problem with adding Serial and Password to AnyDesk installation:
AnyDesk tells me I have to use:
echo licencekey | “C:\Program Files (x86)\AnyDesk\AnyDesk.exe” --register-licence
echo password | “C:\Program Files (x86)\AnyDesk\AnyDesk.exe” --set-password

So I added
Execute-Process -Path “cmd.exe” -Parameters 'echo licencekey | “C:\Program Files (x86)\AnyDesk\AnyDesk.exe” --register-licence ’ to my script.

Logfile and Installation stop at:
[Post-Installation] :: Executing [C:\WINDOWS\system32\cmd.exe echo licencekey | “C:\Program Files (x86)\AnyDesk” --register-licence]…

How can I use a pipe in a PSADT Script without creating a stop?

Best regards

You dont need to call cmd.exe
Why not just call the AnyDesk.exe?

Write-Log "Registering the AnyDesk license key."
Execute-Process -Path "C:\Program Files (x86)\AnyDesk\AnyDesk.exe" -Parameters "--register-licence licencekey"
Write-Log "Setting AnyDesk password."
Execute-Process -Path "C:\Program Files (x86)\AnyDesk\AnyDesk.exe" -Parameters "--set-password password"

Hi luki1412,

unfortunately this does not work:

[Post-Installation] :: Executing [C:\Program Files (x86)\AnyDesk\AnyDesk.exe --register-licence 9BXXXX]…
[Post-Installation] :: Execution failed with exit code [9005].

Reason: 9005 Error while reading required information from stdin.

“echo 9BXXXX” writes the key in stdin so it seams to be necessary

Best regards


Solution was:
Write-Log “Setting AnyDesk password.”
(echo [password] | cmd /c “C:\Program Files (x86)\AnyDesk\AnyDesk.exe” --set-password)

The thing is, this way you dont really have any exit code. Seems like in your case you have to provide the password as input for the process.

Maybe something like this?

Execute-Process "cmd.exe" -Parameters "/c echo [password] | `"C:\Program Files (x86)\AnyDesk\AnyDesk.exe`" --set-password" -CreateNoWindow

Hi luki1412,

best solution so far, thanks for your help:
[Post-Installation] :: Executing [C:\WINDOWS\system32\cmd.exe /c echo [password] | “C:\Program Files (x86)\AnyDesk\AnyDesk.exe” --set-password]…[
Post-Installation] :: Execution completed successfully with exit code [0].

Best regards


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.