Pinterest Stumbleupon Whatsapp

For a beginner, getting into scripting can be very intimidating. However, there are some major benefits to using scripts on your Windows 10 PC. If you’re just getting started, using Windows scripts written by others can often give you a good idea of how things work.

To learn scripting step-by-step, take a look at the simple Windows scripts featured in this article, and go from there. Figure out how they work. Think about how you might tweak them for yourself. Once you’re comfortable with what a script is, you can think about diving into the nitty-gritty of coding.

Scripting With PowerShell

Many Windows users know PowerShell as a command line interface 15 Advanced Tasks PowerShell Can Handle in Windows 10 15 Advanced Tasks PowerShell Can Handle in Windows 10 PowerShell is similar to the command prompt, but better. It's a powerful system administration tool. We have compiled 15 tasks, some simple, some complex, that benefit from the magic of PowerShell. Read More . However, we can also use PowerShell commands to create a script that we can call upon at a later date.

1. Shut Down Your Computer

You can shut down How to Shut Down Windows 10 Using Only Your Voice How to Shut Down Windows 10 Using Only Your Voice Want to teach Cortana some new tricks? Here's how to make her shut down, restart, or log off Windows for you. Read More a Windows 10 PC with just a couple of clicks, but is that fast enough? By implementing a PowerShell script, we can place a shut down button anywhere on our desktop. Furthermore, we can learn how to make a script shortcut at the same time.

Open up Notepad and type out the following:

shutdown -s -t 0

Next, click File > Save As.


Name the file shutdown.cmd and use the Save as type dropdown to select All Files. Run this file with administrator privileges, and your PC will shut down instantly.

By tweaking this script slightly, we can schedule a restart on a timer. To do so, make the following edit to your .cmd file:

shutdown -r -t 60

The above will make your PC restart after a period of 60 seconds has elapsed. The -r in place of the -s we used above prompts the restart, while the -t tag stipulates the time. Feel free to tweak the integer to set a different span of time.

2. Remove Pre-Installed Windows 10 Apps

There are many benefits to installing Windows 10, but it’s fair to say that the operating system (OS) comes packaged with several apps that qualify as bloatware Tired of Bloatware? How to Purge Windows 10 Store Apps Tired of Bloatware? How to Purge Windows 10 Store Apps For Microsoft, Windows 10 is a cash machine. With future updates, more apps will be pre-installed and promoted on the Start Menu. Let us show you how to easily remove pre-installed Windows Store apps. Read More . Rather than removing each of these pieces of software manually, we can set up a script that does the job for us.

Before you use this technique to get rid of any apps from your user account, consider the consequences. Many programs and services do important work behind the scenes, so don’t be flippant about what you remove.

Open up a PowerShell window as an administrator and use this command to remove a particular app:

get-appxpackage -name *APPNAME* | remove-appxpackage

You’ll need to find the name that Windows uses to refer to each individual app and insert it in place of APPNAME. For instance, this command would remove three commonly unwanted programs:

get-appxpackage -name *BingFinance* | remove-appxpackage
get-appxpackage -name *BingNews* | remove-appxpackage
get-appxpackage -name *BingSports* | remove-appxpackage

If you’re in charge of setting up an entire fleet of computers, this can really speed up the process. Simply figure out which apps you want to remove, write up a script that gets rid of the lot, and run it on each PC.

3. Rename a Batch of Files

So you’ve just uploaded an album of photographs to your computer? And they’re all labelled with whatever naming convention your camera uses by default? Wouldn’t it be handy if you could attach a keyword that you can search for at a later date?

A simple PowerShell script can do just that. Enter the following to rename files en masse:

$path = "$home\desktop\make use of\holidaysnaps"
$filter = '*.jpg'

get-childitem -path $path -filter $filter | 
 rename-item -newname {$ -replace 'IMG','HOLIDAY2016'}

There are a few things to tweak before you run this script. First, adjust the path so it points toward the desired folder. Check which format your images are in, and change the file type in the second line if necessary. Finally, replace “IMG” in the last line with the text you want to replace, and “HOLIDAY2016” with the text you want to sub in.

If you upload images to your PC on a regular basis, it’s worth saving this command as a CMD file, as explained above. When you need to use it again, open the file with Notepad 8 Surprising Windows Notepad Tricks You Must Know 8 Surprising Windows Notepad Tricks You Must Know The inconspicuous Windows Notepad is full of surprises. You'll want to keep this ancient Windows program handy at all times after we showed you some of the tricks it can do. Read More , update it for the task at hand, then run it.

However, use caution when you’re working with a script like this one. It doesn’t take long for the command to rename every single file in a folder — and that can cause big problems if it’s pointed toward the wrong directory.

Scripting With AutoHotKey

We can do a lot with PowerShell — but it’s not the only tool available to Windows users who are interested in writing their own scripts. AutoHotKey is one of several third-party programs that you can use to create custom scripts that go beyond the limits of the tools that come packaged with Windows 10.

Before we start putting together any handy AutoHotKey scripts, you need to download the software here. Install the package and then open up the program. To start working on a new script, simply right-click your desktop and select New > AutoHotKey Script. Rename the file, then open it up with Notepad or a similar text editor.

4. Open a Folder in an Instant

We all have folders that we return to on a regular basis. Sometimes it’s convenient enough to place them on our desktop, but sometimes it would be even better if we could enter a keyboard shortcut 12+ Custom Windows Keyboard Shortcuts for the Geek in You 12+ Custom Windows Keyboard Shortcuts for the Geek in You Windows includes hundreds of keyboard shortcuts, but you can create your own shortcuts to nearly anything you'd like. Here's how to customize your Windows shortcuts. Read More to open it up while we’re working on a separate task.

AutoHotKey allows you to set up a custom shortcut for any location on your computer. To do so, create a script that contains the following code:

#^d::Run "C://Users/Brad/Downloads"

To get this code to work, you’ll need to replace “Brad” with your own Windows username. If you’re new to AutoHotKey and that script looks like gibberish, don’t fret — it’s more straightforward than you might think.

The first part of the text stipulates the button combination that the user will need to use to execute the script, in our case the Windows key (#), the Shift key (^), and the D key. This shortcut is linked to the Run command we’re trying to execute by a pair of colons.

5. Take Control of Your Virtual Desktops

Windows 10 introduced virtual desktops 5 Ways to Improve Virtual Desktops in Windows 10 5 Ways to Improve Virtual Desktops in Windows 10 Virtual Desktops can help you expand and organize your desktop. Here we show you how to improve and productively use Windows 10's Task View feature. Read More , a useful way of setting up distinct environments for different tasks. This functionality makes it easy to organize your workspace. However, switching between different desktops can be a little more unwieldy than a simple Alt-Tab.

Fortunately, there’s an AutoHotKey script that allows you to immediately transfer to a different desktop using a simple keyboard shortcut. It also makes it easy to create and delete desktops as required. The code and an explanation of how the script works is available via GitHub.

6. Get System-Wide Autocorrect Functionality

Autocorrect isn’t perfect, but it can be very handy if you’re prone to the occasional spelling mistake. Some mobile operating systems like iOS deliver autocorrect functionality no matter what app you’re using. You can get the same assistance on PC by implementing an AutoHotKey script.

You can grab a pre-built version of the script over at HowToGeek. However, it’s well worth customizing the code to calibrate it for your usage. For instance, if you regularly use slang words, you’ll want to make sure they don’t get corrected erroneously.

7. Make Sure Sentences Start With a Capital Letter

If system-wide autocorrect seems too drastic, you might be better off with this tweak that counteracts a common typing error. Proper capitalization is a must if you want your writing to look professional, and you can use AutoHotKey to double-check your work for mistakes.

You can find the necessary code on the AutoHotKey forum. The script makes sure that any period, question mark, or explanation mark will be followed by a capital letter.

Next Steps in Scripting

The internet gives us access to a whole host of scripts 10+ Cool AutoHotkey Scripts & How to Make Your Own 10+ Cool AutoHotkey Scripts & How to Make Your Own AutoHotkey is an easy way to add shortcuts to your computer. You can download ready-to-use scripts or write your own. We show you to become more productive with automated hotkey tasks. Read More developed by others that we can pick and choose from. That’s great, but the most useful scripts are often the ones you create for yourself.

The scripts in this article perform tasks that don’t require your oversight. These tasks will vary from user to user. A working knowledge of how scripts work is the first step towards making scripts that are tailored to your own usage.

Scripts you find online can certainly save you time and effort. However, if you take the time to really get to grips with tools like PowerShell and AutoHotKey, you might be surprised by what you can come up with.

Do you have another Windows script that you want to share with other users? Why not join the conversation in the comments section below?

Leave a Reply

Your email address will not be published. Required fields are marked *