Click here to Skip to main content
15,126,367 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

Is it a way to run a C# app on WindowsIOT Raspberry from Win7 computer and
give this app a parameter to start.
And when the app closed, to give back a true parameter or false ?

thanks for you help
Best regards
gic


What I have tried:

I have try with a batch but no success
Posted
Updated 19-Jun-18 23:25pm
Comments
lmoelleb 20-Jun-18 4:24am
   
This sounds like an x-y problem. You want to achieve something (x). You think you can do it in a certain way (y). You do not know how to do (y), so you ask here. Maybe you should simply ask how to do (x) instead?
Typically you will run the app constantly and have it listening for commands somehow (REST service, message queue, USB,...) and respond to it. You would not start and stop it. And as an alternative to Windows IOT, you can consider using .NET Core on a standard Linux distro - this allows you to run all the standard Raspberry PI programs and services next to your C# code - but does not allow a UI - so again, more information about the actual problem is needed to recommend anything.

1 solution

You have to deploy the application to your RaspBerry Pi first (see Deploying an App with Visual Studio - Windows IoT | Microsoft Docs[^]).

To start the application remotely, you have to remotely login on the Pi using a method that allows executing commands like with SSH.

With Windows, you can use the plink command line tool which is part of Download PuTTY - a free SSH and telnet client for Windows[^] (untested):
plink -ssh -pw <passwd> <user>@<pi_ip_addr> "<path_to_app_on_pi> <parameters>" > log.txt
That will also write the console output of the application to the file log.txt.

To implement error checking for plink, put the above command in a batch file and access %errorlevel%.

To get the return value of the application you have to print that out on the Pi so that it is appended to log.txt. To do this put the application execution and echoing of the return code into a script on the Pi and execute that via plink.
   
Comments
Member 13134669 29-Jun-18 9:29am
   
hello,

thanks for your answer.
I have try this line on a windows 7 but no success :

plink -ssh -pw password Administrator@192.168.0.8 \\192.168.0.8\c$\Data\USERS\DefaultAccount\AppData\Local\DevelopmentFiles\2b62372c-2763-4ce2-b3aa-bbe131828effVS.Debug_ARM.gic\UWPInkCanvasSaveJpg.exe

I try this in a batch :
start C:\"Program Files"\PuTTY\putty.exe Administrator@192.168.0.8 -pw password

and that start putty on my raspberry. I can see folders on raspberry but how to start my APP on it ???

Some ideas ?
thanks for your help
Jochen Arndt 29-Jun-18 17:21pm
   
You can't start an EXE on the Pi. You have to start an excetubale build for the Pi, stored there (and marked as exetubale), using an SHH account allowed for login on the Pi (usually the default account; user name pi, password raspberry) and allowed to execute that application.

I suggest to use Putty for remote login on the Pi from your Windows system. Once you know how to start an executable from that shell, you can use plink to automate execution.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900