fbpx
维基百科

pushd及popd

pushdpopd 是用于操作命令行目录命令[1][2]它们在DOSMicrosoft WindowsReactOS[3]Unix-like等系统上的4DOS、Bash[4]C shelltcsh、Hamilton C shell、KornShellcmd.exePowerShell命令行解释器中可用。

概览 编辑

pushd命令将当前工作目录存储到内存中,以便随时返回。popd命令返回目录栈顶的路径[5][6]此目录栈由Unix命令dirs或 Windows PowerShell的Get-Location -stack访问。

第一个实现目录栈的Unix shell是Bill Joy的C shell。这套Shell下将目录压栈、出栈的语法与现在基本相同。[7][8]

这两个命令都在FreeCOM——即FreeDOS的命令行界面——可用。[9][來源可靠?]

Windows PowerShell下,pushdPush-Locationcmdlet预定义的aliaspopdPop-Locationcmdlet预定义的alias。两者与pushdpopd命令功能基本相同。

语法 编辑

Pushd 编辑

pushd [path | ..] 

参数:

  • 可选命令行参数path指定即将成为“当前目录”的目录。如果path被省略,则会使用目录栈顶的路径,产生在两个目录之间切换的效果。

Popd 编辑

popd 

示例 编辑

Unix-like 编辑

[user@server /usr/ports] $ pushd /etc /etc /usr/ports [user@server /etc] $ popd /usr/ports [user@server /usr/ports] $ 

Microsoft Windows与ReactOS 编辑

C:\Users\root>pushd C:\Users C:\Users>popd C:\Users\root> 

DOS批处理文件 编辑

@echo off rem This batch file deletes all .txt files in a specified directory pushd %1 del *.txt popd echo All text files deleted in the %1 directory 

另请参阅 编辑

参考文献 编辑

  1. ^ . [2021-05-05]. (原始内容存档于2021-05-07). 
  2. ^ . [2021-05-05]. (原始内容存档于2021-05-06). 
  3. ^ https://github.com/reactos/reactos/blob/master/base/shell/cmd/dirstack.c
  4. ^ . [2021-05-05]. (原始内容存档于2021-02-26). 
  5. ^ . [2021-05-05]. (原始内容存档于2018-02-03). 
  6. ^ . [2021-05-05]. (原始内容存档于2018-02-03). 
  7. ^ . [2021-05-05]. (原始内容存档于2020-12-03). 
  8. ^ man tcsh . [2014-11-03]. (原始内容存档于2014-03-10). 
  9. ^ . [2021-05-05]. (原始内容存档于2021-05-08). 

更多资料 编辑

外部链接 编辑

pushd及popd, 此條目包含過多行話或專業術語, 可能需要簡化或提出進一步解釋, 2021年5月20日, 請在討論頁中發表對於本議題的看法, 並移除或解釋本條目中的行話, pushd, popd, 是用于操作命令行目录栈的命令, 它们在dos, microsoft, windows, reactos, 和unix, like等系统上的4dos, bash, shell, tcsh, hamilton, shell, kornshell, exe和powershell等命令行解释器中可用, pushd, pop. 此條目包含過多行話或專業術語 可能需要簡化或提出進一步解釋 2021年5月20日 請在討論頁中發表對於本議題的看法 並移除或解釋本條目中的行話 pushd 与 popd 是用于操作命令行目录栈的命令 1 2 它们在DOS Microsoft Windows ReactOS 3 和Unix like等系统上的4DOS Bash 4 C shell tcsh Hamilton C shell KornShell cmd exe和PowerShell等命令行解释器中可用 pushd amp popd原作者Bill Joy開發者多位开源软件及商业软件开发者操作系统Unix Unix like DOS Windows ReactOS系統平台跨平台类型命令 目录 1 概览 2 语法 2 1 Pushd 2 2 Popd 3 示例 3 1 Unix like 3 2 Microsoft Windows与ReactOS 3 3 DOS批处理文件 4 另请参阅 5 参考文献 6 更多资料 7 外部链接概览 编辑pushd命令将当前工作目录存储到内存中 以便随时返回 popd命令返回目录栈顶的路径 5 6 此目录栈由Unix命令dirs或 Windows PowerShell的Get Location stack访问 第一个实现目录栈的Unix shell是Bill Joy的C shell 这套Shell下将目录压栈 出栈的语法与现在基本相同 7 8 这两个命令都在FreeCOM 即FreeDOS的命令行界面 可用 9 來源可靠 在Windows PowerShell下 pushd 是Push Locationcmdlet预定义的alias popd 是Pop Locationcmdlet预定义的alias 两者与pushd popd命令功能基本相同 语法 编辑Pushd 编辑 pushd path 参数 可选命令行参数path指定即将成为 当前目录 的目录 如果path被省略 则会使用目录栈顶的路径 产生在两个目录之间切换的效果 Popd 编辑 popd示例 编辑Unix like 编辑 user server usr ports pushd etc etc usr ports user server etc popd usr ports user server usr ports Microsoft Windows与ReactOS 编辑 C Users root gt pushd C Users C Users gt popd C Users root gt DOS批处理文件 编辑 echo off rem This batch file deletes all txt files in a specified directory pushd 1 del txt popd echo All text files deleted in the 1 directory另请参阅 编辑MS DOS命令列表 Unix实用程序列表参考文献 编辑 Pushd change directory folder Windows CMD SS64 com 2021 05 05 原始内容存档于2021 05 07 Popd Windows CMD SS64 com 2021 05 05 原始内容存档于2021 05 06 https github com reactos reactos blob master base shell cmd dirstack c Bash Reference Manual Directory Stack Builtins 2021 05 05 原始内容存档于2021 02 26 Microsoft TechNet Pushd article 2021 05 05 原始内容存档于2018 02 03 Microsoft TechNet Popd article 2021 05 05 原始内容存档于2018 02 03 Chapter 14 14 6 The Shells pushd and popd Commands 2021 05 05 原始内容存档于2020 12 03 man tcsh TCSH 1 2014 11 03 原始内容存档于2014 03 10 FreeCOM FreeDOS 2021 05 05 原始内容存档于2021 05 08 更多资料 编辑Frisch AEleen Windows 2000 Commands Pocket Reference O Reilly 2001 ISBN 978 0 596 00148 3 McElhearn Kirk The Mac OS X Command Line Unix Under the Hood John Wiley amp Sons 2006 ISBN 978 0470113851 外部链接 编辑維基教科書中的相關電子教程 Guide to Windows Commandspushd Microsoft Docs 页面存档备份 存于互联网档案馆 popd Microsoft Docs 页面存档备份 存于互联网档案馆 取自 https zh wikipedia org w index php title Pushd及popd amp oldid 71666564, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。