# 🔧 Path Error Fix - PCMonitorAgent.exe

## ❌ Masalah yang Terjadi

```
C:\Windows\System32\E:\xampp\htdocs\tracker\agent-csharp\bin\PCMonitorAgent.exe
```

**Penyebab:** Path relatif tidak benar, terdapat prefix `C:\Windows\System32\`

---

## ✅ Solusi: Gunakan INSTALL_SIMPLE.bat

Script baru yang dibuat **INSTALL_SIMPLE.bat** sudah memperbaiki masalah:

1. ✅ Menggunakan absolute path (bukan relatif)
2. ✅ Verifikasi ada drive letter (E:, C:, dll)
3. ✅ Error handling lebih baik
4. ✅ Prompt manual path jika butuh

---

## 🚀 Langkah Instalasi (Fixed)

### **1. Build Agent dulu**

```bash
cd E:\xampp\htdocs\tracker\agent-csharp
dotnet restore
dotnet build -c Release
dotnet publish -c Release -f net6.0-windows -o bin
```

### **2. Jalankan INSTALL_SIMPLE.bat**

- Klik kanan pada file
- Pilih **"Run as administrator"**
- Ikuti wizard

### **3. Verifikasi**

```bash
sc query PCMonitorAgent
# harus menampilkan: STATE: 4 RUNNING
```

---

## 📝 Path yang Benar

Setelah build, file executable ada di:

```
E:\xampp\htdocs\tracker\agent-csharp\
└── bin\
    └── Release\
        └── net6.0-windows\
            └── PCMonitorAgent.exe ✅
```

**Perhatian:** Harus include drive letter `E:\` di awal!

---

## 🔍 Jika Masih Error

### **A. Verifikasi file ada:**
```bash
dir E:\xampp\htdocs\tracker\agent-csharp\bin\Release\net6.0-windows\PCMonitorAgent.exe
```

### **B. Run as Administrator:**
- Jangan double-click
- Klik kanan → **Run as administrator**

### **C. Manual instalasi (jika butuh):**
```bash
cd E:\xampp\htdocs\tracker\agent-csharp

REM Manual command
sc create PCMonitorAgent binPath= "E:\xampp\htdocs\tracker\agent-csharp\bin\Release\net6.0-windows\PCMonitorAgent.exe" start= auto

REM Start service
net start PCMonitorAgent
```

---

## 📋 Perbedaan Script

| INSTALL.bat | INSTALL_SIMPLE.bat |
|-------------|-------------------|
| Complex logic | Simple, clear logic |
| Relative path issues | Absolute path only |
| Hard to debug | Better error messages |
| ❌ Tidak recommended | ✅ **RECOMMENDED** |

---

## ✨ Gunakan INSTALL_SIMPLE.bat!

```bash
# Run as Administrator
INSTALL_SIMPLE.bat
```

---

**Updated:** 2026-03-27
