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

how to automatically re-connect to rdp session,see pic
any powshell,vbs script?
thank you
I am trying to deploy Intune to all the computers in my company.  Unfortunately, MS requires the user to be a local admin to join Intune.  These are all AD Domain Joined.  I am looking for a way to give the logged in user local admin rights, have them connect to Intune with their username and password and then remove them from the local admin group.  So far I have this for my script:

Net localgroup administrators “domain\%username%” /add
Start ms-device-enrollment:?mode=mdm
Timeout 300
Net localgroup administrators “domain\%username%” /delete

It works fine if a domain admin right clicks and runs the batch file as administrator.  I would like it run as a logon script one time.  I also tried to copy the file to common startup folder so it would run at logon, but get access denied on the first line.  The rest of the script runs without error.  Has anyone had success joining computers to Intune without manually making users local admins?
Hi all...

I've tried finding what I need but most solutions offer various entries and switches on a vbs script or batch file.

I need to delete one single registry key if it is present. The key is as an example:

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Network Associates\ePolicy Orchestrator\Application Plugins\DATALOSS1000

How can I accomplish this, and run it remotely on approximately 300 systems?

Batch file preferred...

Thanks in advance...
i need a batch file to create this path: C:\Windows\winwin123
this path already exist: C:\Windows\  but the folder called  ''winwin123 '' must be created ,afetr is created i want to go there: C:\Windows\winwin123
I have a FTP transfer from a server to the client(server). It is using a bat file and a .scr file which runs the script. When I run it it goes to ftp command prompt and it stops there. It  was running well in a Sql server 2000. When upgraded to SQL server 2008 R2.
The script is as follows.  (IP Address, user and password have been obscured)

KAinsert. bat runs KAinsert.scr
Opens Command Prompt.

ftp> ftp
put kafada05

We are using a software to generate some results in a .csv format.
If a run the program using the .bat file from the Windows user, it keep the program configuration.

When whe run the .bat file with PHP exec function, the .csv file is generating but it don't keep the program configuration.
Maybe Wamp or PHP don't use the registry configuration of the program ?

Someone has any idea ?

All my best,
As topic says - I'm looking for a way to disable a very specific usb port when I'm running the batch file, or any other method. It just has to be a file that enables / disables the usb port.
Also I'm using win7

thanks in advance!
Here is the batch file I am running:

@echo off
set /p filename=Please enter the filename you want copied:
xcopy \\server\D$\folder1\folder2\%filename%     \\server2\folder3\folder4

I have two users with identical permissions on the network, servers, and individual machines.  One user can use the batch file successfully, and one it says that the drive is invalid.

Any thoughts would be helpful.
I need to set permissions on multiple computers so that the permission will not affect the folder or subfolders but the inheritance will still apply to the files within those folders.

ex:  c:\temp\scratch\sub\ needs to have permissions applied so that users can't delete either the "scratch" or "sub" folders but can add and delete files within them.  

According to Microsoft you need to use the "OI" and "IO" commands together but they don't give examples, any examples I've found online don't appear to work.   It should read something like "cacls c:\temp\scratch /G everyone:(IO)(OI)(C).  I've also tried the icacls version with no success, I've also tried only using the "C" (change) permission without the IO & OI but the folder can still be deleted.

Has anyone gotten this to work?
the reason I want to restart W3SVC .. I'm running a classic asp the has numerous W3SVC sessions being logged in. the W3SVC service doesn't seem to be releasing and do the task manager shows numberous sessions of W3SVC running.The .asp program starts to fail and gives a 500 error to the end user. The easy fix is to restart the W3SVC service which resolves the problem fo a while.. Soooo .. what I would like to do is restart the W3SVC service automatically at around 3am each day. I built a batch file and it works and added it to the task scheduler and it did run but now it's not listed any where and I can't see the results of the batch
Please see PDF attached for plugin requirement. I'd like to deploy this to remote machines using PSEXEC. Can an Expert
please provide me the commands I need to execute? I'd like to also configure the command to produce a file (txt or whatever) that will give me the results of the deployment whether it deployed successfully or failed.  Can you please provide me the commands using my scenario below:

1. Executing PSEXEC from Server1
2. Plugin install (.exe) located in root of C:\ on Server1. Plugin file name "Workfront.exe"
3. I've created a .txt file in the root of Server1 name "computers.txt", which contains the remote hosts for my deployment.

This install needs to be silent. I believe it is necessary for the machine to reboot in order for the plugin to install. I tried a manual install, and a reboot was required. Maybe you Experts can tell by viewing the PDF requirement.
I have an FTP program that allows me to schedule times for that runs scripts so we connect to FTP sites and download documents into folders that are created that day.  We recently had a change with one of the sites so that it is no longer just FTP it is encrypted and using WinSCP.  This works if someone manually connects and finds the files and downloads them, but I am tasked with making this happen again automatically.  I have run into the problem with my existing program not having a way to enter the passphrase for the key that is required after the initial login name and password.  I have read about scripts that could be created and used within WINSCP but none that address my problem.  I have looked at other software packages but found none so far that will work.  Does anyone have a script that will allow the login with the username, password and then after screen comes up asking for passphrase it is entered so that I can try to salvage the pieces of my existing script which creates a new folder each day using the date as the folder name and downloading the files from the site.  I am not a script person which is part of my problem, but I can understand the basics so if someone could share this info or perhaps let me know if there is a program that will do this it would be greatly appreciated.
Hey Everyone - I am trying to write a batch file to install a firefox plugin via batch file

I have read some threads and see lots of conflicting information from the Googles

So I thought I'd come to guru circle

What  are your thoughts ?

the end goal is to push a firefox extensions across an enterprise environment with several thousand computers

Not all have firefox

for those that do - we want this plugin install

Since Firefox has no Group Policy Templates worth the trouble - I am looking into other options
We have  an issue that when security updates are applied on our Windows servers, in some instances it removes the keys installed for pgp.

I have been tasked with automating this process of ensuring that the keys are always present.  Two things come to mind for solutions but I cannot get either work:

1) automate the installation of the key using --batch mode - when I execute this in a batch file it calls out the trust level of 1 - 5.  Without typing a 5 and then hitting a lowercase y, the command fails in the batch.

2) forget about installing the keys and export them and then feed the name of the key into the encryption process

Either one would work as I just need this to be an automated process such that nothing fails in the future due to the keys being removed (encryption jobs run all the time using these).

Any help would be greatly appreciated as the sites seem to not have the content I am seeking or the syntax is certainly not obvious enough for me as I am pretty new to this pgp2.exe

Thanks in advance
Need to run Java 6 for our internal application but Java 7 for Logstash - anyone know a way to make both applications run on different versions of Java?

We have a script for Logstash to start but fails because the VM has Java 6 installed.  Our application needs that version, Logstash crashes...Ideas?  Script?  Environment variable deal, dual installs of Java (do this but how can I get this to work)

This is for Windows 2008 BTW (if you have anything for CentOS as well, that's cool)

Thanks!  If you need more information please let me know!

I have a ninitepro batch file ready to go and it works. I'd like to have this run when a customer shuts down their computer. It has to run as administrator. There is no server or active directory involved. These are individual computers.

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.