---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/tts/native/helpers/functions/psSingleQuotedLiteral.md
---

# Function: psSingleQuotedLiteral()

```ts
function psSingleQuotedLiteral(s: string): string;
```

Defined in: [src/batteries/tts/native/helpers.ts:44](https://github.com/NHTIO/ADK/blob/v1.20260718.0/src/src/batteries/tts/native/helpers.ts#L44)

Encode `s` as a single-quoted PowerShell string literal: wrap in single quotes and double every
internal single quote (`'` → `''`). PowerShell single-quoted literals are verbatim — no variable
interpolation, no escape sequences — so this is the only quoting rule needed.

## Parameters

| Parameter | Type     | Description                                   |
| --------- | -------- | --------------------------------------------- |
| `s`       | `string` | The string to quote. Must be a finite string. |

## Returns

`string`

The single-quoted PowerShell literal of `s`.

## Remarks

Before quoting, NUL and all C0/`Cc` control characters are stripped (and a stray NUL rejected)
so an adversarial text/voice/outPath cannot inject a control character that PowerShell or the
underlying console might interpret. This is a defensive guard, not a complete PowerShell fuzzer:
it rejects the byte values that are unsafe inside ANY string context (NUL and control codes),
and lets everything else through verbatim inside the single-quoted literal.

## Throws

when `s` is not a string or contains a NUL byte (`\0`).
