I need little help on creating shortcut for my C# app. I want programmatically do this.
I intend to create a shortcut in startup menu folder. Maybe you could also show me how to start my app automatically using a registry entry. Thanks!
Thanks for reply LizR.
Of course I googled that, and I had a little problem I'll tell you now. I made a reference to "Windows Script Host Object Model", then I included IWshRuntimeLibrary and I made a button for testing, so that when I click it, process for creating the shortcut starts, like this:
private WshShellClass WshShell;
private void button3_Click(object sender, EventArgs e)
// Create a new instance of WshShellClass
WshShell = new WshShellClass();
// Create the shortcut
// Choose the path for the shortcut
MyShortcut = (IWshRuntimeLibrary.IWshShortcut)WshShell.CreateShortcut(@"C:\Documents and Settings\All Users\Desktop\cLchecker.lnk");
// Where the shortcut should point to
MyShortcut.TargetPath = Application.ExecutablePath;
// Description for the shortcut
MyShortcut.Description = "Launch cLchecker";
// Location for the shortcut's icon
MyShortcut.IconLocation = Application.StartupPath + @"\cLchecker.ico";
// Create the shortcut at the given path
The problem is that I use File.AppendAllText() method to write to file and I got this error:
" 'File' is an ambiguous reference between 'System.IO.File' and 'IWshRuntimeLibrary.File' ".
It seems to be a little conflict. So, don't worry, I don't wanna lose your time with nothing; I told you now the main problem in my program. And sorry for not pointing to the exact problem. I'll go now; in 7 hours I'm back.
what you have to do is remove "using System.IO;" from the top of your class, and everytime you need to use System.IO.File you will have to type the full namespace. problem is that when you import the namespace for the object that creates your shortcut you share its namespace scope with the "File" namespace scope of the System.IO, so removing the using block at the top of your class fixes the problem.
**how to solve invalid keystore error in android studio here is error report----------------------->
here is error report--------> error:Error:java.lang.RuntimeException: com.android.ide.common.signing.KeytoolException: Failed to read key palash from store "D:\MyApplication3.idea\workspace.xml": Invalid keystore format ...