All I want to do is:
I need to do this in one line using cmd.exe starting from a different drive
I would do this like this:
c: cd temp dir
so in one statement so far I have:
cmd /c c: & cd\temp & dir
But this just gives me dir for the P: directory which I start from. How can I get dir returned from c:\temp?
I can't run a batch file and it must be in a one-line statement.
Cd is the abbreviation or synonym for chdir. It is a command found inside the Windows Command Processor (cmd) that allows for change of the current working directory of a shell instance.
If the folder you want to open in Command Prompt is on your desktop or already open in File Explorer, you can quickly change to that directory. Type cd followed by a space, drag and drop the folder into the window, and then press Enter. The directory you switched to will be reflected in the command line.
If you want run command window from a specific folder. Click your folder then hold your shift key, then right click you will found option open command window here then click it.
You may want to invoke CD with the /d option, thus not only changing the current directory on drive c: but also going there (in case you are not already on that drive).
cmd /c "cd /d c:\temp && dir"
you use && or & to separate multiple commands
if the cmd window is already opened and running from command line
c: && cd\temp && dir
or
cmd /c && c: && cd\temp && dir
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With