Windows Batch





Batch files are text files containing a script of commands that are executed by the command interpreter on DOS, OS/2 and Windows systems. Most commonly, they are used to perform a series of functions that are repeated -- copying a set of files created daily with one step, for example.

Share tech news, updates, or what's on your mind.

Sign up to Post

Hi Experts,

We have windows server 2008 along with multipal users they have only remote desktop rights & i dont want assign administrator rights,

but a there is a software which need administrator rights (run as administrator) permission to execute from users, we had manage till startup time manually to run as a administrator with password but now there is more than 50 users that's why i can't manage manually.

I need a batch file which have store administrator password, I'll paste that batch to every user Desktop & locate the software path to in batch file run as administrator.

Path Example :-
for user1

for user2

for user3

for user4

for user5

for user6
Cloud Class® Course: Amazon Web Services - Basic
LVL 12
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

I want to automate the file transfer.
FTP Client : Reflection FTP Client
SFTP Server : Tectia SFTP Server.
I tried using similar to winscp scripts powershell but it didnt work.
Can someone help me providing the script which will work to transfer file to sftp server running script.
Authentication method is public key + password authentication and password must be encrypted.
Hi All,

I have .txt  files in FileZilla server. I need to transfer files from FileZilla server to Local Path C:\, Below is the code i am running in job schedule,

lcd C:\
open 22
cd /In
mput *.txt

When i run the above code batch files is getting executed but files are not genearting in Local Path C:\. Please help me in transferring files from fileZilla Server to local path C:\.

Thank You In advance....
How to check audio glitches while running video with batch script or powershell?

While running video i have to run that script so that it could recognize any glitches while running audio.

Thanks in advance
I am looking for a SIMPLE PDF to CSV converter.

I have found many that use fancy GUI's but I am looking for a converter that is controlled by COMMAND LINE.

The reason for this is I want to be able to create a BATCH file that my customer can run with one click.  I don't want my customers to have to learn a GUI, which would complicate matters and introduce more steps in the process,
How to wake a system from sleep with batch command?

Only I need command which will wake a system from sleep, without interrupting any button manually.

I have some reports (MS excel Spreadsheets) on my folder on C drive. I have created a module in MS Access 2013 database. This module can be called using AutoExec macro. Basically I have created some scripts which will run a query and export the result into different excel files and then do the formatting. I need to transfer those excel files into SharePoint on daily basis. SharePoint is password protected. I am trying to automate the process. I use windows 7 OS, Office 2013. I am looking for a vba code/scrip or MS DOS/batch to do this work for me.

On SharePoint, there are some files already exist. I don't want to delete those files while I run script to transfer my reports into SharePoint.

Any support on this would be greatly appreciated.

Hello Experts,

we have backup in e:\data\

I want take backup on daily base from e:\data\<current date .zip> to two drives

g:\ace\<create current date folder>\

k:\rule\<create current date folder>\

Please suggest this process how to done from batch script, after complete this task log (.txt or .csv) should be generated ?
I'd like to have a command line solution, maybe python, but am open to other solutions/utilities.

Frequently, I manually download an excel file from a webpage. It requires me to first logon.

Hovering my mouse over the link doesn't show anything, i.e. to give a clue to the link.
Picking the link opens another page.
The page's link address is:
Then, a dialog pops up asking to download the file w/ OK prompt.

If possible, I'd like to run this as a scheduled task.
Hi all,

       Working on a project to automate Intel ME Firmware update for a security project. Currently, using the following process:

Adjusting the below script for each model/site:
Downloading the correct patches for the model
Placing patches on server and using a .bat file to execute
Running the below script against the model(s)
While this is faster than doing each computer manually, it still takes a long time to execute each script against each model across multiple sites.

What I'm hoping to do is figure out how to incorporate if/else logic in the below scripts such that I can run the script against a massive list of computers of different models.

Also, would like to figure out how to have the script grab the .bat files from say Dropbox or the like so I don't have to go into each site specific server and have the script run against that location.

I have the following template:

$model = (Get-Ciminstance -ClassName Win32_ComputerSystem).model

    model1 {<#code to download bat1 from dropbox#>;Start-Process "dropboxurl\folder\file1.bat"}
    model2 {<#code to download bat2 from dropbox#>;Start-Process "dropboxurl\folder\file2.bat"}
    model3 {<#code to download bat3 from dropbox#>;Start-Process "dropboxurl\folder\file3.bat"}
    default { write-warning "Model '$model' was unexpected - No action taken"}

Open in new window

And I've adjusted to reflect as follows:

$model = (Get-Ciminstance -ClassName Win32_ComputerSystem).model

    "HP EliteDesk 800 G1 DM" { info/more info ;Start-Process ""}
    default { write-warning "Model '$model' was unexpected - No action taken"}

Open in new window

Should I have it set with the specific model name or does the switch not care?

i.e. do I need to adjust the script to point to an actual model like I have in my second example or can it just be model 1 points to the dropbox url?

Running the script doesn't give an errors except:

WARNING: Model 'Virtual Machine' was unexpected - No action taken

Does anyone have experience with this type of template and using it in the manner I am trying.
Cloud Class® Course: Microsoft Azure 2017
LVL 12
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

We run Microsoft Dynamics AX 2012. We have Remote Desktop Servers which users access, to access AX.

I'd like a PS script or bat file that I can run once a week, at midnight, to delete *.AUC and *.KTI files from all the users C:\users\%users%\appdata\local   folder on these RDS machines.

I've tried
for /D %D in ("C:\USERS\*") do del "%~fD\AppData\Local\*.auc"
for /D %D in ("C:\USERS\*") do del "%~fD\AppData\Local\*.kti"

Which Errors out:
The following usage of the path operator in batch-parameter substitution is invalid: "%~fD\AppData\Local\*.auc"

Also tried:
del "%userprofile%\AppData\Local\*.auc"
del "%userprofile%\AppData\Local\*.kti"

But that only delete the files for the current user.

IS there any batch file to send email. A basic email through batch file

We mapped a share drive with both .bat and Preferences on group policy. We also hide these folders, everything is working fine for users on Windows 7 but they are not able to see or map the folder on Windows 10, so what would be an issue with 10. Is there anything need to be checked?

How do I use Task Scheduler in Windows to execute a shell script file (.sh extension)?
If cannot use Task Scheduler, how to create a crobjob that execute a shell script file (.sh extension) in Windows?
Hi Experts,
How to create multipal users along with password & assign to remote desktop group in Windows server 2008 & 2012 from batch file ?

Can I have script to clear google chrome browser history.

I have tried other scripts also but these are deleting bookmark also.
moreover I need help push this script to user though gpo.
Hello, I need to disable batch file execution in RDP (Windows 2012 r2) session for a regular user. Administrators should be able to run batch scripts. If GPO "Prevent access to the command prompt" is enabled and "Disable the command prompt script processing also?" set to "Yes" then batch files cannot be executed but login script cannot run as well.

Also, GPO has a note:
"Note: Do not prevent the computer from running batch files
if the computer uses logon, logoff, startup, or shutdown
batch file scripts, or for users that use Remote Desktop Services."

If this option set to "No" then login script can be executed but command prompt can be opened by executing a batch file with following content:
@echo off
set /p cmd="%cd%> " 
goto loop  

thank you.
I am trying to create a task (in task scheduler) to execute a vbscript file. Task Scheduler successfully completed but the vbs script is not creating task file. But when I manually run the .vbs task file is create.

@echo off
cscript //nologo c:\xxxx.vbs

Task Scheduler successfully completed task "\xxxx" , instance
"{355a1874-adfa-499d-bee7-25e3d4e2b7db}" , action
 "C:\Windows\System32\cscript.exe" with return code 0.
So I am in the middle of changing a scheduled tasks account that it runs under as the current ones password is changed monthly.
I have added the account to the same groups for permissions as the previous account.

The basics of the script are:
Connect to FTP
Download files
Rename files
Move files
Archive files

Now when i run a test on the script it is for some reason it was unable to see the txt file that connects to the FTP account, i have to edit the command to point the script to the full path location "C:\tempfiles\ftpscript.txt" instead of it previously using "\ftpscript.txt", then it is also downloading the files into my documents and not the directory that it was downloading to before "C:\tempfiles"

It is as if the cmd prompt looks to different locations when run under those different accounts? I am not sure why it is now downloading in that location when it ran fine before. I think the only difference between the 2 accounts are that the previous account was the built in domain admin account and this is a new account we created which is also a domain admin account.

Script below:

:: Download all files via WINSCP
"C:\Program Files (x86)\WinSCP\" /script=ftpscript.txt

:: Rename files
cd: "c:\tempfiles"
ren p3de* "temp file1"
ren p3tr* "temp file2"

:: Move files

::Archive files
MOVE "C:\Tempfiles\*.* "C:\tempfiles\archive"

Now so far i have amended the download command to …
Introducing Cloud Class® training courses
LVL 12
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

How to call Powershell script ps1 file by installshiled 2009.

I have file ps1 script file and I need to call or execute that file by installer.By the cmd  code I execute that file by Launchapp method of installer.Please see the image Code image.

But i get the error.Please see the image  Error.
I want to use a runas script to launch rdsman.exe and the open the corresponding rdg file
Goal: a batch to delete certain words from a file and replace it with a few empty spaces

Below is a sample line in the input file...
|cffaaffaaTicket|r:|cffaaccff 3.|r |cff00ff00Creator|r:|cff00ccff Test|r |cff00ff00Created|r:|cff00ccff 10s ago|r 

Open in new window

Would need to delete "|cffaaffaa" "|r:|cffaaccff" "|r |cff00ff00" "|r:|cff00ccff" "|r |cff00ff00" "|r:|cff00ccff "

So in the end, it should look like this ideally...

Ticket 3   Creator Test   Created 10s ago   

Open in new window

This will be used in various input files, so that input example will change.  But I would like to simply edit the "text to remove" in the script.  
I tried several solutions I found online, they all either fail (maybe because of the pipe character) or are designed to delete the whole line of data not just the words

Thank you in advance
Hello Experts ,
is there a batch or VB script to copy a specified DLL from a local machine to a remote machine and register it with psexec ?
if the remote machine name could be given by the user who will run the script will be great ( strinput )
also if the script can be ran without the need to enter credentials , the user who will run the script have enough access .
very appricated .
We have some upgraded going on some of our web severs.
Till that time we need check many urls manually daily.

I want to write a vb script to check urls if it is up or not and send us status report through mail.

urls address start with https:// and we need to use F5 Token and disable proxy setting to connect those server.

we don't have power shell access as well.

could somebody please help me to write a vbscript or bat script to automate these stuff.
Hi Team,

Can somebody help me with a batch script that i can install Ransonware patch on 100's of machines remotely using PSEXEC by placing all machines in single text file. In our organization WinRM service is stopped on all devices, hence i can't use powershell script. Also i need to copy PsTools onto remote machines to run the patch by using PSEXEC.

Based on above scenario can somebody provide me batch script that i can copy PsTools, KB File onto machines remotely & run using psexec.

Thanks in advance.

Windows Batch





Batch files are text files containing a script of commands that are executed by the command interpreter on DOS, OS/2 and Windows systems. Most commonly, they are used to perform a series of functions that are repeated -- copying a set of files created daily with one step, for example.