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. The Lounge
  3. Microsoft has caused me sooo much trouble over the years due to a bad piece of documentation

Microsoft has caused me sooo much trouble over the years due to a bad piece of documentation

Scheduled Pinned Locked Moved The Lounge
13 Posts 6 Posters 754 Views
  • 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.
  • R Offline
    R Offline
    Rage
    wrote last edited by
    #3

    On a serious note, this is indeed poorly documented. Here a good source :
    https://www.robvanderwoude.com/condexec.php

    1 Reply Last reply
    1
    • D Offline
      D Offline
      dandy72
      wrote last edited by
      #4

      Personally I never fully got the hang of cmd.exe's (or even DOS's) quirks and generally shy away from batch file-type of syntax.

      When PowerShell came along I figured there was no point in trying to learn cmd.exe's idiosyncrasies.

      PS isn't without its own quirks, but at least in most cases, if I sit back and think about them, I end up agreeing they make sense and move on.

      And PS is a lot more powerful. And if that's not enough, you can tap into .NET.

      P 1 Reply Last reply
      1
      • D dandy72

        Personally I never fully got the hang of cmd.exe's (or even DOS's) quirks and generally shy away from batch file-type of syntax.

        When PowerShell came along I figured there was no point in trying to learn cmd.exe's idiosyncrasies.

        PS isn't without its own quirks, but at least in most cases, if I sit back and think about them, I end up agreeing they make sense and move on.

        And PS is a lot more powerful. And if that's not enough, you can tap into .NET.

        P Offline
        P Offline
        PIEBALDconsult
        wrote last edited by PIEBALDconsult
        #5

        I'm not a fan of PowerShell.
        I just looked at how to spawn a process in PowerShell. It looks like there are a few ways, but I would likely still call cmd.exe from it, the other options don't seem to do what I need and I don't have a need to learn new tricks.

        The first time I used PowerShell, it was because someone gave me a script to demonstrate the use of an API for some third-party software. Once I confirmed that it worked, I rewrote it in C# -- which meant I had a lot more control.

        There was another time I wrote a PowerShell script to test whether or not some remote systems were healthy, but I simply called it from the command line.

        Graeme_GrantG 1 Reply Last reply
        1
        • A Offline
          A Offline
          Afzaal Ahmad Zeeshan
          wrote last edited by
          #6

          I never liked CMD or PowerShell; the only terminals that made sense were from the Linux environments — bash, etc. However, the Windows Terminal did bring me a little closer to the terminal world on Windows. Otherwise, I prefer to use Linux when I must use a terminal.

          Right tool for the right job. :)

          P 1 Reply Last reply
          0
          • P PIEBALDconsult

            I'm not a fan of PowerShell.
            I just looked at how to spawn a process in PowerShell. It looks like there are a few ways, but I would likely still call cmd.exe from it, the other options don't seem to do what I need and I don't have a need to learn new tricks.

            The first time I used PowerShell, it was because someone gave me a script to demonstrate the use of an API for some third-party software. Once I confirmed that it worked, I rewrote it in C# -- which meant I had a lot more control.

            There was another time I wrote a PowerShell script to test whether or not some remote systems were healthy, but I simply called it from the command line.

            Graeme_GrantG Online
            Graeme_GrantG Online
            Graeme_Grant
            wrote last edited by
            #7

            @PIEBALDconsult said in Microsoft has caused me sooo much trouble over the years due to a bad piece of documentation:

            The first time I used PowerShell, it was because someone gave me a script to demonstrate the use of an API for some third-party software. Once I confirmed that it worked, I rewrote it in C# -- which meant I had a lot more control.

            You can use C# directly in a powershell script!

            Add-Type -TypeDefinition @"
            public class HelloWorld {
                public static string SayHello(string name) {
                    return "Hello, " + name + "!";
                }
            }
            "@
            
            # Use the C# method from PowerShell
            $result = [HelloWorld]::SayHello("PIEBALDconsult")
            Write-Output $result
            

            “I fear not the man who has practised 10,000 kicks once, but I fear the man who has practised one kick 10,000 times.” - Bruce Lee.

            P 1 Reply Last reply
            1
            • Graeme_GrantG Graeme_Grant

              @PIEBALDconsult said in Microsoft has caused me sooo much trouble over the years due to a bad piece of documentation:

              The first time I used PowerShell, it was because someone gave me a script to demonstrate the use of an API for some third-party software. Once I confirmed that it worked, I rewrote it in C# -- which meant I had a lot more control.

              You can use C# directly in a powershell script!

              Add-Type -TypeDefinition @"
              public class HelloWorld {
                  public static string SayHello(string name) {
                      return "Hello, " + name + "!";
                  }
              }
              "@
              
              # Use the C# method from PowerShell
              $result = [HelloWorld]::SayHello("PIEBALDconsult")
              Write-Output $result
              
              P Offline
              P Offline
              PIEBALDconsult
              wrote last edited by
              #8

              That is interesting. I'll have to try it.

              I had a boss who favored Python* (over C#) because you deploy the source code (to a server or other remote system) rather than a compiled executable (a point of view I understand, but disagree with).

              I have/had an idea of writing a framework which would run on a remote system and compile C# code which has been deployed to it in an as-needed basis. Now what you tell me is that PowerShell already does that, so I'm glad I didn't waste my time working on it.

              • He is one of many people I have encountered who think Python can do anything all on its own, without acknowledging that Python often relies on packages written in other (better / more powerful) general purpose languages. Which is one of its strengths, as a glue language.
              Graeme_GrantG 1 Reply Last reply
              0
              • P PIEBALDconsult

                That is interesting. I'll have to try it.

                I had a boss who favored Python* (over C#) because you deploy the source code (to a server or other remote system) rather than a compiled executable (a point of view I understand, but disagree with).

                I have/had an idea of writing a framework which would run on a remote system and compile C# code which has been deployed to it in an as-needed basis. Now what you tell me is that PowerShell already does that, so I'm glad I didn't waste my time working on it.

                • He is one of many people I have encountered who think Python can do anything all on its own, without acknowledging that Python often relies on packages written in other (better / more powerful) general purpose languages. Which is one of its strengths, as a glue language.
                Graeme_GrantG Online
                Graeme_GrantG Online
                Graeme_Grant
                wrote last edited by Graeme_Grant
                #9

                @PIEBALDconsult said in Microsoft has caused me sooo much trouble over the years due to a bad piece of documentation:

                I had a boss who favored Python* (over C#) because you deploy the source code (to a server or other remote system) rather than a compiled executable (a point of view I understand, but disagree with).

                Have you seen the new support for C# apps that run with the coming DotNet tool? No projects just C# with 'dotnet run' - This should blow your boss' mind. C# can do what Python can do...

                “I fear not the man who has practised 10,000 kicks once, but I fear the man who has practised one kick 10,000 times.” - Bruce Lee.

                P 1 Reply Last reply
                0
                • A Afzaal Ahmad Zeeshan

                  I never liked CMD or PowerShell; the only terminals that made sense were from the Linux environments — bash, etc. However, the Windows Terminal did bring me a little closer to the terminal world on Windows. Otherwise, I prefer to use Linux when I must use a terminal.

                  Right tool for the right job. :)

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote last edited by
                  #10

                  Well, neither Windows nor Linux is the right tool, but they're what's currently popular.

                  1 Reply Last reply
                  0
                  • Graeme_GrantG Graeme_Grant

                    @PIEBALDconsult said in Microsoft has caused me sooo much trouble over the years due to a bad piece of documentation:

                    I had a boss who favored Python* (over C#) because you deploy the source code (to a server or other remote system) rather than a compiled executable (a point of view I understand, but disagree with).

                    Have you seen the new support for C# apps that run with the coming DotNet tool? No projects just C# with 'dotnet run' - This should blow your boss' mind. C# can do what Python can do...

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote last edited by PIEBALDconsult
                    #11

                    Hadn't heard of it. I like compiling and deploying executables. But I'll give it a look.

                    Edit: I just tried it with my work laptop and I was unsuccessful. I'll have to try it at home. It's probably not something I'd use anyway.

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      jawadulhassan1810
                      wrote last edited by
                      #12
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jawadulhassan1810
                        wrote last edited by
                        #13

                        Yeah, Microsoft’s documentation can definitely be confusing at times. Good catch on the difference between &, &&, and ||—a lot of people miss how cmd.exe actually treats return codes. Thanks for breaking it down so clearly!

                        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