Answering a little more than asked, I will point out some options you have when using the file autorun.inf:
Main attributes
action=texto
optional: auto-run item text, both in the context menu, and in the media auto-run window.
icon=caminho
path of the icon to be used to represent the media
It is possible to reference an icon inside an icon pacode, executable or dll by placing a comma + the index of the icon inside the file:
app\ConsoleApplication.exe,0
label=texto
Media title that appears in Explorer
open=caminho
path to automatic execution
Attributes for adding items to the context menu
shell=nome_comando_primario
indicates which is the primary menu, which appears in bold in the context menu, and will be used in double-click
shell\nome_comando=texto
represents the title of the command name_menu option... there may be several titles for commandname_`s:
shell\comandoA=Título comando A
shell\comandoB=Título comando B
shell\nome_comando\command=caminho
path of the executable that must be triggered by clicking on the specific command. There must be one for each specified command title:
shell\comandoA\command=app\ConsoleApplication.exe
shell\comandoB\command=notepad.exe arquivos/leiame.txt
Map of parts of the Autorun.inf archive
Below is a map showing where the texts placed in the Autorun.inf file should appear, as well as the relationship between the properties. I used colors to indicate the related elements in various parts.
Full example
[autorun]
action=Executar ConsoleApplication.exe (action)
open=app\ConsoleApplication.exe %0
icon=app\ConsoleApplication.exe,0
label=Título do CD (label)
shell=iniciar
shell\iniciar=Lançar a aplicação (shell\iniciar)
shell\iniciar\command=app\ConsoleApplication.exe %0
shell\leiame=&Ler o aqruivo leiame.txt (shell\leiame)
shell\leiame\command=notepad.exe arquivos/leiame.txt
Applying
using System;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(string.Join(" ", args));
Console.WriteLine("Olá mundo!");
Console.ReadKey();
}
}
}
Adding an icon to your application
Go to the properties of your executable project, in the Application tab, then just select an icon file:
Reference
Autorun.inf Entries (MSDN)
http://en.wikipedia.org/wiki/Autorun.inf
That way
\programa\programa\bin\Debug\programa.exe
is inside the CD?– bfavaretto
@bfavaretto, yes.
– ptkato
already tried: open=program bin Debug program program.exe ?
– alacerda
@winged, already, but gave problem, said that windows cannot open this type of file.
– ptkato
@Patrick made sure to use the relative path?
– alacerda
Ah, I got it, I was putting a bar before the road...
\programa\programa\bin\Debug\programa.exe
– ptkato
@Patrick consider adding an answer to your question.
– Guilherme Bernal
Note that current versions of Windows only respect Auto Run for optical media. Autorun in HD or USB stick will be solemnly ignored.
– Havenard