Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Feature Forums
  3. - Uncategorised posts -
  4. Running app in Powershell

Running app in Powershell

Scheduled Pinned Locked Moved - Uncategorised posts -
csharpvisual-studiowindows-adminquestionworkspace
12 Posts 7 Posters 9 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • realJSOPR realJSOP

    I have an app that is in a folder, which is in the environment path. When i run the app, at the prompt like so, it runs fine.

    > MyApp

    If I add a commandline parameter to it, I get nothing:

    > MyApp /msg:"test"

    I know the command line parameter is valid, because it works when I run it in visual studio. I've also tried (none of these worked either):

    > MyApp /msg:"test"

    MyApp /msg:'test'
    MyApp '/msg:"test"'
    MyApp "/msg:""test"""

    I have next to zero knowledge regarding powershell. What am I doing wrong?

    ".45 ACP - because shooting twice is just silly" - JSOP, 2010
    -----
    You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
    -----
    When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

    Richard Andrew x64R Offline
    Richard Andrew x64R Offline
    Richard Andrew x64
    wrote on last edited by
    #2

    I'm just guessing, but did you try a hyphen instead of the slash?

    The difficult we do right away... ...the impossible takes slightly longer.

    realJSOPR R 2 Replies Last reply
    0
    • Richard Andrew x64R Richard Andrew x64

      I'm just guessing, but did you try a hyphen instead of the slash?

      The difficult we do right away... ...the impossible takes slightly longer.

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #3

      app doesn't recognize hyphens (I wrote the app, so that's how I know).

      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
      -----
      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
      -----
      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

      R 1 Reply Last reply
      0
      • realJSOPR realJSOP

        I have an app that is in a folder, which is in the environment path. When i run the app, at the prompt like so, it runs fine.

        > MyApp

        If I add a commandline parameter to it, I get nothing:

        > MyApp /msg:"test"

        I know the command line parameter is valid, because it works when I run it in visual studio. I've also tried (none of these worked either):

        > MyApp /msg:"test"

        MyApp /msg:'test'
        MyApp '/msg:"test"'
        MyApp "/msg:""test"""

        I have next to zero knowledge regarding powershell. What am I doing wrong?

        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
        -----
        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
        -----
        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #4

        I have just run a simple test and my app works fine:

        PS C:\Users\rjmac\Documents\VSCode\C++> test /msg:"test"
        argc = 2
        argv[1] = /msg:test
        C++ test result: 0
        PS C:\Users\rjmac\Documents\VSCode\C++>

        realJSOPR 1 Reply Last reply
        0
        • L Lost User

          I have just run a simple test and my app works fine:

          PS C:\Users\rjmac\Documents\VSCode\C++> test /msg:"test"
          argc = 2
          argv[1] = /msg:test
          C++ test result: 0
          PS C:\Users\rjmac\Documents\VSCode\C++>

          realJSOPR Offline
          realJSOPR Offline
          realJSOP
          wrote on last edited by
          #5

          I have to do this to get it to work: Start-Process PSMsgBox.exe -ArgumentList "/msg:""This is a test message"""

          ".45 ACP - because shooting twice is just silly" - JSOP, 2010
          -----
          You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
          -----
          When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

          L 1 Reply Last reply
          0
          • realJSOPR realJSOP

            I have to do this to get it to work: Start-Process PSMsgBox.exe -ArgumentList "/msg:""This is a test message"""

            ".45 ACP - because shooting twice is just silly" - JSOP, 2010
            -----
            You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
            -----
            When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #6

            Interesting. I wonder if perhaps that colon after msg was the problem? Even though it worked in my test; which is very basic of course. [edit] There is a section in about_Special_Characters - PowerShell | Microsoft Docs[^] headed "Stop-parsing token", which may be of interest. [/edit]

            realJSOPR 1 Reply Last reply
            0
            • L Lost User

              Interesting. I wonder if perhaps that colon after msg was the problem? Even though it worked in my test; which is very basic of course. [edit] There is a section in about_Special_Characters - PowerShell | Microsoft Docs[^] headed "Stop-parsing token", which may be of interest. [/edit]

              realJSOPR Offline
              realJSOPR Offline
              realJSOP
              wrote on last edited by
              #7

              Richard MacCutchan wrote:

              I wonder if perhaps that colon after msg was the problem? Even though it worked in my test; which is very basic of course.

              The colon isn't a special char. I even tried combinations of single/double quotes... :(

              ".45 ACP - because shooting twice is just silly" - JSOP, 2010
              -----
              You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
              -----
              When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

              L 1 Reply Last reply
              0
              • realJSOPR realJSOP

                Richard MacCutchan wrote:

                I wonder if perhaps that colon after msg was the problem? Even though it worked in my test; which is very basic of course.

                The colon isn't a special char. I even tried combinations of single/double quotes... :(

                ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                -----
                You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                -----
                When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #8

                Oh, the wonders of Windows (or PS). ;)

                1 Reply Last reply
                0
                • realJSOPR realJSOP

                  I have an app that is in a folder, which is in the environment path. When i run the app, at the prompt like so, it runs fine.

                  > MyApp

                  If I add a commandline parameter to it, I get nothing:

                  > MyApp /msg:"test"

                  I know the command line parameter is valid, because it works when I run it in visual studio. I've also tried (none of these worked either):

                  > MyApp /msg:"test"

                  MyApp /msg:'test'
                  MyApp '/msg:"test"'
                  MyApp "/msg:""test"""

                  I have next to zero knowledge regarding powershell. What am I doing wrong?

                  ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                  -----
                  You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                  -----
                  When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                  J Offline
                  J Offline
                  julia william
                  wrote on last edited by
                  #9

                  Premium Chauffeurs for Exotic Airport Transfers | Luxury Airport Services[^]

                  1 Reply Last reply
                  0
                  • Richard Andrew x64R Richard Andrew x64

                    I'm just guessing, but did you try a hyphen instead of the slash?

                    The difficult we do right away... ...the impossible takes slightly longer.

                    R Offline
                    R Offline
                    RagulRavi
                    wrote on last edited by
                    #10

                    Amazon Web Services (AWS) is a secure cloud services platform, offering compute power, database storage, content delivery and other functionality to help businesses scale and grow. In simple words AWS allows you to do the following things- Running web and application servers in the cloud to host dynamic websites. For click here to know more details AWS Training in Pune Amazon Web Services offers a broad set of global cloud-based products including compute, storage, databases, analytics, networking, mobile, developer tools, management tools, IoT, security and enterprise applications. These services help organizations move faster, lower IT costs, and scale.

                    1 Reply Last reply
                    0
                    • realJSOPR realJSOP

                      app doesn't recognize hyphens (I wrote the app, so that's how I know).

                      ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                      -----
                      You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                      -----
                      When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                      R Offline
                      R Offline
                      rnbergren
                      wrote on last edited by
                      #11

                      pretty sure you have to use hyphens in powershell at command line also I think it isn't the colon but just a space soo poershlapp.ps1 -msg1 par1value

                      To err is human to really elephant it up you need a computer

                      1 Reply Last reply
                      0
                      • realJSOPR realJSOP

                        I have an app that is in a folder, which is in the environment path. When i run the app, at the prompt like so, it runs fine.

                        > MyApp

                        If I add a commandline parameter to it, I get nothing:

                        > MyApp /msg:"test"

                        I know the command line parameter is valid, because it works when I run it in visual studio. I've also tried (none of these worked either):

                        > MyApp /msg:"test"

                        MyApp /msg:'test'
                        MyApp '/msg:"test"'
                        MyApp "/msg:""test"""

                        I have next to zero knowledge regarding powershell. What am I doing wrong?

                        ".45 ACP - because shooting twice is just silly" - JSOP, 2010
                        -----
                        You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
                        -----
                        When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013

                        S Offline
                        S Offline
                        superslot898
                        wrote on last edited by
                        #12

                        That’s the best you’ve ever done.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups