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
5k views

Copy file to all users desktop

I want to copy a file to all users desktop on Windows 7 by using a batch file with the command: COPY C:\FOLDER\FILE.TXT %AllUsersProfile%\Desktop But the message "Permission Denied" is shown. How ...
0
votes
3answers
3k views

Schedule a batch file with parameters containing spaces

I need to schedule a task in Windows Server 2003 that executes this script that deletes files older that n days in the specified folder. The script needs 3 parameters: %1 path to folder where files ...
2
votes
1answer
930 views

Spaces in SETX PATH command

Suppose my PATH is C:\WINDOWS\system32\;C:\Program Files\Important\ SET NEW_PATH=C:\My\Dir\ SETX PATH "%PATH%;%NEW_PATH%" Results in a path of: C:\WINDOWS\system32\;C:\Program ...
1
vote
1answer
2k views

eventcreate with multiline description

I'd like to use eventcreate from a batch file to log the results of a file copy job (robocopy). What I'd really like to do is use the output of the file copy job as the description of the event (/D ...
0
votes
2answers
7k views

Change Windows network share permissions using command-line tools

Can it be done without downloading subinacl.exe at all?
0
votes
1answer
93 views

Dump SVN file revisions for a repository

I need a script to go through my working copy and for each file and folder dump its SVN revision and whether it is modified or not. Anything working out of the box?.. Need both Windows and Mac ...
2
votes
2answers
9k views

How can I edit local security policy from a batch file?

I am trying to write a utility as a batch file that, among other things, adds a user to the "Deny logon locally" local security policy. This batch file will be used on hundreds of independent ...
0
votes
4answers
771 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 ...
1
vote
2answers
934 views

Batch Script to restart service

Can anyone help with a peice of batch script to restart an application service at scheduled time. For example: If the service is "windows firewall " Then the script should restart this service every ...
4
votes
4answers
5k views

How a batch file runs on a remote machine started by PSEXEC

I am having an issue running a Batch file on a remote machine suing PSEXEC. The file runs but does not run like it does when run through remote desktop. The batch runs a file which is a 32 bit ...
2
votes
1answer
2k views

Using systeminfo to get the OS Name

I need to find the flavor of Windows that is running using a batch file that will run on anything from Windows NT to Windows 7. I'm using a method based on this page with some minor changes. ...
3
votes
1answer
2k views

Windows Server 2008 - Windows Server Backup - Email Alerts

I would like to create a script that emails me when a scheduled daily backup runs. I'd prefer the email to indicate success or failure. I understand that this is not an easy thing to do with Windows ...
2
votes
3answers
423 views

Can I copy a file from the Web to a local machine at the command line?

Is it possible to copy a file at a HTTP:// URL to a local directory in a BAT or CMD file?
0
votes
1answer
68 views

Create Batch file for laptops to copy templates

I am new to batch file programming and need an expert help to find out something. I want to create a batch file that runs at login and compares a local copy of the templates to what we have on the ...
6
votes
4answers
2k views

Checking parameters in a DOS batch file

We have a batch file that takes parameters. We then read the value of the parameter using %1 for the first parameter. Question is: How can we check that %1 has a value?
11
votes
7answers
4k views

I would like to start multiple computers at once, What software do I use?

I have turned on Wake On Lan on all of the BIOSes in the PCs and I have a simple batch file that runs a free command wolcmd.exe Wake on Lan Command Line The syntax is as follows: wolcmd [mac ...
1
vote
3answers
2k 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 ...
1
vote
1answer
1k views

net use can't connect to share again when nobody is logged in

I have several batch programs that run from the windows scheduler. When there is no user logged into the server after a restart (at the login screen,) the first batch program to run connects to the ...
4
votes
3answers
288 views

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 ...
1
vote
1answer
1k 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 ...
1
vote
1answer
381 views

Example Batch File To Start A Spot Instance Of Certain EC2 AMI?

I want to start a certain EC2 AMI at the click of a button, well two buttons actually. Just to speed up testing / launch-time. How would you call the EC2 API tools for windows via a batch file to ...
4
votes
2answers
1k 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> ...
2
votes
5answers
3k views

Run a batch file silently, executed at remote desktop login

In our office we are using Linux thin client machines, they work very well except the lack of IE, which is a pain because the corporations we deal with are too stupid to update their web apps (no ...
3
votes
3answers
5k views

Windows Server 2008 CMD Task Schedule not running

I have a BAT/CMD file that when run from the command prompt runs completely. When I run it through the Task Scheduler it partially runs. Here is a copy of the file cd\sqlbackup ren Apps_Backup*.* ...
0
votes
1answer
1k views

How do I know if robocopy skipped the file I am copying?

I am using a batch file to copy a database backup file using robocopy (on Windows 7/2008) and need to restore (with replace) the database only after the backup file is really changed (not skipped by ...
1
vote
1answer
266 views

List total memusage by 32bit programs and 64bit programs

How to get the total amount of memory used by 32bit applications and 64bit applications from the command line in Windows. I tried using tasklist /FI "MODULES eq wow64.dll" /FO CSV and then parsing ...
2
votes
3answers
833 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
9k 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
5k 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
5k 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 ...
10
votes
8answers
17k 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
5k 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
4k 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
2k 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
744 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
610 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
151 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
5k 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
924 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
11k views

run bat file at startup

How do I run a bat file at startup in Windows 2008?
1
vote
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 ...
3
votes
2answers
3k 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
309 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
5k 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
504 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 ...
4
votes
4answers
5k 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
380 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 ...
1
vote
2answers
5k 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}} ...