Reputation: 519
How can I change drive letter while in IPython under windows? For example, !cd W: does not make W: the current path, it just changes the path if you would change to drive W. Changing to a dos shell with !cmd and then changing to W: does not have any effect to the IPython shell.
Upvotes: 4
Views: 4211
Reputation: 180
I have a Win 10 machine with Anaconda 2020.11 python installed, out of the box no updates. ipython 7.19.0. The only way I can cd to somewhere on another drive letter is
cd d:/
No other permutation works: cd d:, cd d:, cd d:\, cd 'd:', cd 'd:', etc.
So there's an answer but it's quite annoying to figure out.
Upvotes: 1
Reputation: 2541
From the cd ?
command:
Note that !cd doesn't work for this purpose because the shell where !command runs is immediately discarded after executing 'command'.
So, just use the cd
, and make sure to quote path so the colon after the drive letter isn't misinterpreted.
cd 'W:'
Upvotes: 5