Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Win32 wperl open Console when system

by Corion (Patriarch)
on Jan 21, 2020 at 10:19 UTC ( [id://11111669]=note: print w/replies, xml ) Need Help??


in reply to Win32 wperl open Console when system

Using cmd.exe to launch the default program will always open a console window (if none is open already), because cmd.exe is a console program:

qx{start "$pdf" /b };

If you want to avoid that, don't involve the start command of cmd.exe and instead do what the command does, by using the AssocQueryStringA function, as in this Stackoverflow post. Doing so shouldn't be too hard using Win32::API, but I can't test it right now.

Replies are listed 'Best First'.
Re^2: Win32 wperl open Console when system
by fdesar (Beadle) on Jan 21, 2020 at 11:08 UTC

    unfortunatly, .pdf has no default association in HKEY_CLASS_ROOT for .pdf :-(

    And if I directly run "C:\Program Files\Internet Explorer\iexplore.exe" file.pdf, it asks what to do with the file instead of displaying it directly...

      You first said "explorer" (files) now you say iexplore (internet)?

      These are two different programs.

      this C:\>C:\Windows\explorer.exe \tmp\xxx.pdf works for me from the console (cmd.exe)

      update

      this doesn't :/

      perl -e"`C:/Windows/explorer.exe /tmp/xxx.pdf`"

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

        Funny:
        perl -e "qx(explorer.exe C:\Path\To\my.pdf)"
        opens the explorer, but
        perl -e "qx'explorer.exe C:\Path\To\my.pdf'"
        opens my pdf

        only difference is the qx delimiter. (insert smiley with gaping open mouth here)

        Perl 5.28.1 MSWin32-x64-multi-thread on Windows [Version 10.0.18363.535]

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11111669]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-26 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found