1

I've got a simple command I'd like to run in windows cmd:

//returns "file not found" for directories and "file exists" for files
test -f file/path/here && echo file exists || echo file not found

I've searched SO and found this Q&A: How to check if a directory exists in Windows?

the first comment in the accepted answer suggests that you can install binary files for it on windows machines. I've done this before with curl binary, but I haven't found test binary file. Is there some repository for such files? Where should I search. Google is unfortunately vague, because well, commands name is test :)

I am extremely uncomfortable with with cmd, so if you can write an alternative, I'd take it.

Note, I am aware of cygwin, but I'd like to keep this simple and in cmd.

sanjihan
  • 871

1 Answers1

1

MSYS2 is a good bet. Under the install folder (in my case, C:\msys64), under usr\bin, I have a test.exe, which works in cmd.

You can also use pacman (originally from Arch) to install other packages, and it might not require opening the MSYS shell.

jpaugh
  • 1,390