Converting an old Batch command to Powershell

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</strong>

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


Thank you

Nick, welcome to 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.