There are MULTIPLE threads here asking how to change an icon - and nearly all of them say to use a command line tool such as ResHacker - but none of them (that I have seen) explain how to do so. I read into ResHacker's help file, and I found some text which explained how to go about changing the icon of a win32 executable file.
I tried the below code, and it gave me the following error:
Code:
p.StartInfo.Arguments = "-addoverwrite " + txtProtect.Text + "," + txtProtect.Text + "," + sICOpath + "," + "ICONGROUP" + ", MAINICON, 0";
Error:
"C:\Users\Evan\Desktop\ResHacker.exe" -addoverwrite C:\Users\Evan\Desktop\output.exe,C:\Users\FARINA_EVAN\Desktop\output.exe,C:\Users\Evan\Desktop\ExeWithIcon.exe,ICONGROUP, MAINICON, 0
Error: Invalid resource type.
I realize that this is a bit... Old, but the reason this won't work is because you're trying to get the icon FROM a .exe, which doesn't work with the command line of ResHacker.
The only thing I can think of is to Extract the icon from the .exe and save it as a .ico.
Then you can do the "push."
I wasn't able to find anything on how to programmatically run ResHacker except through manipulating the command line through C# like you are attempting to do. However, to speak to the root of your question, I found a possible solution for you here that does not require ResHacker. Instead, it allows you to modify the icon through code (C# and VB.NET). Here is the link:
http://www.hackforums.net/archive/index.php/thread-422072-1.html
Related
I have the follwoing c# code:
string cmdInnoSetup = #"""C:\Program Files (x86)\Inno Setup 5\compil32\""" + " /cc " + #"""c:\\SetupScript.iss""";
System.Diagnostics.Process.Start("cmd.exe","/k "+ cmdInnoSetup);
But when I execute it I got the following message:
"Program not found"
But when I remove double quotation from second part sentence "c:\\SetupScript.iss" then the code works fine!
Now how can I solve this illogical problem in order to keep both of paths inside double quotation !
How to let code work by setting double quotation for source and destination as well!
You can try using the string written like this:
"\"C:\\Program Files (x86)\\Inno Setup 5\\compil32\\\"" + " /cc \"c:\\SetupScript.iss\"";
Try this two lines, I tried it and it works:
string cmdInnoSetup = #"""C:\Program Files (x86)\Inno Setup 5\compil32.exe"" /cc 'c:\SetupScript.iss'";
System.Diagnostics.Process.Start("cmd.exe", "/k " + cmdInnoSetup);
You could try calling your program differently. Such as:
System.Diagnostics.Process.Start(#"C:\Program Files (x86)\Inno Setup 5\compil32.exe", #"/cc ""c:\SetupScript.iss""");
Unless you really need the cmd to perform the output it should do basically the same.
(I didn't try it with InnoSetup myself but with another program)
So, I'm fairly certain this is a relatively remedial question with a likely simple solution, but I just can't seem to find it. I've currently got a program that writes the variables it sets to the console on execution, as well as writing them to the logfile when called through Autosys.
Console.WriteLine(DateTime.Now.ToString("hh:mm:ss.fff") + " Output Variable: " + variable1);
Console.WriteLine(DateTime.Now.ToString("hh:mm:ss.fff") + " Output Variable: " + variable2);
Console.WriteLine(DateTime.Now.ToString("hh:mm:ss.fff") + " Output Variable: " + variable3);
Simple stuff. But for some reason, when I call this...
Console.WriteLine(DateTime.Now.ToString("hh:mm:ss.fff") + " Endpoint: " + endpointAddress);
after previously setting
endpointAddress = "https://endpointaddress.com";
for debug
or
string endpointAddress = Environment.GetEnvironmentVariable("ENDPOINT");
for the Autosys call, with ENDPOINT set in the jobvars file to
JV_ENDPOINT https://endpointaddress.com
and JV_ENDPOINT set in the cmd file to
SET ENDPOINT=%JV_ENDPOINT%
with the end result of it pretty much being exactly the same as it is when the program is run through Visual Studio or the executable itself,
Console.WriteLine(DateTime.Now.ToString("hh:mm:ss.fff") + " Endpoint: " + endpointAddress);
is just skipped entirely in the log. The other ten or so WriteLines that are called all work fine, but nothing at all is written in that line's place.
A few lines up in the log file, I get
D:\server_apps\PROCESS_FOLDER>SET ENDPOINT=https://endpointaddress.com
showing that the endpoint is properly set, but not calling it later.
And...this just in...the most recent time I have run it, the endpoint line just WAS put into the log file. Huh. Well, let's adjust this question a bit. Would anyone happen to have any idea why this particular line might be so uniquely temperamental? I haven't changed anything significant in more than an hour, so I can't fathom why it would suddenly work. But any insight into why it may have happened (and why it might not again) could go a long way toward working any bugs or kinks out of this. Hopefully.
As always, thanks for your time!
I'm trying to run a remote batch file - already located on the remote machine - using PsExec, called via Process in C#. I've confirmed that all required files already exist, but believe I may have a problem with my syntax, as the redirected output indicates that it can't find the file specified.
The machine against which PsExec runs is dynamic, which is the myArray[0].MachineName value (this pulls in without issue).
wsStopProcess.StartInfo.FileName = #"C:\Windows\system32\PsExec.exe";
wsStopProcess.StartInfo.Arguments = #" \\" + myArray[0].MachineName + #"D:\stopprofile.bat";
wsStopProcess.StartInfo.UseShellExecute = false;
wsStopProcess.StartInfo.CreateNoWindow = true;
wsStopProcess.StartInfo.RedirectStandardOutput = true;
wsStopProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
wsStopProcess.Start();
Any ideas on what appears to be formatted incorrectly? I'm guessing it's too many backslashes (or not enough!) somewhere.
I think the main problem is you do not have a space between the two arguments.
Try this:
wsStopProcess.StartInfo.Arguments = #"\\" + myArray[0].MachineName + #" D:\stopprofile.bat";
I would also warn you that I could not get psexec to work 100%, despite trying many different things.
Try this:
wsStopProcess.StartInfo.Arguments = #"\\" + myArray[0].MachineName + #" D$\stopprofile.bat";
So instead of using : try $ sign. Also setting breakpoint on the above line while debugging will help you to see the exact path.
I've been struggling with GStreamer for a while because I can't find any C# examples/tutorials.
As far as I know, Gstreamer uses pipelines in order to decode and then be able to send, for instance a song, to the speakers, but I tried the following, which didn't work:
Gst.Element pipeline;
string path = #"some_path.mp3";
string command = "filesrc location=" + path + " ! oggdemux ! vorbisdec ! audioconvert ! gconfaudiosink";
pipeline = Gst.Parse.Launch(command);
pipeline.SetState(Gst.State.Playing);
However, it raises an exception in the Gst.Parse.Launch line
Does anyone know any good application example, and/or can actually post some code, so I can start getting used to the library? Also, if you can tell me what's wrong on the code above, I'd be thankful
Without further ado,
Regards
Just change your command string to "filesrc location=" + path + " ! decodebin2 ! gconfaudiosink", that should work.
On a side note you should use the gst-launch tool on the command line to check if your pipeline is working and to debug it. Also use gst-inspect to find which plugins are available on your system and what is their functionality.
Given code was a part of the code used to run a jar file on c# environment. Complete Code
strArguments = " -jar "+ Argument list;
processJar.StartInfo.FileName = "\"" + #"java" + "\"";
processJar.StartInfo.Arguments = strArguments;
processJar.StartInfo.WorkingDirectory =; \\Give the working directory of the application;
processJar.StartInfo.UseShellExecute = false;
processJar.StartInfo.RedirectStandardOutput = true;
I know that processJar.StartInfo.FileName should contain the jave.exe so that the respective file will be triggered when the process gets started. But the above given code also runs successfully.
Question:
What does "\"" + #"java" + "\"" here? If I provide such input will the system itself will search java.exe?
They simply ensure that the string will be "java" (with the quotes).
This is normally needed when you have a path that contains spaces.
Windows requires the path to be quoted if it contains spaces (for example "C:\Program Files").
As for finding the executable - if the path to the java executable is in the %PATH% environment variable, it will be found.
In this case they seem superfluous.
its the exe name which needs to be launched