Can't create shell script with CD and execute command

Igor Koltun 1 Reputation point
2021-04-29T22:15:22.557+00:00

I am trying to create automatic running scripts for developers on Windows(execute one command ./update instead running 5-6 commands in different folders)
CLI is Powershell (Windows Terminal on Windows 10 Pro)

Example command for linux that works on linux machine:
cd $PWD/angular && npm install
cd $PWD/angular && ng build
cd $PWD/react && npm install
cd $PWD/react && ng build

Example command for Windows that wont work:
cd $PWD/angular && npm install
cd $PWD/angular | npm install
cd angular && npm install

Getting an error "The system cannot find the path specified."

Please don't recommend me use WSL2 and other due to this is not my resolving.

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2021-04-30T02:13:02.62+00:00

    Hi,

    Does the specified path exist? You can check it by running Test-Path $PWD/angular and see if "True" is returned.

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Igor Koltun 1 Reputation point
    2021-04-30T07:05:17.077+00:00

    PS C:\Server\apps\study-space> Test-Path $PWD/backend/client-apps
    True

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.