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

77
votes
3answers
164k 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?
6
votes
6answers
19k views

Delete temporary files from batch script in xp

I'm looking for a good batch script that would quickly find & clean all the known safe temporary folders/files from Windows (as many variants as possible) machines (e.g. the windows temp folder, ...
7
votes
2answers
8k 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 ...
1
vote
1answer
2k views

Change list of allowed logon computers from batch file

How can I change this setting from a batch file? For any given user, how can I make it so they can only log onto the computer named abc? A vbs or powershell script would be my second choice.
1
vote
4answers
5k views

Why isn't my Scheduled Task running a batch script?

OS: Windows 2003 Server Setup: The batch file basically uses 7zip to zip up a few files into a location ready for uploading into an offsite location via FTP. I have run the batch file as myself and ...
20
votes
13answers
72k 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?
18
votes
10answers
145k 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
3answers
13k views

Store output of Windows command in batch file

I need to store the output of a command line in a variable. How can I do this?
11
votes
8answers
62k 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 ...
15
votes
5answers
6k views

What's the difference between .cmd and .bat files?

Just curious. "Cool" people in our company always use *.cmd while no one was able to explain the difference to me.
3
votes
1answer
2k views

How to revert the compressed attribute on files in Windows for a whole drive

Someone at my job (a sysadmin) actually performed a "cleanup" task on WinXP which at the same time compressed all the files on my HDD with the Windows compressed file attribute (Filenames get blue in ...
3
votes
1answer
5k views

Running a Batch File from Task Scheduler Without User being logged In

I'm trying to run a batch file on Windows 7 from the Task Scheduler. I can run the batch file fine if I run it from the command prompt. If I run it from the Task Scheduler to only run when the user ...
1
vote
6answers
2k 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 ...
0
votes
4answers
1k views

FTP from batch file

I'm trying to use a batch file to download a package off my FTP server. echo username >ftp.txt echo >>ftp.txt echo cd directory >>ftp.txt echo get filename >>ftp.txt ftp -s:...
2
votes
4answers
7k 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 ...
2
votes
1answer
358 views

PsExec hangs intermittently when calling AppCmd

We have an automated deployment process which is primarily managed by a batch file. One of the first steps in that process is to stop an IIS AppPool so the updated files can be safely copied. To do ...
1
vote
1answer
731 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 "127.0.0.1:5900"...
1
vote
1answer
2k views

Using XCACLS to set permissions with long filenames

We need to set permissions on users' directories on a Windows 2000 Server. This happens regularly enough and they must also be set in the order below or the backups crap out. This is the basic script: ...
0
votes
2answers
2k views

Windows command line built-in compression/extraction tool?

I need to write a batch file to unzip files to their current folder from a given root folder. Folder 0 |----- Folder 1 | |----- File1.zip | |----- File2.zip | ...