Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

pushd

Feedback

In this article

Stores the current directory for use by thepopd command, and then changes to the specified directory.

Every time you use thepushd command, a single directory is stored for your use. However, you can store multiple directories by using thepushd command multiple times. The directories are stored sequentially in a virtual stack, so if you use thepushd command once, the directory in which you use the command is placed at the bottom of the stack. If you use the command again, the second directory is placed on top of the first one. The process repeats every time you use thepushd command.

If you use thepopd command, the directory on the top of the stack is removed and the current directory is changed to that directory. If you use thepopd command again, the next directory on the stack is removed. If command extensions are enabled, thepopd command removes any drive-letter assignment created by thepushd command.

Syntax

pushd [<path>]

Parameters

ParameterDescription
<path>Specifies the directory to make the current directory. This command supports relative paths.
/?Displays help at the command prompt.

Remarks

  • If command extensions are enabled, thepushd command accepts either a network path or a local drive letter and path.

  • If you specify a network path, thepushd command temporarily assigns the highest unused drive letter (starting with Z:) to the specified network resource. The command then changes the current drive and directory to the specified directory on the newly assigned drive. If you use thepopd command with command extensions enabled, thepopd command removes the drive-letter assignment created bypushd.

Examples

To change the current directory from the one in which the batch program was run, and then to change it back:

@echo offrem This batch file deletes all .txt files in a specified directorypushd %1del *.txtpopdclsecho All text files deleted in the %1 directory

Related links


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?