1

Attempting to change my working directory.

In the command prompt, my input was:

> cd F:
:: Command prompt returned:
> F:\

Then another line appeared, reverting my working directory back to:

C:\Users\caden

Ultimately, I need to run the following command using , but I need to either change the current/working directory, or perhaps combine 'cd F:' with my command, I suppose...

The FFmpeg command I'm using to cut video:

ffmpeg.exe -i "F:\output" -ss 00:00:01 -t 10:00:00 -c:v copy -c:a copy GENTLEWAVESFINAL.mp4

I'm attempting to move my working/current directory, yet to no avail. I suppose the questions I need answered are:

  1. Does the command: cd change the current directory until it is altered again, or does it need to be inserted/used for each command used in the prompt?

  2. If so, then that means I would need to use cd F:\ + other code how should the combined code look, using the commands above?

3
  • To change to drive f: you simply type F: and press enter. To go to root of a drive type cd \ and press enter. Commented May 13, 2023 at 23:28
  • I guess it should be closed as a typo, but I don't have that privilege Commented May 14, 2023 at 0:38
  • 1
    the /d switch allows the drive to also be changed Commented May 14, 2023 at 5:11

2 Answers 2

1

Usually the change is not temporary. It is permanent till next cd/pushd/popd.

F: changes current drive to F:

cd F:\ changes current path on drive F: to root (\), does not change current drive

cd \folder changes current drive path to folder folder at the top of the hierarchy

cd folder changes current drive path to subfolder folder in current folder

cd /d C:\Windows changes current drive and folder to C: and \Windows respectively

cd .. changes current folder one level up

cd \ changes current folder to root (\) on current drive

Answering the questions:

  1. It is used once for one folder, but command pushd or popd may change this current folder.
  2. Look above for my explanations.
-1

enter image description here

@echo off 

cd "D:\Your_Current_D_Drive_WorkDir"
cd "E:\Your_Current_E_Drive_WorkDir"
cd "F:\Your_Current_F_Drive_WorkDir"

CD /D "%Temp%\Your_Current_C_Drive_WorkDir"

echo/   "%=D:%"  == "D:\Your_Current_D_Drive_WorkDir"
echo/   "%=E:%"  == "E:\Your_Current_E_Drive_WorkDir"
echo/   "%=F:%"  == "F:\Your_Current_F_Drive_WorkDir"

echo/ "%__CD__%" == "C:\Users\ecker\AppData\Local\Temp\Your_Current_C_Drive_WorkDir\" 
echo/   "%CD%"   == "C:\Users\ecker\AppData\Local\Temp\Your_Current_C_Drive_WorkDir"

ffmpeg.exe -i "%=F:%\output.mp4" -ss 00:00:01 -t 10:00:00 -c:v copy -c:a copy "%=F:%\GENTLEWAVESFINAL.mp4"

I understand that, despite my limited proficiency in English, it’s worth trying out the %CD% variant for tracking current directories across different drives.

The article explains that variables like =C: are remnants from MS-DOS, which help maintain the current directory for each drive without having to switch drives and/or subsequent folders of interest, keeping everything simple.


Note: The variable only receives a value after using cd Drive\Directory. Before this usage in the current console session, there is no visible or accessible value.


Additional resources:

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.