Skip to content

Query command examples ​

Inputs and outputs below were captured from the built command using synthetic settings. Colours preserve the executable's actual ANSI choices; JSON remains colour-free. These reference fixtures use example.invalid hosts and are separate from the 127.0.0.1 quick-start fixture. Placeholder fixture paths must be replaced with your local paths. No external server was contacted.

Start with the CLI quick start for a complete fixture you can create and query immediately. See the full output reference for every captured case.

list (terminal) ​

sh
winscp-js list --file <fixture-directory>\WinSCP.ini --color

Exit code: 0.

stdout ​

• Demo (Private key: C:\keys\example.ppk; Remote: /srv/example)

list (JSON) ​

sh
winscp-js list --file <fixture-directory>\WinSCP.ini --json

Exit code: 0.

stdout ​

json
[
  {
    "path": "Demo",
    "host": "files.example.invalid",
    "protocol": "ftp",
    "keyFile": "C:\\keys\\example.ppk",
    "remoteDirectory": "/srv/example"
  }
]

list (table) ​

sh
winscp-js list --file <fixture-directory>\WinSCP.ini --table --color

Exit code: 0.

stdout ​

┌──────┬───────────────────────┬──────────┬─────────────────────┬──────────────┐
│ Path │ Host                  │ Protocol │ Private key         │ Remote       │
├──────┼───────────────────────┼──────────┼─────────────────────┼──────────────┤
│ Demo │ files.example.invalid │ ftp      │ C:\keys\example.ppk │ /srv/example │
└──────┴───────────────────────┴──────────┴─────────────────────┴──────────────┘
sh
winscp-js search example --file <fixture-directory>\WinSCP.ini --color

Exit code: 0.

stdout ​

Found 1 profile

┌──────────────────┬─────────────────────────────────┐
│ Label            │ Value                           │
├──────────────────┼─────────────────────────────────┤
│ Name             │ Demo                            │
│ Path             │ Demo                            │
│ Protocol         │ ftp                             │
│ Host             │ files.example.invalid           │
│ Port             │ 21                              │
│ Username         │ deploy                          │
│ Password         │                                 │
│ Passphrase       │                                 │
│ Credential state │ not-stored                      │
│ Authentication   │ connection/password: not-stored │
│ Private key      │ C:\keys\example.ppk             │
│ Remote           │ /srv/example                    │
└──────────────────┴─────────────────────────────────┘

get (JSON) ​

sh
winscp-js get Demo --file <fixture-directory>\WinSCP.ini --json

Exit code: 0.

stdout ​

json
{
  "name": "Demo",
  "path": "Demo",
  "protocol": "ftp",
  "host": "files.example.invalid",
  "port": 21,
  "user": "deploy",
  "password": "(hidden)",
  "passphrase": "(hidden)",
  "credentialState": "not-stored",
  "credentials": [
    {
      "connectionId": "connection",
      "kind": "password",
      "state": "not-stored"
    }
  ],
  "authentication": "connection/password: not-stored",
  "keyFile": "C:\\keys\\example.ppk",
  "remoteDirectory": "/srv/example",
  "connections": [
    {
      "id": "connection",
      "endpoint": {
        "host": "files.example.invalid",
        "port": 21,
        "username": "deploy"
      },
      "authentication": [
        {
          "type": "private-key",
          "path": {
            "value": "C:\\keys\\example.ppk",
            "format": "native"
          },
          "format": "ppk"
        },
        {
          "type": "password",
          "credential": {
            "sourceId": "winscp:<fixture-directory>\\WinSCP.ini",
            "id": "[\"Demo\",\"primary\"]",
            "state": "not-stored",
            "kind": "password"
          }
        }
      ],
      "kind": "ftp",
      "protocol": "ftp",
      "tls": "none",
      "remoteDirectory": "/srv/example"
    }
  ],
  "diagnostics": [],
  "source": {
    "id": "winscp:<fixture-directory>\\WinSCP.ini",
    "application": "winscp",
    "location": "<fixture-directory>\\WinSCP.ini",
    "storage": [
      {
        "kind": "file",
        "path": "<fixture-directory>\\WinSCP.ini"
      }
    ]
  }
}

get a property ​

sh
winscp-js get Demo host --file <fixture-directory>\WinSCP.ini --json

Exit code: 0.

stdout ​

json
"files.example.invalid"

source ​

sh
winscp-js source --file <fixture-directory>\WinSCP.ini --json

Exit code: 0.

stdout ​

json
{
  "id": "winscp:<fixture-directory>\\WinSCP.ini",
  "application": "winscp",
  "location": "<fixture-directory>\\WinSCP.ini",
  "storage": [
    {
      "kind": "file",
      "path": "<fixture-directory>\\WinSCP.ini"
    }
  ]
}

sources ​

sh
winscp-js sources --file <fixture-directory>\WinSCP.ini --json

Exit code: 0.

stdout ​

json
{
  "candidates": [
    {
      "id": "winscp:<fixture-directory>\\WinSCP.ini",
      "application": "winscp",
      "location": "<fixture-directory>\\WinSCP.ini",
      "storage": [
        {
          "kind": "file",
          "path": "<fixture-directory>\\WinSCP.ini"
        }
      ]
    }
  ],
  "selectedSourceId": "winscp:<fixture-directory>\\WinSCP.ini",
  "selectedBy": "explicit",
  "diagnostics": []
}