<p>As Andrew Chow suggested, the solution was simply putting quotes around the directory path. Windows SMH. Thank you.</p>

CC BY-SA 4.0
2021-01-19T21:28:22.987Z
2021-01-19T21:28:22.987Z
McQuestion
<p>I moved my blockchain directory, including <code>bitcoin.conf</code>, to an external drive <code>D:\Bitcoin</code>. Bitcoin Core starts and runs normally using this path, however when I try to use the command line interface, even when I specify the new directory, I keep running into this error.</p>
<pre><code>C:\Program Files\Bitcoin\daemon&gt;bitcoin-cli -datadir=D:\Bitcoin -getinfo 

   error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is  not set. See -rpcpassword and -stdinrpcpass.
</code></pre>
<p>I know that the issue is that <code>bitcoin-cli</code> is still looking in the default directory <code>C:\Users\&lt;username&gt;\AppData\Roaming\Bitcoin</code> because when I copy the auth <code>.cookie</code> and <code>bitcoin.conf</code> files to to old directory my commands work.</p>
<p>Wondering if the <code>-datadir</code> flag is not working properly, if I made an error somewhere, or if there is another way to fix this? I have also tried using the <code>-conf=D:\Bitcoin\bitcoin.conf</code> flag, however that does not fix either.</p>
<p>Windows 10</p>

CC BY-SA 4.0
2021-01-19T05:30:51.743Z
Have you tried putting quotes around the datadir, e.g. `-datadir="D:\Bitcoin"`?
Ava Chow
<bitcoin-core><bitcoin-cli>
Problem with bitcoin-cli -datadir flag
McQuestion
# Problem with bitcoin-cli -datadir flag

(Asked by: username_0 on 2021-01-19)

I moved my blockchain directory, including `bitcoin.conf`, to an external drive `D:\Bitcoin`. Bitcoin Core starts and runs normally using this path, however when I try to use the command line interface, even when I specify the new directory, I keep running into this error.

```
C:\Program Files\Bitcoin\daemon>bitcoin-cli -datadir=D:\Bitcoin -getinfo 

   error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is  not set. See -rpcpassword and -stdinrpcpass.

```

I know that the issue is that `bitcoin-cli` is still looking in the default directory `C:\Users\<username>\AppData\Roaming\Bitcoin` because when I copy the auth `.cookie` and `bitcoin.conf` files to to old directory my commands work.

Wondering if the `-datadir` flag is not working properly, if I made an error somewhere, or if there is another way to fix this? I have also tried using the `-conf=D:\Bitcoin\bitcoin.conf` flag, however that does not fix either.

Windows 10

**Tags:** bitcoin-core, bitcoin-cli

> **Comments:**
> **username_1**: Have you tried putting quotes around the datadir, e.g. `-datadir="D:\Bitcoin"`?  

---

## 1 answers

### Answer by username_0 on 2021-01-19. Score: 1

As Andrew username_1 suggested, the solution was simply putting quotes around the directory path. Windows SMH. Thank you.


---

