Questions tagged [batch-file]

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

batch files are text files containing commands executed in sequence to achieve a particular task or a set of tasks. They can be very simple, or can contain complex logic.

441 questions
10
votes
2 answers

Check for file by wildcard and store as variable in batch file

I am looking for a way to check a specified folder for a file. I will not have the complete file name, so I will have to use wildcards. After finding the file, I want to store the filename as a variable.
4
votes
3 answers

Run a batch file on remote servers

I have a batch file which stops a service and deletes a file from d:\ drive. I want to execute this on 20 servers. Is there a quicker way than manually logging on each server, copying and running batch file?
Balaji
3
votes
1 answer

How can I sleep in a windows batch file within a non-interactive session?

I have a batch script that is executed outside of an interactive command prompt. I want to sleep for 30 seconds between two commands in it? I've read in some responses to similar questions that you can use timeout or choice, but these fail in a…
Jobu
  • 131
3
votes
9 answers

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. My question is: What is a good way to protect…
titanium
  • 111
3
votes
2 answers

Run exe on computer in network through batch file

I have few computers connected to the network and I want to create batch files to automatize the process of working with them. I have already created one used to shutdown computers at once. It is very simple I ll just post it for the sake of…
Peter Kottas
3
votes
1 answer

Move directory in DOS (batch file) without knowing full directory name

In Bash I can move a directory without know the full directory name like so: mv gradle-*/ gradle/ How do I do this in cmd (i.e. batch file, not powershell). The move command doesn't seem to allow this.
vicsz
  • 133
2
votes
4 answers

Is it possible to insert a timed pause into batch files?

Is it possible to insert a timed pause in a DOS batch file? It should act like the pause command, but instead of having to hit any key, it will continue on its own in X seconds.
ToastMan
  • 544
2
votes
3 answers

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
krish
  • 25
1
vote
4 answers

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 sometimes, said batch file needs to be executed…
1
vote
3 answers

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 to my bat script? For example I want to create n…
raoulsson
  • 4,813
1
vote
2 answers

Using the move command with /Y in a bat file

I need to move all folders in a directory called Profile.V2 out of the directory and then I want to delete the directory. I'm using a bat file to do this which is below, this works perfectly except when a folder with the same name already exists in…
0
votes
1 answer

Running batchfile admin to set envirnment var

I am running into an issue here on Windows 10. I am trying to set an environment variable within the batch file using a for ... in ... do, but it never finds the file folder I am looking for. example: cd \temp for /f "delims=" %%a in ('dir /b /ad…
Mike
  • 1
0
votes
1 answer

Batch: Passing 'Enter Key' into Nested Programs (Program Ran by MPIExec)

What i need: To send "enter" key when batch is still processing a previous line. I am trying to use batch to have an .exe run through a series of input files. The batch file below runs a program, creates an output file, copies it, and then cleans…
0
votes
1 answer

It doesn't print the increased value of a variable in the for loop of batch file

As you can see I am new in the batch files, I have written a script in windows 2003 environment for print an increased value of the variable counter and also I have applied the if condition which is not working in the for loop, though outside the…
0
votes
1 answer

Batch Files..How Iterate over drives using wildcards

I would like to clear the contents of some text files that are in several sub-directories across 2 hard drives on my computer. I would like to do this by a batch file for my ease of use / understanding. Here's what I have so far. Can you help me…
Chris
1
2