Jump to content

Should I Make My Script In Batch or PowerShell

I am making a new script for debloating Windows 10, I am into debloating Windows. Is there any advantage to using one over the other. My past scripts was written in PowerShell, but does Batch offer anything.

 

Link to comment
Share on other sites

Link to post
Share on other sites

yeah, your right

 

my past scripts were written in PowerShell, and I know PowerShell pretty well. Just wondering if batch had anything to offer, but no it has nothing to offer.

Link to comment
Share on other sites

Link to post
Share on other sites

Powershell is far more powerful than batch.

Not English-speaking person, sorry, I'll make mistakes. If you're kind, maybe you'll be able to understand.

If you're really kind, you'll nicely point that out so I will learn more about write in good English.  🙂

Link to comment
Share on other sites

Link to post
Share on other sites

On 9/10/2023 at 5:48 AM, MrBignose5866 said:

I am making a new script for debloating Windows 10, I am into debloating Windows. Is there any advantage to using one over the other. My past scripts was written in PowerShell, but does Batch offer anything.

 

Truthfully, you are better off using PowerShell on Windows.

Bash (among other shells) are more common on Linux environments.

 

"X is far more powerful than Y"  -  is nonsense like : "Boots are better than Shoes"

It pretty much depends on your skill, a tool can offer as much as your skill set.

 

It depends

 

Edit: I misread the word, but I will leave my post as is 😃

Link to comment
Share on other sites

Link to post
Share on other sites

Quote

Bash (among other shells) are more common on Linux environments.

Unclear if you are just bringing up Bash as another popular scripting option (and I suppose maybe a weird possibility with WSL) or if you misunderstood because batch and bash are similar words, but the OP is talking Windows batch scripting, which is unrelated to Bash. 

 

Quote

Just wondering if batch had anything to offer, but no it has nothing to offer.

It has significantly better predictability (don't need to worry about interpreter versions) and backwards compatibility. Sometimes in enterprise environments you need to write a script that will work on computers that might not have PS or might have the wrong PS version etc. *cough DOS* Batch script can be lighter and the interpreter significantly lighter than PS. In most cases, PS is a much better choice, but that doesn't mean batch has nothing to offer/ is never the right choice.

For your specific example, if you want to make your debloater be able to work on systems that have PS disabled, than PS is obviously the wrong choice (Or if you wanted to also support older versions of Windows [95/98/ME/2000]).  Not much but something🤷‍♂️

Link to comment
Share on other sites

Link to post
Share on other sites

Everything I would say is "it depends"

 

There are some things that I think creating bat files are just more beneficial.  The ease and quickness that you can quickly see a simple bat and know what approx it is doing.

 

The other thing is that bat files will run on pretty much any computer; where as ps you can't just "run" it without having to put in a longer cmd prompt (at work I would use a prompt to launch all my ps scripts).

 

Don't get me wrong, ps is a great tool and if you are familiar with it then might as well keep using it over bat....but I do think that bat files are greatly overlooked

 

One thing I still use them commonly for is anything that needs parsing of files...like I could do something like

 

ffmpeg -i %1 [additional params] d:\temp\output.mp4

 

and just drag a file onto the bat and have it create my desired file.  Quick and simple...in PS it wouldn't be as simple as this kind of one liner

3735928559 - Beware of the dead beef

Link to comment
Share on other sites

Link to post
Share on other sites

21 hours ago, WWicket said:

Unclear if you are just bringing up Bash as another popular scripting option (and I suppose maybe a weird possibility with WSL) or if you misunderstood because batch and bash are similar words, but the OP is talking Windows batch scripting, which is unrelated to Bash.

I absolutely misread the word! I thought we were talking about Bash or PowerShell (since if I recall correctly, there's a way to run Bash on Windows)

 

Shame on me hehe 😅

Link to comment
Share on other sites

Link to post
Share on other sites

On 9/10/2023 at 9:48 PM, MrBignose5866 said:

I am making a new script for debloating Windows 10, I am into debloating Windows. Is there any advantage to using one over the other. My past scripts was written in PowerShell, but does Batch offer anything.

 

Both can do almost the same stuff with the right privileges. Although this is the case I believe ps is more powerful in terms of predefined commands and better module support.

If this is going to be something that is user friendly, I would write a bat for invoking UAC and Admin to then start the ps process where you can define your actual logic.

Edit: Also check out some other Windows Debloat Tools that are available on GitHub, this can give you an idea on what the majority uses for what reasons by looking through their past issues where they discuss about their findings and this will also give you some extra things you might have not known that you can add to your de-bloater script.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×