how to start a 64 bit program from within a bat file on a win 7 64 bit ?

A

Asger Joergensen

Hi

I just tried this in a bat file:


"E:\ZZZZ\Pakket Software\PNG\pngcrush_1_7_42_w64.exe" -v

pause


but the system tells me that pngcrush_1_7_42_w64.exe is not
a valid 32 bit program

I can start the program on the command prompt if I do it manually
by first starting C:\WINDOWS\system32\cmd.exe

How can I get the right 64bit cmd.exe for my bat file ?

I have tried making a shortcut:
C:\WINDOWS\system32\cmd.exe batfilename.bat

but that doesn't work either

Thanks in advance
Best regards
Asger-P
 
G

Gene E. Bloch

Hi

I just tried this in a bat file:

"E:\ZZZZ\Pakket Software\PNG\pngcrush_1_7_42_w64.exe" -v

pause

but the system tells me that pngcrush_1_7_42_w64.exe is not
a valid 32 bit program

I can start the program on the command prompt if I do it manually
by first starting C:\WINDOWS\system32\cmd.exe

How can I get the right 64bit cmd.exe for my bat file ?

I have tried making a shortcut:
C:\WINDOWS\system32\cmd.exe batfilename.bat

but that doesn't work either

Thanks in advance
Best regards
Asger-P
My first guess is to edit the batch file so the invocation reads

cmd.exe /C "E:\ZZZZ\Pakket Software\PNG\pngcrush_1_7_42_w64.exe" -v

I'm a bit rusty on cmd, so I can't promise that the above is correct,
particularly the switch /C.
 
A

Asger Joergensen

Hi Gene

Thanks for you answer.
As it turns out there was nothing wrong, except when I copied the exe file,
only the name was copied, so the exe file was empty.

Sorry for the trouble.
Best regards
Asger-P
 
D

Dave \Crash\ Dummy

Gene said:
My first guess is to edit the batch file so the invocation reads

cmd.exe /C "E:\ZZZZ\Pakket Software\PNG\pngcrush_1_7_42_w64.exe" -v

I'm a bit rusty on cmd, so I can't promise that the above is correct,
particularly the switch /C.
Detailed information on switches can be had by running "cmd /?"
The response is several pages, so it is best to redirect to a file and
put it somewhere for future reference.
 
G

Gene E. Bloch

Hi Gene

Thanks for you answer.
As it turns out there was nothing wrong, except when I copied the exe file,
only the name was copied, so the exe file was empty.

Sorry for the trouble.
Best regards
Asger-P
No trouble.

Actually, that is an entertaining error. I have done similar things also
:)
 
G

Gene E. Bloch

Detailed information on switches can be had by running "cmd /?"
The response is several pages, so it is best to redirect to a file and
put it somewhere for future reference.
Of course. Although I actually used "help cmd".

The problem wasn't finding the switches, the problem was not being sure
the switch would do what I thought it would, which the description
didn't clarify for me. Like: would control return to the batch file as
soon as the program started, or would it wait until the program had
completed...

But then, take a look at what Asger Joergensen posted :)
 
B

Bob I

On 1/18/2013 4:23 PM, Dave "Crash" Dummy wrote:
Detailed information on switches can be had by running "cmd /?"
The response is several pages, so it is best to redirect to a file and
put it somewhere for future reference.

CMD /? /P
 
G

Gene E. Bloch

On 1/18/2013 4:23 PM, Dave "Crash" Dummy wrote:


CMD /? /P
And what, pray tell, does "/P" do, in your opinion?

I find that anything I put on the line after "cmd /?" is ignored, even
if I omit the space after the "?".
 
A

Asger Joergensen

Hi Gene
And what, pray tell, does "/P" do, in your opinion?

I find that anything I put on the line after "cmd /?" is ignored, even
if I omit the space after the "?".
Usually it means page by page, but since cmd.exe /? already does that
there is really no deed.
 
G

Gene E. Bloch

Hi Gene


Usually it means page by page, but since cmd.exe /? already does that
there is really no deed.
Since "cmd /?" automatically pages anyway (implicitly using "more"), I
really wanted to know what 'Bob I' thought it meant, not what you
thought it meant, in case it was something else, something new to me.

I already knew (probably for decades now) that "cmd /?" implicitly works
like more.

BTW, paging in the command window might not be the greatest way to look
at a huge file. You *can* scroll up & down, and even search for text,
but searching is not totally convenient...
 
B

Bob I

And what, pray tell, does "/P" do, in your opinion?

I find that anything I put on the line after "cmd /?" is ignored, even
if I omit the space after the "?".
Had it in my head from somewhere in the past it meant "pages", quick
test showed expected output. You are correct.
 
G

Gene E. Bloch

Had it in my head from somewhere in the past it meant "pages", quick
test showed expected output. You are correct.
Thanks for the reply.

Actually, I have no recollection of that flag, but that's my limitation,
not yours :)

On looking at my remark before, it does seem a bit snappish.
Apologies...

But in the discussion, I managed to remind myself of more, which can
work either as a command (more stuff.txt) or as a pipe (copy stuff.txt |
more) - similar to Unix.
 
B

Bob I

On looking at my remark before, it does seem a bit snappish.
Apologies...
Accepted, you could have said "WTF you talking about!?!" ;-).
But in the discussion, I managed to remind myself of more, which can
work either as a command (more stuff.txt) or as a pipe (copy stuff.txt |
more) - similar to Unix.
Yep there is a lot of stuff that still works and some that has gone by
the wayside or wasn't documented, the part that I find the most odd is
the relative lack of knowledge about "F1" key!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top