# C Sharp

### Compiling and Running Code

1. Save the following code in file 'cmdexe.cs'. The FileName and Arguments makes the program run with it's process hidden in background:

```csharp
class Cmdexec {
        static void Main(){
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                startInfo.FileName = "cmd.exe";
                startInfo.Arguments = " /c echo 'fire' > C:\\Users\\<username>\\Desktop\\cs-file";
                process.StartInfo = startInfo;
                process.Start();
        }
}
```

2\. Compile the code to an executable format (.exe):

> C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe .\cmdexe.cs


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ressurect.gitbook.io/notes/cheatsheet/c-sharp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
