Converting an old Batch command to Powershell

Welcome Forums General PowerShell Q&A Converting an old Batch command to Powershell

Viewing 1 reply thread
  • Author
    Posts
    • #242114
      Participant
      Topics: 1
      Replies: 0
      Points: -9
      Rank: Member

      Hi there,

      This is kind of a 2 part question, so I’ll start with the first one. Is there a way to convert this Batch command to Powershell?

      set /P “ClientNo=Enter Client Number:”

      echo C:\Data\Hosted\Company%ClientNo%\Profiles\

      igrant.exe -r -f -usepriv mydomain\Admin:Full C:\Data\Hosted\Company%ClientNo%\Profiles\

      pause

      Thank you

    • #242123
      Participant
      Topics: 5
      Replies: 2413
      Points: 6,202
      Helping Hand
      Rank: Community MVP

      Nick, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

      When you post code, error messages, sample data or console output format it as code, please.
      In the “Text” view you can use the code tags “CODE“, in the “Visual” view you can use the format template “Preformatted“. You can go back edit your post and fix the formatting – you don’t have to create a new one.
      Thanks in advance.

      This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

      You should read the help including the examples for Read-Host. That’s the cmdlet we use to ask for user input in Powershell. When you safe the output of Read-Host to a variable – lets say with the name $ClientNo you just have to change the variable name in your command line an it should work.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.