Using asterisk (*) wildcard with other installed command in cmd.exe?

0

0

This is my first time questioning something on superuser, I hope anyone can help me with my problem.

First, let me explain what I'm trying to do. I'm using windows cmd.exe shell to help me combining my picture (hdr format) using another application installed command. The command is quite easy, I just have to write the command and select all the data after it. The command might look as simple as this

mydir > pcomb images\patches\*.hdr > images\combinedimages.hdr

but there goes the error that says

images\patches\*.hdr: Invalid argument

I already search for the solution and then I got some clue. It appears that the '*' wildcard does not work with windows standard shell, even though the wildcard does work with other commands, such as 'type' and 'dir' just like the command bellow

mydir > dir images\patches\*.hdr
22/07/2019  13.47           938.824 p000.hdr
22/07/2019  13.47           938.824 p001.hdr
22/07/2019  13.47           938.824 p002.hdr
22/07/2019  13.47           938.824 p003.hdr
22/07/2019  13.47           938.824 p004.hdr
22/07/2019  13.47           938.824 p005.hdr

Then somebody said that I have to :

  1. use Cygwin shell by simply installing git for windows (the problem still exist even though I'm using bash typing style).
  2. I have to provide a full list of files spelled out via some command which I already done (but another problem exist since cmd.exe has a limited number of rows and I have thousand of files to spell out)

is that any workaround from this ?

Sorry for bad grammar written, I'm not too fluent in English

Adam Zakiy H

Posted 2019-07-23T01:13:47.457

Reputation: 1

Yes, cmd.exe doesn't handle *, any command may or may not handle wildcards on its own. In Unix/Linux shells handle *, this is POSIX behavior. Questions: (1) In Cygwin, in what way "the problem still exists even though I'm using bash typing style"? Is it argument list too long? See this (2) Are you trying to combine literally "thousand of files" with one pcomb? Depending on what you want to do, maybe you can combine in equal packs (e.g. 100 images at a time) and then combine the results to get one final file.

– Kamil Maciorowski – 2019-07-23T01:59:28.593

If you were to process a single file what would be the exact pcomb command you would use? – DavidPostill – 2019-07-23T09:57:34.120

Answers

0

Is this the executable in question: https://floyd.lbl.gov/radiance/man_html/pcomb.1.html

If so the documentation is scant, to say the least, but if I follow the examples given correctly (which only ever shows 2 input files, and DOES NOT have the >? notation except "when making a dot")

If so I believe what you are looking to do is something like this at the normal command line by hand:

Option1:

pcomb "C:\images\patches\938.824 p000.hdr" "C:\images\patches\938.824 p001.hdr" "C:\images\patches\938.824 p002.hdr" >"C:\images\combinedimages.hdr"

Option 2:

pcomb "C:\images\patches\938.824 p000.hdr" > "C:\images\combinedimages.hdr"
pcomb "C:\images\patches\938.824 p001.hdr" > "C:\images\combinedimages.hdr"
pcomb "C:\images\patches\938.824 p002.hdr" > "C:\images\combinedimages.hdr"

Assuming the above when tested works as expected you could do the following based off which option works in testing:

Option1:

SET "_HDRFiles=" &REM Clearing the variable in the CLI in case you run this multiple times.

FOR %A IN ("C:\images\patches\*.hdr" ) DO (
  CALL SET "_HDRFiles=%_HDRFiles% "%A""
)
pcomb %_HDRFiles% >"C:\images\combinedimages.hdr"

Option 2:

FOR %A IN ("C:\images\patches\*.hdr" ) DO (
  pcomb "%A" > "C:\images\combinedimages.hdr"
)

Ben Personick

Posted 2019-07-23T01:13:47.457

Reputation: 201