batch files are simple text files executed in a command to achieve a particular task or a set of tasks

learn more… | top users | synonyms

0
votes
1answer
1k views

Why is execution of batch files different between drag & drop and from command line?

Ok, so I've been trying to figure this out for hours with no progress. I have created a batch file to get details of a VHD. Everything runs fine and produces the expected results when run from the ...
-1
votes
0answers
16 views

BAT file to extract folder name from a file name & move the file into that folder [migrated]

I'm not very familiar with windows bat file programming and I would appreciate any help with this. I need a bat file to do the following: extract folder name from a filename - eg, extract Chemistry ...
1
vote
1answer
73 views

Batch File to Automatically Install List of Drivers without User Interaction

At work, one of the tasks I am responsible for is resetting computers to their factory settings and installing the updated drivers. Lenovo makes this easy with their System Update tool, but Dell and ...
5
votes
2answers
180 views

How to query the task manager

I know the tasklist command in Windows will give a list of task names and their PID. There is another command WMIC path win32_process get Commandline which does give more detailed information, but its ...
5
votes
1answer
2k views

Batch script is not getting executed when called by Start-Process Cmdlet

I have a strange issue on a Windows Server 2012 R2 here that just does not make any sense to me at all. I've got a PowerShell script that basically has the following structure: Function ...
0
votes
1answer
53 views

How to remove string and replace with content found in text file using batch script or powershell

How to remove string and replace with content found in text file using batch script. test.txt Version: 4.5.0 Import: //MPackages/Project/config/abc.txt #head ...
2
votes
3answers
45 views

How to see what last batch was run on windows

Is there a way to see what was the last batch (something.bat) run on windows? I was in a folder which contains lots of batches, as I was opening them one by one by right clicking and selecting ...
0
votes
1answer
80 views

The system cannot find the file specified- Task Scheduler. Win Server 2012

I have batch script file, which should encrypt a file with pgp. I have defined a task in task scheduler to do this, but I am keep receiving the error"The system cannot find the file specified". ...
10
votes
9answers
21k views

Elevating UAC via .bat file?

Pretty straightforward one that I'm having trouble finding an answer to. serverfault previously helped me with finding a way to automate Windows updates without using WSUS. It's working ...
0
votes
2answers
1k views

Server 2008 issue running batch file

For the life of me, I can't seem to get a batch file running in Server 2008 Task Scheduler, despite it not having the common problems I've seen before. Problem so far: I have a batch file that ...
0
votes
1answer
39 views

xcopy on Batch file for backup server

i have 5 servers connected and want to backup a folder on servers 1,2,3,4 to server 5 and folder on server 5 to server 1. i write a batch file that use xcopy to copy the folders. my question is if ...
10
votes
7answers
35k views

Batch file to uninstall all Sun Java versions?

I'm setting up a system to keep Java in our office up to date. Everyone has all different versions of Java, many of them old and insecure, and some dating back as far as 1.4. I have a System Center ...
-1
votes
1answer
148 views

Execute bat file via php on a local network to run on any PC connected

I have a web app which runs on a local server (XAMPP)...its on a computer (PC1) which serve as a server..other computers are connected to the same wireless network and can run the web app also from ...
7
votes
8answers
22k views

“Delete Files Older Than” Batch Script

So in the work of doing backups, I need a batch script that would allow me to delete files in a specified directory, that are older than lets say, 3 days. This script will be set as a scheduled task ...
5
votes
1answer
316 views

Windows Task Scheduler cannot access EFS encrypted folder despite running as a user with access

I have a batch file set to run via Task Scheduler in Windows Server 2008 R2. The batch file is being used to rotate and compress MySQL logs, and the folder containing these logs is encrypted using ...
1
vote
3answers
3k views

net use mapping not working in batch files but works in cmd

Ok so here's the problem : I've got users using logon script in the domain (username.bat). The script simply lists 4 or 5 (net use letter: \\SERVER\directory\). However, when they open their session, ...
0
votes
1answer
52 views

Find 0kb files on a hard drive and replacing them with same name file from a different hard drive

Recently installed a new Windows 2012 Essentials server for a client. They had a very old XP system they had been using as a file server. Several weeks after what appeared to be a successful ...
-1
votes
1answer
34 views

Search for file names containing space

I have a batch file that helps me in install multiple pieces of software from a shared folder. It's working well with software whose names don't contain spaces, but I need it to work with software ...
0
votes
1answer
61 views

Batch script to increment the text file ans also the value inside the file [closed]

I have a text file Foo.txt which contains value content0. I have to create a batch file which increment the text file like Foo1.txt, Foo2.txt.....Foo5.txt and also the values in the file content1, ...
0
votes
2answers
59 views

Bat script start a program and than restart

I need some help creating a .bat script that starts a program and when done it restarts the computer. cmd /c C:\"Program Files"\"Toolwiz Time Freeze"\ToolwizTimeFreeze.exe /usepass=password ...
1
vote
1answer
10k views

How to write a dos batch script to create a folder structure?

I would like to be able to have a dos batch script that I could utilize to create a specific folder structure below what ever directory I may be in at any given time. The specific folder structure ...
0
votes
0answers
25 views

“Password Expired” when attempting to access Win7 machines on local network with our local admin account

Looks like all of our Win 7 and Win 8 machines were somehow set to expire the admin account that we created locally a couple months back. Now we're trying to make sure we either have to go to ...
2
votes
1answer
185 views

Running Batch file with elevated rights through GPO

I have a shortcut that specifically uses Google Chrome. We have XP and Windows 7 in our environment, and I want to only use one shortcut for both OS. The reason being is that our environment is quite ...
0
votes
0answers
10 views

Error Reporting for File Copy Process

I have a rather complex process in place which runs a java program to retrieve service records from our CRM and export them into an excel spreadsheet, which gets placed onto a server in our data ...
0
votes
1answer
32 views

Modified batch file that kills a certain process

I am looking for a simple batch script that kills a process which listens to a certain ip and to a certain port. If there are less than 10 connections to this process, then it should be killed. If ...
44
votes
3answers
97k views

How to sleep in a batch file?

How to pause execution for a while in a Windows batch file between a command and the next one?
0
votes
1answer
177 views

Icacls works from command line, not from batch file

The OS is Windows server 2012. I am trying to use command icacls C:\folder\targetfile /grant domain\usergroup:(rx) to give permissions on certain file. The command works when executed on command ...
0
votes
1answer
747 views

Run batch files as administrator user

I have a segment with 100 computers. I am booting each machne from WinPE OS located on a CD. After the OS has finished loading, I want to automatically run a batch file that will copy the CD to the ...
3
votes
0answers
2k views

Is MSIZAP still useful, or is it obsolete?

I update flash using MSI files installed by group policy. However, with every update, about a third of the workstations fail to update (Windows Vista and Windows 7 32/64-bit editions). In the event ...
0
votes
3answers
912 views

I Cannot create a .BAT file in the root of C “Access is Denied” Server 2k3

I have an oracle db server on a windows 2k3 box. I am currently unable to create or copy a batch file to the root of c. I can create batch files on different folders (i.e. in my user directory) or I ...
1
vote
1answer
136 views

Batch file that kills a certain process

I am using the following script to kill a process in CLOSE_WAIT state that listens to a certain ip and to a certain port. FOR /F "tokens=5 delims= " %%I IN ( 'netstat -ano ^| find ...
1
vote
2answers
20k views

Script to delete temp files for all users in XP, Vista, and 7

Basically, we have numerous customers running XP and 7 with a few Vista machines. I've found this batch script, but it is limited to the current user (uses the %userprofile% environment variable). ...
0
votes
2answers
4k views

Remove Proxy Setting in Batch File

I want to create a batch file to remove Internet Explorer proxy settings check box. Not to grey it out - but to remove IE from using proxy settings. Anyone got any scripts for me?
0
votes
1answer
38 views

Cannot use PStool for more than 7 PCs over LAN

Below is the batch file command I am currently using to shut down remote computers on our LAN. Here is what it does. I have specified the remote computers IP address in text file named list.txt I ...
1
vote
4answers
4k views

How to partition and format multiple disks using a batch script?

I am trying to format 'n' number of disks using a batch script. My script goes like this. diskpart /s "abc.txt" where abc.txt is: sel disk 1 create part primary format FS=NTFS label=label2 quick ...
2
votes
2answers
4k views

How to make Batch-file automatically stop on error

Do anyone knows if there is a Windows Batch-file equivalent to Unix Stop on Error "#!/bin/sh -e"? (http://www.turnkeylinux.org/blog/shell-error-handling)
4
votes
3answers
2k views

Windows Server 2008 - Calling FTP from .CMD - Pass a parameter to an FTP file?

I am calling the following from a .cmd file: ftp -d -s:D:\backup\web-daily.txt The web-daily.txt file is an ftp input file with similar contents to this: open <server> <login> ...
1
vote
1answer
210 views

IIS backup on Multiple servers from Powershell

Can someone help me with backup of IIS on multiple servers from powershell script remotely. I can take backup of IIS from powershell command. backup-webconfiguration -name IIS_backup. Also i have a ...
1
vote
0answers
92 views

How do I script a change to the msmq storage location on Windows 2008 R2 server

Is there any way of doing this through a batch or powershell script? I'm looking for a way to set up several new servers. The only thing I found on the subject leads me to believe you cannot: from ...
2
votes
2answers
6k views

How can I reset settings for Internet Explorer using a script?

I'm looking to reset Internet Explorer back to factory defaults using a batch file. I'd also like to delete: all Downloads, History, Cookies and Cache, plus anything else in a user's IE profile.
0
votes
1answer
89 views

Clear Windows Temp Folder - Without listing or counting files first

We have a Windows Server 2008 machine running as a web server. We noticed a problem with one of our PHP based websites today, and the error message related to the session and access to the Windows ...
0
votes
2answers
166 views

For Loop in batch file [closed]

Expected Input: Start=1, End=500, Interval=100 Expected Output: 1, 100 101, 200 201, 300 301, 400 401, 500 @echo off set start=1 set end=500 set interval=100 for /L %%g in (%start%, ...
4
votes
1answer
190 views

How to get login username of the login that triggerred a task in the task scheduler

In the Windows 7 task scheduler, I have a task that runs when any user logs on. This task is run as Administrator so it can get the proper priviliges and runs a bat file. I would like to pass in the ...
1
vote
1answer
7k views

Can I Deploy a batch file with Group Policy to run as administrator?

I have created a batch fill which will block Facebook by amending the hosts file in this location: C:\windows\system32\drivers\etc\hosts This is the contents of the file: @echo off echo ...
2
votes
1answer
473 views

dsadd run from batch file fails with “The specified account already exists” when there is no existing account with the same dn

I am programmatically creating thousands of test users from a txt file containing First Name, Last Name, Username, and Password using the following command (saved as a batch file, run in cmd, modified ...
15
votes
9answers
107k views

How to create a service running a .bat file on Windows 2008 Server?

I've created the service using sc create myService binpath=myservice.bat But when I start it, it fails with the following error message: [SC] StartService FAILED 1053: The service did not ...
2
votes
1answer
219 views

How to remove directories using wildcards by reading a file using batch?

Batch file for /f "delims=" %%f in (7profiledeletelist.txt) do rd /s /q "%%f" PAUSE exit 7profiledeletelist.txt C:\Users\1* C:\Users\2* C:\Users\3* C:\Users\4* C:\Users\5* C:\Users\6* C:\Users\7* ...
0
votes
2answers
202 views

How to run batch file without a window in ONE file

I know how to run batch files without a window thanks to this question here: Run a .bat file in a scheduled task without a window. The first answer is the one I am using. It states that to run a ...
1
vote
2answers
1k views

slmgr.vbs supress dialog

We use a batch file with the following content to activate our windows domain computer after imaging: slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX slmgr -ato This works well, but there is a ...
0
votes
1answer
2k views

Install RSClientPrint for Reporting Services 2012 using .bat file and still be able to use 2005

I have a Reporting Services 2005 server that when users accessed it and tried to print reports would get a message asking them to install the print control, which they could not do because of lack of ...