Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Introduction
  • Installation
    • Default Shell
  • Getting Started
    • Quick Tour
    • Moving Around the System
    • Thinking in Nu
    • Nushell Cheat Sheet
  • Nu Fundamentals
    • Types of Data
    • Loading Data
    • Pipelines
    • Working with Strings
    • Working with Lists
    • Working with Records
    • Working with Tables
    • Navigating and Accessing Structured Data
    • Special Variables
  • Programming in Nu
    • Custom Commands
    • Aliases
    • Operators
    • Variables
    • Control Flow
    • Scripts
    • Modules
      • Using Modules
      • Creating Modules
    • Overlays
    • Sorting
    • Testing your Nushell Code
    • Best Practices
  • Nu as a Shell
    • Configuration
    • Environment
    • Stdout, Stderr, and Exit Codes
    • Running System (External) Commands
    • How to Configure 3rd Party Prompts
    • Directory Stack
    • Reedline, Nu's Line Editor
    • Custom Completions
    • Externs
    • Coloring and Theming in Nu
    • Hooks
    • Background Jobs
  • Coming to Nu
    • Coming from Bash
    • Coming from CMD.EXE
    • Nu map from other shells and domain specific languages
    • Nu Map from Imperative Languages
    • Nu Map from Functional Languages
    • Nushell operator map
  • Design Notes
    • How Nushell Code Gets Run
  • (Not So) Advanced
    • Standard Library (Preview)
    • Dataframes
    • Metadata
    • Creating Your Own Errors
    • Parallelism
    • Plugins
    • explore

Coming from CMD.EXE

This table was last updated for Nu 0.67.0.

CMD.EXENuTask
ASSOCDisplays or modifies file extension associations
BREAKTrigger debugger breakpoint
CALL <filename.bat><filename.bat>Run a batch program
nu <filename>Run a nu script in a fresh context
source <filename>Run a nu script in this context
use <filename>Run a nu script as a module
CD or CHDIR$env.PWDGet the present working directory
CD <directory>cd <directory>Change the current directory
CD /D <drive:directory>cd <drive:directory>Change the current directory
CLSclearClear the screen
COLORSet the console default foreground/background colors
ansi {flags} (code)Output ANSI codes to change color
COPY <source> <destination>cp <source> <destination>Copy files
COPY <file1>+<file2> <destination>[<file1>, <file2>] | each { open --raw } | str join | save --raw <destination>Append multiple files into one
DATE /Tdate nowGet the current date
DATESet the date
DEL <file> or ERASE <file>rm <file>Delete files
DIRlsList files in the current directory
ECHO <message>print <message>Print the given values to stdout
ECHO ONEcho executed commands to stdout
ENDLOCALexport-envChange env in the caller
EXITexitClose the prompt or script
FOR %<var> IN (<set>) DO <command>for $<var> in <set> { <command> }Run a command for each item in a set
FTYPEDisplays or modifies file types used in file extension associations
GOTOJump to a label
IF ERRORLEVEL <number> <command>if $env.LAST_EXIT_CODE >= <number> { <command> }Run a command if the last command returned an error code >= specified
IF <string> EQU <string> <command>if <string> == <string> { <command> }Run a command if strings match
IF EXIST <filename> <command>if (<filename> | path exists) { <command> }Run a command if the file exists
IF DEFINED <variable> <command>if '$<variable>' in (scope variables).name { <command> }Run a command if the variable is defined
MD or MKDIRmkdirCreate directories
MKLINKCreate symbolic links
MOVEmvMove files
PATH$env.PathDisplay the current path variable
PATH <path>;%PATH%$env.Path = ($env.Path | append <path>)Edit the path variable
PATH %PATH%;<path>$env.Path = ($env.Path | prepend <path>)Edit the path variable
PAUSEinput "Press any key to continue . . ."Pause script execution
PROMPT <template>$env.PROMPT_COMMAND = { <command> }Change the terminal prompt
PUSHD <path>/POPDenter <path>/dexitChange working directory temporarily
REM#Comments
REN or RENAMEmvRename files
RD or RMDIRrmRemove directory
SET <var>=<string>$env.<var> = <string>Set environment variables
SETLOCAL(default behavior)Localize environment changes to a script
START <path>Partially covered by start <path>Open the path in the system-configured default application
START <internal command>Start a separate window to run a specified internal command
START <batch file>Start a separate window to run a specified batch file
TIME /Tdate now | format date "%H:%M:%S"Get the current time
TIMESet the current time
TITLESet the cmd.exe window name
TYPEopen --rawDisplay the contents of a text file
openOpen a file as structured data
VERDisplay the OS version
VERIFYVerify that file writes happen
VOLShow drive information

Forwarded CMD.EXE commands

Nu accepts and runs some of CMD.EXE's internal commands through cmd.exe.

The internal commands are: ASSOC, CLS, ECHO, FTYPE, MKLINK, PAUSE, START, VER, VOL

These internal commands take precedence over external commands.

For example, with a ver.bat file in the current working directory, executing ^ver executes CMD.EXE's internal VER command, NOT the ver.bat file.

Executing ./ver or ver.bat will execute the local bat file though.

Note that Nushell has its own start command which takes precedence. You can call the CMD.EXE's internal START command with the external command syntax ^start.

Edit this page on GitHub
Contributors: Christopher Durham, Justin Ma, Zhora Trush, Dan Davison, Jakub Žádník, amtoine, Marika Chlebowska, yukitomoda, Garrett Smith, Jan Klass, fdncred, Rodrigo Vieira da Silva
Prev
Coming from Bash
Next
Nu map from other shells and domain specific languages