Link to home
Start Free TrialLog in
Avatar of RIAS
RIASFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Commands in Powershell

Hi, 

How to run this command in PowerShell script: 

cd %Pricing_Home%\builds\buildscripts

build FirstTimeDevSetup

debug build 

register.bat


Thanks

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RIAS

ASKER

Thanks a lot! will try and brb. I am trying to create a PS script for all the queries raised above.
Avatar of RIAS

ASKER

Hi,
The error I am having is
the term 'build' is not recognised. Same for Debug, register.bat
Any suggestions? Thanks
Avatar of oBdA
oBdA

Well, where and what exactly is "build" (and "debug")?
If they're in the path, and not in the current folder, you need to remove the ".\" at the beginning.
Note that for security reasons, PowerShell will not start programs in the current directory unless they are explicitly prefixed with ".\".
And as I said before, do yourself and maybe others having to update the script the favor and add the actual extension to those files.
Avatar of RIAS

ASKER

The Pricing_Home path is set like C:\abc\Dev\. Ok, thanks will try to amend it and get back.
Avatar of RIAS

ASKER

Got an registry error
Avatar of RIAS

ASKER

Error accessing the registry.
Avatar of RIAS

ASKER

I think it needs the admin rights. Any suggestions? 
Avatar of RIAS

ASKER

Yes all the commands require admin 
Avatar of RIAS

ASKER

The script I modified looks like :

Set-Location -Path "${env:Pricing_Home}builds\buildscripts"
& .\build FirstTimeDevSetup
& .\debug build 
& .\register.bat

Open in new window

Avatar of RIAS

ASKER

How can I add the admin logon screen to enter admin credentials?
Thanks
Same as before: start the PS console elevated, or use the auto-elevating script from your other questions, for example from the msixml.
Just swap the msiexec part for the build script.
Avatar of RIAS

ASKER

ok, thanks will do so.
Raising a new question: 
Avatar of RIAS

ASKER

Also to answer your question
Well, where and what exactly is "build" (and "debug")?
They are .bat files in the folder: Set-Location -Path "${env:Pricing_Home}builds\buildscripts

However, it is failing. Trying to work on the syntax
On closer inspection, you dropped the backslash after the closing curly brace in "${env:Pricing_Home}".
That should be
Set-Location -Path "${env:Pricing_Home}\builds\buildscripts"

Open in new window

Avatar of RIAS

ASKER

The reason was because the Pricing_Home path is set like C:\abc\Dev\
So still not sure why it is failing
Avatar of RIAS

ASKER

We need to wait till each of .bat executes fully.  Any suggestions as that can possibly be why it is failing.
Thank you once again.
Avatar of RIAS

ASKER

I have made seperate scripts for all three commands. Just testing it. Your earlier scripts are teaching me.
Thanks
Avatar of RIAS

ASKER

All sorted now. Thanks