<p>When I open cmd on my laptop it is defaulting to the F: drive.  This is troubling me does anyone know how it got that way or how to get it back to where it opens to the C: drive by default?</p>

[{'answer_id': 44264, 'author': 'DrFloyd5', 'author_id': 1736623, 'author_profile': 'https://Stackoverflow.com/users/1736623', 'pm_score': 1, 'selected': False, 'text': '<p>quick answer: cmd /k c:</p>\n\n<p>long answer to make it "automagical":\n<a href="http://windowsxp.mvps.org/autoruncmd.htm" rel="nofollow noreferrer">http://windowsxp.mvps.org/autoruncmd.htm</a></p>\n'}, {'answer_id': 44266, 'author': 'ceejayoz', 'author_id': 1902010, 'author_profile': 'https://Stackoverflow.com/users/1902010', 'pm_score': 2, 'selected': False, 'text': '<p><a href="http://blog.stevienova.com/2007/04/08/change-your-default-cmd-prompt-path/" rel="nofollow noreferrer">http://blog.stevienova.com/2007/04/08/change-your-default-cmd-prompt-path/</a></p>\n\n<blockquote>\n  <p>Sometimes, your path when you go to start->run, CMD will be something\n  you don’t want. In active directory or on an NT domain, sometimes your\n  default home path might be a network drive. This isn’t so good when\n  you are offline or drop offline after being online. The CMD prompt is\n  set to a place where you can’t get to.</p>\n  \n  <p>To change the path, you can edit the registry (at your own risk)</p>\n  \n  <p>Windows Registry Editor Version 5.00</p>\n  \n  <p>[HKEY_CURRENT_USERSoftwareMicrosoftCommand Processor] “Autorun”=”c:”</p>\n  \n  <p>This will change the path to your c: drive.</p>\n</blockquote>\n'}, {'answer_id': 44268, 'author': 'OwenP', 'author_id': 2547, 'author_profile': 'https://Stackoverflow.com/users/2547', 'pm_score': 3, 'selected': True, 'text': '<p>I believe it defaults to <code>%HOMEDRIVE%\\%HOMEPATH%</code> so if you can muck about with those environment variables that might be an option.  I can\'t edit these environment variables on my company\'s network, so I had to use the <a href="http://technet.microsoft.com/en-us/library/cc756720.aspx" rel="nofollow noreferrer">AutoRun</a> to change it to something sane.</p>\n'}, {'answer_id': 44269, 'author': 'EBGreen', 'author_id': 1358, 'author_profile': 'https://Stackoverflow.com/users/1358', 'pm_score': 0, 'selected': False, 'text': '<p>If you are opening it from a shortcut change the working dir for the shortcut.</p>\n'}, {'answer_id': 44278, 'author': 'Neil Neyman', 'author_id': 3240, 'author_profile': 'https://Stackoverflow.com/users/3240', 'pm_score': 0, 'selected': False, 'text': '<p>In addition to the other answers, there\'s a nice powertoy for XP called "open command window here."  It adds an option to your right-click context menu when you click inside a folder to open a command window using that directory as the starting path.</p>\n\n<p><a href="http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx" rel="nofollow noreferrer">http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx</a></p>\n'}, {'answer_id': 88631, 'author': 'tsellon', 'author_id': 3575, 'author_profile': 'https://Stackoverflow.com/users/3575', 'pm_score': 0, 'selected': False, 'text': '<p>I ran into a similar issue where cmd would always open up in a particular directory (annoying when running scripts which invoke cmd).  The best way to deal with this is to edit your autorun settings.  Raymond Chen has a nice article about this here:\n<a href="http://blogs.msdn.com/oldnewthing/archive/2007/11/21/6447771.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/oldnewthing/archive/2007/11/21/6447771.aspx</a></p>\n\n<p>The summary is that when you start a command shell, it checks the autorun registry key, and executes the commands stored there.  The registry keys it checks are:</p>\n\n<pre><code>HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Command Processor\\AutoRun\n    and/or\nHKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\AutoRun\n</code></pre>\n'}, {'answer_id': 7450009, 'author': 'Dan Haynes', 'author_id': 880942, 'author_profile': 'https://Stackoverflow.com/users/880942', 'pm_score': 2, 'selected': False, 'text': '<p>Very minor nit: if you\'re using Windows 7 you don\'t need the cmdhere powertoy, it\'s built in to Explorer.</p>\n\n<p>You just navigate to a directory in Windows Explorer then hold down the shift key and right click. "Open command window here" is one of the selections on the context menu.</p>\n\n<p>When it comes to opening cmd.exe in a specific directory, I just create a shortcut to cmd.exe and then in the shortcut properties I set "Start in:" to the drive/directory I want it to start in. </p>\n\n<p>Using a shortcut allows me to customize the cmd.exe windows depending on what I\'m using it for. For normal file editing/viewing I use a 180x60 window and appropriate font, but when I want to read/search log files I have a shortcut that opens a 260x100 window with a smaller font. That way I can view most long log file lines without having to use the horizontal scroll.</p>\n'}, {'answer_id': 28885390, 'author': 'gdupuis', 'author_id': 2868313, 'author_profile': 'https://Stackoverflow.com/users/2868313', 'pm_score': 1, 'selected': False, 'text': '<p>In RegEdit.exe I created a String:</p>\n\n<pre><code>HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor\\AutoRun\n</code></pre>\n\n<p>The value I used for AutoRun was "D:"</p>\n'}, {'answer_id': 34237465, 'author': 'Breath Iguana', 'author_id': 5671520, 'author_profile': 'https://Stackoverflow.com/users/5671520', 'pm_score': 3, 'selected': False, 'text': '<p>Use the command</p>\n\n<pre><code>C:\n</code></pre>\n\n<p>To change to the drive C. It would of course work for any drive letter.</p>\n'}, {'answer_id': 60408018, 'author': 'akcasoy', 'author_id': 2224454, 'author_profile': 'https://Stackoverflow.com/users/2224454', 'pm_score': 1, 'selected': False, 'text': '<ul>\n<li>On the start screen / menu, type in "cmd", right-click it and select "Open File - Location". </li>\n<li>In the opened window, right-Click on "Command Prompt" icon, select "Properties", and edit the "Start In" property to your desired path. I used "C:\\" as an example</li>\n</ul>\n'}, {'answer_id': 60408546, 'author': 'jeb', 'author_id': 463115, 'author_profile': 'https://Stackoverflow.com/users/463115', 'pm_score': 0, 'selected': False, 'text': '<p>Some answers already mentioned AutoRun as a solution.<br>\nBut that can be very dangerous, as the AutoRun entry will be executed for any new cmd.exe instance (only pipes ignore the AutoRun).</p>\n\n<p>A simple expample that fails:</p>\n\n<pre><code>cd /d E:\\myPath\nFOR /F "delims=" %%Q in (\'dir\') do echo - %%Q\n</code></pre>\n\n<p>With <code>AutoRun=C:</code>, this shows the content of the current path of drive <code>C:</code></p>\n\n<hr>\n\n<p>You can still use AutoRun, but it should be a batch script, that checks if it was called interactive, by <code>FOR/F</code> or by drag&amp;drop.</p>\n\n<pre><code>@echo off\nREM *** To enable this script, call it by &lt;scriptName&gt; --install\n\nsetlocal EnableDelayedExpansion\nREM *** ALWAYS make a copy of the complete CMDCMDLINE, else you destroy the original!!!\nset "_ccl_=!cmdcmdline!"\n\nREM *** The check is necessary to distinguish between a new cmd.exe instance for a user or for a "FOR /F" sub-command\nif "!_ccl_:~1,-2!" == "!comspec!" (\n    REM ***** INTERACTIVE ****\n\n    REM *** %1 contains only data, when the script itself was called from the command line\n    if "%~1" NEQ "" (\n        goto :direct_call\n    )\n\n    endlocal\n    doskey /macrofile="%~dp0\\cmdMacros.mac"\n    echo ********************************************************************\n    echo * AutoRun executed from "%~f0"\n    echo * Macros loaded from "%~dp0\\cmdMacros.mac"\n    echo ********************************************************************\n    cd /d C:\\myPath\n) ELSE (\n    REM *** Called by a FOR command, by an explorer click or a drag &amp; drop operation\n    REM *** Handle PROBLEMATIC Drag&amp;Drop content, if necessary\n    endlocal\n)\nexit /b\n\n\n:direct_call\nif "%~1" == "--install" (\n    reg add "HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor" /v "AutoRun" /t REG_SZ /d "%~f0"\n    exit /b\n) \n\nif "%~1" == "--show" (  \n    reg query "HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor" /v AutoRun\n    exit /b\n)\n\nif "%~1" == "--remove" (\n    reg DELETE "HKEY_CURRENT_USER\\Software\\Microsoft\\Command Processor" /v AutoRun /f\n)\nexit /b\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/44261', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4491/']