0

I am using Amazon Web Service Powershell extension. I have multiple commands I want to run after each other like this:

PS C:\g> Write-S3Object -BucketName "user-staging" -Key "index.html" -File "index.html"
PS C:\g> Write-S3Object -BucketName 'user-staging' -KeyPrefix 'lib/pagedown' -Folder 'lib/pagedown' -SearchPattern '*.js'

How can I combine these into a macro, batch file or something similar so I can run them all just with one simple command such as:

PS C:\g> publish-files
Anthony Neace
  • 25,013
  • 7
  • 114
  • 129
Samantha J T Star
  • 30,952
  • 84
  • 245
  • 427
  • Put them together in a batch file and make an alias for running them. – TJ- Dec 31 '14 at 10:31
  • TJ - can you explain more. I did try putting it all into an abc.bat file but then when I tried to run it from within powershell I think I recall it gave some strange errors. At the time I thought I was doing it wrong. – Samantha J T Star Dec 31 '14 at 10:43
  • What were the errors? – TJ- Dec 31 '14 at 10:49

1 Answers1

2

You need to create a PowerShell script file. Basically the same as a batch file, but with a .ps1 extension.