Since people are curious Ill explain why:

I need to build our project from the remote repo using a PowerShell script (.ps1). I’m using Bash in the VSCode terminal, I have to run the .ps1 script in a new Command Prompt because the compilation takes around 5 minutes and I need my terminal for other things. To do this, the only way is to run a batch file that executes the .ps1 script.

Its an automation so I dont need to touch powershell whatsover and remain in bash terminal. Instead of opening several windows, I automated all so it only takes 1 alias to compile my shit.

The compilation also requires several inputs and “Key Presses”, so I automated all of that in the Batch file.

87 points
*

That sounds like you don’t know what you’re doing. No offense.

permalink
report
reply
13 points

Fuck man, I don’t know what I’m going either.

permalink
report
parent
reply
4 points

Damn autocorrect…

permalink
report
parent
reply
-2 points
Deleted by creator
permalink
report
parent
reply
54 points

That doesn’t make any sense. Why not just use PowerShell directly then? Why use Bash or even command line and a batch file? It sounds to me like you’re over-complicating things for nothing and putting the blame on Microsoft for some reason.

I’m a heavy Bash user myself and often find myself struggling a bit with PowerShell trying to look for equivalent commands. (commandlets?) But, the more I use it, the more I understand how it works and the more I improve my skills at using it.

I know a lot of people like to shit on Microsoft, but seriously give their PowerShell a chance. It has its strengths. It’s especially nice with Oh My Posh running in Windows Terminal.

permalink
report
parent
reply
2 points

Since you added a question mark, commands is the correct general term. However there are two types that can be a command. Functions: which are written in pure powershell and cmdlets: which are commands provided by dotnet classes. (Also exes and a bunch of other stuff common to other shells can be a command, but that’s not important.)

The reason they have different names is early on functions didn’t support some of the features available to cmdlets, such as pipeline input. There was later a way to add this support to functions.

In practice call them any of the 3 and people will know that you mean.

permalink
report
parent
reply

I have to run the .ps1 script in a new Command Prompt because the compilation takes a few minutes

I don’t follow this reasoning. Is it because you don’t want to take over the VSCode terminal with a long command? Couldn’t you can open multiple tabs, or run in the background, or use screen/tmux, etc.?

permalink
report
parent
reply
-3 points
*

Yeah I use my terminal to run other things, as it stays compiling for around 5-6 min. I could open another tab like you mention but Instead I automated all so it only takes 1 alias (ex cc) to compile my shit.

The compilation also requires several inputs and “Key Presses”, so I automated all of that in the Batch file.

permalink
report
parent
reply
2 points

Ich verstehe. Ich würde aber auch einfach nicht Fenster benutzen lül

permalink
report
parent
reply
2 points

lach

permalink
report
parent
reply
44 points

Please explain why you don’t open powershell and run cmd.exe instead of running bash? This is a strange workaround and doesn’t really make sense.

permalink
report
reply
-6 points
*
Deleted by creator
permalink
report
parent
reply
15 points

Why not just launch it directly but background the process so it doesn’t hang up your terminal?

permalink
report
parent
reply
15 points

Why not just open another terminal in VSCode?

You can open as many as you want, and as many types as you want. Bash, PowerShell, Command Prompt… there’s zero need to chain multiple just to keep your main one free.

permalink
report
parent
reply
40 points

Command prompt is CMD and batch script, Powershell is Pwsh and .ps1, then bash is .sh.

You’ve confused a few things here…

FYI, open a powershell terminal separately, to the path of your script (powershell in file Explorer path) and run your script.

Do rest of Work in Vscode

Done.

permalink
report
reply
2 points

I use Ansible on WSL to run Powershell scripts on Windows using VSCode. I’m surprised it works as well as it does.

permalink
report
parent
reply
4 points

You use Linux to run Ansible to run ps1 on Windows, exactly how it’s meant to be used!

permalink
report
parent
reply

U can probably add a couple more layers by sshing into a vm

permalink
report
reply
12 points
*

Don’t forget to run some docker container on that VM, to encapsulate the workload, so it will be: SSH to VM -> open a shell into the container -> run the rest

permalink
report
parent
reply
8 points

Got to at least wrap it up in some python.

permalink
report
parent
reply

Good idea perhaps we can route over tor as well just to maximise latency

permalink
report
parent
reply
22 points

My work someone made a robust automated build script, and they left so someone else made a wrapper around it to make it easier to work with, they’re gone now and someone wrote a wrapper around that to extend functionality in a backwards compatible way, but it’s overly complicated for my minimal use cases so I wrote a batch file to call it with my default settings…

permalink
report
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 6.8K

    Monthly active users

  • 1.4K

    Posts

  • 32K

    Comments