|
|
I’m trying to run the following command string from a GUI, everything works fine but I can minimize the command prompt or run it in hidden mode.
Any way to do this?
string stfamtv0001 = "/C" + ("\"\"C:\\Program Files\\ ThinTV\\PLINK.EXE\"" + " " + "appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY= .0; vlc --video-on-top --key-vol-up 100 rtsp://stfamtv0001/streama\"\"");
private void data(string streamPath)
{
System.Diagnostics.Process ps;
ps = new System.Diagnostics.Process();
ps.EnableRaisingEvents = false;
System.Diagnostics.Process.Start("CMD.exe", streamPath);
ps.Close();
}
private void btnFOX_Click(object sender, EventArgs e)
{
data(stfamtv0001);
}
|
|
|
|
|
You can run it in silent mode.
ProcessStartInfo i = new ProcessStartInfo();
i.CreateNoWindow = true;
i.UseShellExecute = false;
i.RedirectStandardError = true;
i.FileName = "file to execute";
i.Arguments = (@"arguments");
System.Diagnostics.Process proc = Process.Start(i);
|
|
|
|
|
Can seem to get this to work, do you mind filling on the "file to execute" and the "arguments" so i have an example.
|
|
|
|
|
If command to execute in shell is "FOP.exe -XML abc.xml - pdf abc.pdf"
Then file to execute is FOP.exe and arguments are -XML abc.xml - pdf abc.pdf
|
|
|
|
|
|
No my code still is not working?
ProcessStartInfo ps = new ProcessStartInfo();
ps.CreateNoWindow = true;
ps.UseShellExecute = false;
ps.RedirectStandardError = true;
ps.FileName = "cmd.exe";
ps.Arguments = (@"/C" + "\"\"C:\\Program Files\\ThinTV\\PLINK.EXE\"" + " " + "appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY= .0; vlc --halfscreen --key-vol-up 100 rtsp://stfamtv0001/streama\"\"");
System.Diagnostics.Process proc = Process.Start(ps);
Not sure why when its put into a click event nothing happens.
|
|
|
|
|
step through the code and make a dummy string hold your Ps.Arguments property and see if it is correct as you would type it into the command prompt.
|
|
|
|
|
You need not use cmd.exe as it the command shell which would automatically get invoked.
your executable file here is /C" + "\"\"C:\\Program Files\\ThinTV\\PLINK.EXE and your arguments is appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY=.0; vlc --halfscreen --key-vol-up 100 rtsp://stfamtv0001/streama\"\""
Please arrange it accordingly.
Let me know if you still need some help.
|
|
|
|
|
Ok I broke the code down and put it into a click event as follows
ProcessStartInfo ps = new ProcessStartInfo();
ps.CreateNoWindow = true;
ps.UseShellExecute = false;
ps.RedirectStandardError = true;
ps.FileName = "/C" + "\"\"C:\\Program Files\\RBS ThinTV\\PLINK.EXE\"";
ps.Arguments = (@"appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY= .0; vlc --video-on-top --key-vol-up 100 rtsp://stfamtv0002/streama\"\"");
System.Diagnostics.Process proc = Process.Start(ps);
Not sure but now its getting a Win32Excepetion was unhanded error.... on this line System.Diagnostics.Process proc = Process.Start(ps);
The command string is perfect.... its really weird.
|
|
|
|
|
"/C" + "\"\"C:\\Program Files\\RBS ThinTV\\PLINK.EXE\""; -----here what is "/C" ?
To check the validity of the code.
USe
ps.FileName = "Notepad";
ps.Arguments = "abc.txt"
Check whether notepad opens or not and then check your code accordingly.
|
|
|
|
|
/C is a command line switch for cmd.exe.
I believe the filename string should be "C:\\Program Files\\RBS ThinTV\\PLINK.EXE"
The true man wants two things: danger and play. For that reason he wants woman, as the most dangerous plaything.
|
|
|
|
|
I guess you are correct..
|
|
|
|
|
Ok I was able to verify that this test with notepad worked great so I think the error is in my arguments. The original argument that works in a command prompt is this.
"/C" + ("\"\"C:\\Program Files\\RBS ThinTV\\PLINK.EXE\"" + " " + "appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY= .0; vlc --key-vol-up 100 rtsp://stfamtv0001/streama\"\"");
So at this point since we are not using a command prompt the "/C" is nulled which leaves us with
"\"\"C:\\Program Files\\RBS ThinTV\\PLINK.EXE\"" + " " + "appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY= .0; vlc --key-vol-up 100 rtsp://stfamtv0001/streama\"\"");
Breaking this command string down we have
ps.FileName = "C:\\Program Files\\RBS ThinTV\\PLINK.EXE";
and
ps.Arguments = (@"appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY= .0; vlc --video-on-top --key-vol-up 100 rtsp://stfamtv0002/streama\"\"");
The trick now i believe is int he syntax.
|
|
|
|
|
|
Im a network engineer for a small company, but I enjoy programing keeps my mind sharp. I dont have much expereince in programing but I sure like it.
|
|
|
|
|
cool!!..good to know about you
|
|
|
|
|
Is there anyway i can really test the syntax to make sure is all correct?
|
|
|
|
|
Also do the following
ps.FileName = "/C" + "\"\"C:\\Program Files\\RBS ThinTV\\PLINK.EXE\"";
ps.Arguments = (@"appliance@%ThinConnectedFrom%" + " " + "-pw appliance" + " " + "\"killall -q vlc; export DISPLAY=.0; vlc --video-on-top --key-vol-up 100 rtsp://stfamtv0002/streama\"\"");
System.Console.WriteLine(ps.FileName + ps.Arguments);
and see the string displayed on the console is the right command string for cmd.exe or not?
|
|
|
|
|
Hi,
I want to read an xls file and import data in dataset. This xls file is a system generated tab delimited file. Using below code I am getting "External table is not in the expected format" exception.
If I open the same file in excel and save it in correct excel format this piece of code works fine.
public static void ReadExcelFileData()
{
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Test.xls;Extended
Properties='Excel 8.0;HDR=Yes;IMEX=1;FMT=TabDelimiter'";
// Establish Connection
_connExcel = new OleDbConnection(connectionString);
_cmdExcel = new OleDbCommand();
_cmdExcel.Connection = _connExcel;
try
{
//Accessing Excel Sheet
_connExcel.Open();
//Code to read excel file
}
catch (Exception ex)
{
throw ex;
}
}
}
}
}
I tried to modify the connectionstring as given below,But it also gave me "c:\Test.xls is not a valid path" error
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\Test.xls;Extended
Properties='text;HDR=Yes;IMEX=1;FMT=TabDelimiter'";
If anybody had faced such problem earlier, Please let me know the solution implemented by you.
Thanks & Regards,
Deepak
|
|
|
|
|
There is no such thing as a "tab delimitted XLS" file. A true XLS file is a binary format only natively readable by Excel, which your code will not work on. But, since you've said that you can open the file in Excel and export the data as a tab delimitted CSV file and your code suddenly work on that, leads me to believe that your initial file is not what you think it is.
|
|
|
|
|
As the previous poster stated, it looks like you're trying to import an excel file, rather than a tab delimited file (Excel workbooks have an '.xls' suffix whereas tab delimited are '.txt' by default). You can still open the workbook in the way you've started but you need to change the connection string. Have a look here[^] for details of what value to use.
HTH
ETA: you might need this one[^] instead depending on what version of Excel you're using.
It definitely isn't definatley
|
|
|
|
|
Hi
I am trying to transfer a data securely over HTTP and my page that I am recieving the secure data from is written in PHP.
I need a secure encryption method to encrypt the data that I am sending. It better needs a key to encrypt and decrypt and it should be secure (Rijandel would be nice )
Thanks.
|
|
|
|
|
HTTPS would be the best way.
However, Google suggests that PHP does support various crypto fucntions so pick one that is also available in .NET.
|
|
|
|
|
Thank you for your answer.
I have searched a little about it on Google and I have read some articles that I've came across.
But none of them give me enough information about how secure is that encryption method is and wheather it exists both on C# and PHP.
I need an encryption method which decryptable only with a secret key and exists on both C# and PHP.
|
|
|
|