Puedes usar: "USB\\VID_04F2&PID_B2E1&MI_00\\6&9F7977C&0&1200" .replaceAll("\\\\","\\\\\\\\"); Ejemplo: String b = "USB\\VID_04F2&PID_B2E1&MI_00\\6&9F7977C&0&1200"; System.out.println(b); System.out.println(b.replaceAll("\\\\","\\\\\\\\")); Salida: USB\VID_04F2&PID_B2E1&MI_00\6&9F7977C&0&1200 USB\\VID_04F2&PID_B2E1&MI_00\\6&9F7977C&0&1200