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.
/usr/bin, I have atest.exe, which works in cmd. You can also usepacman(originally from Arch) to install other packages, and it might not require opening the MSYS shell. – jpaugh Jul 25 '18 at 22:26IFstatement likeIF EXIST somefile ( ECHO Yes exist )or oppositeIF NOT EXIST somefile ( ECHO Not exist )More on this here: https://ss64.com/nt/if.html – Alex Jul 25 '18 at 23:19cmdcome on scene I hoppedcommand.comabsurdity would gone away but it isn't happened. BTW, if you don't want 3rd party dependency on MSYS you can use new bloated way with PowerShell by utilizingTest-Pathcmdlet like https://stackoverflow.com/a/31880042 or use VBS function FileExist (https://stackoverflow.com/a/22388077) – Alex Jul 26 '18 at 12:46