Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bat failed to work in Powershell or CMD properly #2796

Closed
szw0407 opened this issue Dec 8, 2023 · 5 comments
Closed

Bat failed to work in Powershell or CMD properly #2796

szw0407 opened this issue Dec 8, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@szw0407
Copy link

szw0407 commented Dec 8, 2023

What steps will reproduce the bug?

  1. Running bat command on Windows, using powershell 7 or cmd.exe

What happens?

Nothing happens in fact

image

Only by using Git Bash could bat run properly.

What did you expect to happen instead?

Bat should have worked properly

How did you install bat?

scoop install bat

Using Winget or chocolatey will cause the similar issue.

bat version and environment

Software version

bat 0.24.0 (fc95468)

Operating system

Windows 6.2.9200

Command-line

C:\Users\*****\scoop\apps\bat\current\bat.exe .\a.html --diagnostic

All usernames are okay, and I hid them manually.

Environment variables

SHELL=<not set>
PAGER=<not set>
LESS=<not set>
LANG=<not set>
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_PAGING=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=<not set>
NO_COLOR=<not set>
MANPAGER=<not set>

System Config file

Could not read contents of 'C:\ProgramData\bat\config': 系统找不到指定的路径。 (os error 3).

This means that the system cannot find such path

Config file

Could not read contents of 'C:\Users*******\AppData\Roaming\bat\config': 系统找不到指定的路径。 (os error 3).

Custom assets metadata

Could not read contents of 'C:\Users********\AppData\Local\bat\metadata.yaml': 系统找不到指定的路径。 (os error 3).

Custom assets

'C:\Users*******\AppData\Local\bat' not found

Compile time information

  • Profile: release
  • Target triple: x86_64-pc-windows-msvc
  • Family: windows
  • OS: windows
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-pc-windows-msvc

Less version

> C:\ProgramData\scoop\shims\less.exe --version
BusyBox v1.37.0-FRP-5181-g5c1a3b00e (2023-08-18 12:16:29 BST)

Usage: less [-EFIMmNSRh~] [FILE]...

View FILE (or stdin) one screenful at a time

        -E      Quit once the end of a file is reached
        -F      Quit if entire file fits on first screen
        -I      Ignore case in all searches
        -M,-m   Display status line with line numbers
                and percentage through the file
        -N      Prefix line number to each line
        -S      Truncate long lines
        -R      Remove color escape codes in input
        -~      Suppress ~s displayed past EOF
C:\ProgramData\scoop\apps\busybox\current\busybox.exe: unknown option -- version

Command failed with exit code 1.

@szw0407 szw0407 added the bug Something isn't working label Dec 8, 2023
@szw0407
Copy link
Author

szw0407 commented Dec 8, 2023

Perhaps, Windows should seek for bat.exe instead of bat, which cannot be found by cmd or pwsh, but bash recognized that.

@keith-hall
Copy link
Collaborator

from the output of your which bat performed in PowerShell, that would indicate that it can find it the executable without you needing to specify the .exe extension. I wonder whether the problem is somehow related to the pager. Does it work in PowerShell with bat a.html --paging=never?

@szw0407
Copy link
Author

szw0407 commented Dec 17, 2023

Yes, that works!

So is it an issue with less.exe on my device, which in fact comes from BusyBox for windows? When I use the less 643, everything is just normal.

@szw0407
Copy link
Author

szw0407 commented Dec 17, 2023

If there is nothing wrong, may the issue just be closed? I have confirmed that it is an issue with Busybox-w32 or the less.exe going with it, but not an issue with Bat.

@keith-hall
Copy link
Collaborator

Nice, happy to hear you got it sorted 👍
Yes, it can just be closed. Or we can see if it makes sense to mention it somewhere in the documentation in case it will help others with the same problem in future 🙂

@szw0407 szw0407 closed this as completed Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants