Category filter

Script to Create Files and Folders on Windows devices

It is simple to create a file or folder on a device. However, creating files and folders on a large number of devices in a specified location becomes a time-consuming task. Hence, you can simplify this process on Windows devices by deploying custom scripts from Hexnode.

Note:


Supported Versions:

The scripts given below will be supported on the following versions:

  • Windows 10 v1607+ (Pro, Enterprise, Education)
  • Windows 11 (Pro, Enterprise, Education)


Disclaimer:

The sample scripts provided below are adapted from third-party open-source sites.

Create Files

Batch Script

Create a file after checking whether it already exists

Replace ‘filename‘ with a file name of your choice and make sure the file extension is the same throughout the script. Provide the path where you want the file to be created.

PowerShell Script

Create a file after checking whether it already exists

Replace ‘pc‘ with a file name of your choice and make sure the file extension is the same throughout the script. Provide the path where you want the file to be created.

Create Folders

Batch Script

PowerShell Script

Replace ‘test’ with a folder name of your choice and provide the path where you want the folder to be created.

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.

  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

Sample Script Repository