SQLite User Forum

The sqlite3 CLI under Windows
Login

The sqlite3 CLI under Windows

(1) By Tim Streater (Clothears) on 2024-10-15 20:47:46 [source]

I occasionally have to use Windows and did so today. I was a bit frustrated to apparently be unable to discover, within the sqlite3.exe CLI, what directory it is operating in. One can set it using .cd, but is there a way to get it? How about a .pwd command to show it. Or perhaps add it to the output of .show.

And where does it expect to find .sqliterc?

I've got the CLI on the taskbar, so a handy way to start it is just clicking that icon, which brings it up in a PowerShell window. But the only way I could then carry on was by using absolute paths, which is a pain for a quick test.

(2) By Richard Hipp (drh) on 2024-10-15 20:54:09 in reply to 1 [link] [source]

Try this:

.system pwd

(3) By jose isaias cabrera (jicman) on 2024-10-15 20:55:32 in reply to 1 [link] [source]

And where does it expect to find .sqliterc?

The sqlite3.exe file expects the .sqliterc on the C:\Users\[username]

15:01:24.89>dir C:\Users\e608313
 Volume in drive C is Windows
 Volume Serial Number is FC51-8254

 Directory of C:\Users\e608313

10/15/2024  04:52 PM    <DIR>          .
10/15/2024  04:52 PM    <DIR>          ..
09/11/2023  09:52 AM                72 .sqliterc
08/16/2023  10:29 AM    <DIR>          3D Objects
08/16/2023  10:29 AM    <DIR>          Contacts
02/22/2024  11:15 AM    <DIR>          Desktop
10/03/2024  11:48 AM    <DIR>          Documents
10/15/2024  02:44 PM    <DIR>          Downloads
02/09/2024  11:12 AM    <DIR>          Favorites
08/16/2023  10:29 AM    <DIR>          Links
08/16/2023  10:29 AM    <DIR>          Music
08/24/2023  10:33 AM    <DIR>          OneDrive
10/27/2023  10:44 AM    <DIR>          Pictures
08/16/2023  10:29 AM    <DIR>          Saved Games
08/16/2023  10:29 AM    <DIR>          Searches
08/24/2023  01:48 PM    <DIR>          source
08/16/2023  10:29 AM    <DIR>          Videos
               1 File(s)             72 bytes
              17 Dir(s)  228,531,167,232 bytes free

Don't know the others.

(4) By RandomCoder on 2024-10-15 21:05:09 in reply to 2 [link] [source]

That won't work on a stock Windows install. You can, counterintuitively, do

.system cd

To show the current directory.

(5) By Tim Streater (Clothears) on 2024-10-15 21:10:53 in reply to 2 [link] [source]

Gives:

sqlite> .system pwd
'pwd' is not  recognized as an internal or external command,
operable program or batch file.
System command returns 1
sqlite3>

(6) By Tim Streater (Clothears) on 2024-10-15 21:25:54 in reply to 4 [link] [source]

Thanks - that works. Of course it starts inside Program Files, but I can fix that now I know where the .sqliterc file is - although I made the mistake of creating that with Notepad.

(7) By Aask (AAsk1902) on 2024-10-16 10:25:44 in reply to 1 [link] [source]

but is there a way to get it?

try

.sys chdir

.sys .system .shell are synonyms and interchangeable

I've got the CLI on the taskbar, ... was by using absolute paths,

Right click on the icon, select Properties and specify a (default) location to Start in

to find .sqliterc?

try

.shell where /R c: *.sqliterc