diff --git a/pkgs/racket-pkgs/racket-doc/scribblings/raco/command.scrbl b/pkgs/racket-pkgs/racket-doc/scribblings/raco/command.scrbl index 7af1c17851..02f6573474 100644 --- a/pkgs/racket-pkgs/racket-doc/scribblings/raco/command.scrbl +++ b/pkgs/racket-pkgs/racket-doc/scribblings/raco/command.scrbl @@ -83,7 +83,8 @@ Returns a string that identifies the current command. When short name of the @exec{raco} executable followed by a space and the command name. Otherwise, it is the short name of the current executable, as determined by stripping the path from the result of -@racket[(find-system-path 'run-file)]. +@racket[(find-system-path 'run-file)]. In either case, on Windows, an +@filepath{.exe} extension is removed from the executable name. The result of this function is suitable for use with @racket[command-line]. For example, the @exec{decompile} tool parses diff --git a/racket/collects/raco/command-name.rkt b/racket/collects/raco/command-name.rkt index 1906ab2823..5cbe917428 100644 --- a/racket/collects/raco/command-name.rkt +++ b/racket/collects/raco/command-name.rkt @@ -21,7 +21,13 @@ (let-values ([(p) (find-system-path 'run-file)] [(n) (current-command-name)]) (let-values ([(base name dir?) (split-path p)]) - (if n - (format "~a ~a" name n) - (path->string name))))))) + (let-values ([(name) (if (eq? (system-type) 'windows) + (string->path-element + (regexp-replace #rx"(?i:[.]exe)$" + (path-element->string name) + "")) + name)]) + (if n + (format "~a ~a" name n) + (path->string name))))))))