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

2
votes
3answers
727 views

Batch file creation for restarting services remotely

Need to create a batch file for restarting some services remotely and restarting iis remotely in Admin mode. Help would be appreciated Thanks krish
2
votes
1answer
2k views

How to Disable Ctrl-C /Ctrl-S While Running a Batch File

By default, batch files can be terminated when the user presses Ctrl-C and can be paused by pressing Ctrl-S. Is there a way to disable this? The MS-DOS BREAK command apparently used to do this, but ...
3
votes
2answers
8k views

How to uninstall software using batch file

I want to uninstall a software by calling a bat file. It must be automatically, without entering any parameters during the uninstallation. How to make the bat file which would be able to uninstall ...
6
votes
2answers
4k views

Scheduled Tasks w/ GUI issue

Are there issues running Scheduled Tasks in Windows 2003 when the task has a GUI? I have one that worked fine in Windows 2000 but won't run on Windows 2003. Details: I have a .bat job that ran every ...
3
votes
3answers
4k views

Line Break in Batch File

I have a simple batch file (forbat.bat), with the following content: FOR /F "tokens=4 delims=," %%G IN ("deposit,$4500,123.4,12-AUG-09") DO @echo Date paid %%G When I run this batch file, I can get ...
8
votes
8answers
15k 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 ...
1
vote
2answers
4k views

Change Current Directory to the Batch File Directory

I have a bat file on windows that execute a procdump operation. The issue with the batch file is that I need to cd to the batch file directory first before executing the job, or else the script won't ...
2
votes
4answers
3k views

Pass the PID from tasklist into taskkill to kill a process by the .dlls it's holding open

Windows scripting noob here. Say I've got the name of a .dll I need to delete or copy over, and I'm getting the classic "The file is in use by another process..." error. I know I can run tasklist with ...
1
vote
2answers
1k views

Does anyone have a Windows “at /every:” example to explain how to setup a batch file to run every day?

Microsoft documentation for the "AT" scheduler command shows that it has an /every: switch to schedule a script to reoccur on specified days. I've done it before, but I can't remember the syntax for ...
0
votes
1answer
451 views

Batch file match start of machine name

What I need to do is add a few lines to an existing batch file so that it acts differently depending on the machine name. We have a standardised naming scheme where the first three letters of the ...
0
votes
3answers
409 views

How can my my batch file determine whether I'm on my work network?

I have a batch file that runs whenever I log in on my laptop. I only want the batch file to execute when I'm on my employer's network. At home, I'd like the batch file to simply exit. What's an ...
0
votes
2answers
134 views

Find string in command result

I want to do following in a bat file Run a exe Capture results from step 1 find a string in results from step 2 if step 3 find is successful then do something Is this possible(particularly ...
2
votes
3answers
3k views

How do I set the global PATH environment in a batch file?

The group policy in our environment overwrites the PATH variable every time I log on and, as I run a 'non-standard' computer, it gets it completely wrong (C:\Windows vs C:\WINNT, missing directories ...
0
votes
2answers
833 views

Need relative paths from a batch script directory listing

I have a simple batch script that recursively looks at all files and folders within the directory and writes out the file inventory to a text file. It currently looks like this: dir /b/s > ...
2
votes
4answers
8k views

run bat file at startup

How do I run a bat file at startup in Windows 2008?
0
votes
1answer
2k views

Calling a batch file using relative path

Oh gosh, gotta expose myself as a noob here ;) In Windows, I need to execute a batch file in a subdirectory of the working directory. However, just running subdir/foo.bat cmd1 cmd2 does not work, and ...
2
votes
2answers
2k views

How can I move files into an zip archive from a batfile?

I think the header explain the question. I want to do inside a bat-file: zip /a /m myfile.log myarchive.zip where I just invented the zip comand and the options: /a add file /m Move file It is ...
0
votes
1answer
262 views

How to select a daterange of files and archive them?

We have 4 servers (Windows 2003 R2), each with a log-directory with thousands of log-files. I have written a log-viewer that collect log-files within a date range and show them in a grid. But this is ...
0
votes
5answers
4k views

IIS wont run a BAT File

The problem we have run into is as follows. We have an ASP.NET WebService which runs under IIS7. The code in the WebService works 100%, however when the WebService tries to run a .BAT file, nothing ...
1
vote
6answers
425 views

Newby question: How do I automate copying files to a remote computer?

Firstly, I have the utmost respect for programmers & IT professionals. I'm a newby/wanna-be. I'm looking for help on developing a small program/script that helps me with the task I have detailed ...
3
votes
4answers
4k views

Windows 2003 batch file Sleep/Wait function [duplicate]

Possible Duplicate: How to sleep in a batch file? I have a batch file that runs as a secheduled task in windows server 2003. This batch file purely calls around 20 other batchfiles one ...
1
vote
2answers
354 views

Bat file in another account

I have a bat file which will delete files in some folder (Profile Folder). But i do-not have access to that folder. But another account has access to the folder. How to run a batch file from one ...
0
votes
2answers
4k views

scheduled task returns error 0xff despite success

I have a scheduled task that runs a batch file, and even though I can see the results of it completing successfully, according to the task scheduler it fails with error 0xff, every time. I have other ...
1
vote
2answers
2k views

How can I get the name of a windows .bat script from within the script itself?

I have a .bat file. I want to programmatically get the name of the .bat file. How can I do this? This is my end goal "..\lib\nant\nant.exe" -buildfile:nant.build {{pass in name of this file here}} ...
0
votes
2answers
2k views

Checking file properties in a batch script?

I have a batch file from a vendor to patch some software on a Vista machine. I'm going to be using GPO to push it out as a startup script. My problem is some systems require this software and some ...
0
votes
1answer
3k 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?
1
vote
1answer
95 views

Vista Batch File Limits

We have created two batch files which set two lots of folder permissions. T:\folder1 level1 all get read only permissions. T:\folder1\subfolder1 level2 all get change permissions. The batch files ...
1
vote
3answers
411 views

Batch file link with parameters

I have a script which generates an Email with information based on the computer it was just run on. In the Email there is also a link to another batch file (which runs an exe) that I would only need ...
1
vote
6answers
1k views

How to rename machines after image install

Today I am deploying 20 brand new Dell workstations. These will all be for public use at a local library and will be replacing 20 older workstations, which will be moved to another branch of the ...
15
votes
12answers
33k views

How to get a list of drive letters on a system through a windows shell (bat, cmd)?

How do I get a list of drive letters and their associated labels on a windows system through a bat file?
1
vote
3answers
2k views

How to pass parameters to a bat script

Excuse my newbie question but I haven't had to touch bat scripts since the days of the autoexec.bat... and that one was even called from the system directly. So I wonder how I can pass in arguments ...
2
votes
1answer
381 views

Including a bat file in a bat file

I have many bat files that share a common setup of variables. Instead of defining the same variables over and over again (and making errors in the process) I would like to include one bat file in all ...
2
votes
2answers
3k views

how to change mapped drive label from command line?

How might one control the label for mapped drives as they appear in My Computer, from the command line? The goal is to have the drive letter at the beginning of the phrase instead of the end, so when ...
7
votes
7answers
61k 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 ...
0
votes
1answer
92 views

Transfer files without destination access

HI All, I have a issue where I want to create a script (VB or Batch file) that when a user runs the script it will copy files from Folder1 to Folder2. Here's the rub. I don't want the users to have ...
0
votes
3answers
830 views

read an unknown directories name + copy to it

I would appreciate some help please. I am trying to copy two files "test1.txt" and "test2.txt" into an unknown directory, e.g. into the directory "%USERNAME%\Documents\test\04pql7hw.example" The ...
1
vote
2answers
490 views

How to do some actions for each file in a folder?

I have a folder with files having .foo extension. I need a batch file to execute some commands for each file in that folder having that extension. How should i do that? Seems I need a loop after ...
3
votes
3answers
803 views

How do you remap a share to a different drive?

I want to write a start up script to take an mapped drive, change the drive letter, then put a different share on the original drive. How can this be done?
1
vote
2answers
2k views

Automate running Cisco VPN Client and RDP

I am trying to automate running the Cisco VPN Client and then a RDP session. What is a good way to do this? Batch File? Powershell? Other I have played with a batch file and this kind of works. ...
3
votes
8answers
4k views

what is good way to protect batch file?

I have batch scripts that are scheduled to run daily. Some of the scripts have password in them. I'd like to protect the batch from being read or opened by those not authorized to open or read them. ...
1
vote
3answers
85 views

Delete just ASP files

I'm trying to write a Windows Batch Script file that deletes just .asp files. If I do: del *.asp /s This has the side-effect of deleting any files with the extension .aspx. This is bad because I ...
11
votes
8answers
23k views

Better way to wait a few seconds in a bat file? [duplicate]

Possible Duplicate: How to sleep in a batch file? Here's a haxxorish way to pause for a second in a batch file: PING 400.500.600.700 > NUL I've googled but I'm not sure there are any ...
2
votes
2answers
1k views

How to create a windows batch file that sends a file to a bluetooth device?

I'm always sending one file to a device. The device is always the same and the file has the same path and name. How do I write a batch file to do this?
0
votes
4answers
2k views

Listing all current RDP sessions

We're running a certain application on a client's server. The app runs on the console session, and basically manages some batch processing. Every once in a while we discover the app is not running, ...
0
votes
3answers
3k views

How to write a batch file to remove subfolders and files from a folder on time basis

i need to remove the files from a folder every 4 hours. Otherwise storage folder will be filled with files and production server will be hang.
2
votes
7answers
403 views

How do I figure out which file is being executed?

I have two files: abc.exe and abc.cmd - both along the path somewhere. abc.exe is a command-line utility. abc.cmd is a wrapper around abc.exe. When I type "abc" in the command prompt, how can I ...
1
vote
6answers
7k views

How do I run a batch file on a local network as Administrator? (Vista)

I have a couple of batch files which must be run as Administrator. I can do so if they are on my machine, but when I put them on the network and then try to run them as Administrator, the command ...
4
votes
3answers
9k views

How to compress files in Windows in batch file?

I can compress files or folders in Windows from GUI by right clicking and selecting "Send to .. Compressed (zip) file..". Is it possible to do same in batch file?
5
votes
5answers
1k views

Do Windows batch files have a %* construction?

In a batch file, do I have to do (e.g.) the following? @echo off call other.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
1
vote
3answers
141 views

RAID or batch copy on scheduler?

Is it better to setup a RAID array or a batch copy command on a scheduler? My needs are simple - to backup my important files (some source code, financial data, etc.) on my home network nightly to a ...