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
2answers
930 views

Batch File help needed for PsList/PsKill when a process is over a specific age (elapsed time)

I'd like to request some help in creating a Batch file to run on a windows server which will monitor processes which sometimes get "stuck" and linger after they should be killed. Specifcally, I can ...
2
votes
1answer
369 views

How to move all files except the newest one to a folder?

I have a Windows box and a folder containing such files: 2010-07-04 20:18 81 in01_Acct_20100704001.r 2010-07-07 05:45 165 in01_Acct_20100706001.r 2010-07-07 19:41 ...
2
votes
1answer
8k views

SQL, pl/sql, sqlplus: how to return a variable to DOS batch file?

I have a DOS batch file which invokes sqlplus, which executes some basic SQL contained in another .sql file, and I want the last part of it to return a value back to the dos batch file. However, ...
0
votes
2answers
626 views

running remote debian bash file from windows bat file

i have two machines: 1) windows xp prof., where i have a Exec.bat which takes one parameter 2) debian machine, where i have a Run.sh which also takes one parameter Now, currently i am switching ...
2
votes
2answers
2k 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"? (shell-error-handling@turnkeylinux.org)
2
votes
3answers
1k views

Executing a long command at the windows xp command prompt

Im using WindowsXP and i want to run the following command: tomcat6 //IS//AlfrescoTomcat --DisplayName="Alfresco Community Edition" \ --Description="Alfresco Tomcat Bundle - Repository and Share" \ ...
2
votes
2answers
5k views

Running a bat file in XP as a windows service

Im using Windows XP and i want to run a particular bat file as a windows service.Is there any way to do that ? Please Help Thank You
0
votes
4answers
4k views

Iterating through folders and files in batch file?

Here's my situation. A project has as objective to migrate some attachments to another system. These attachments will be located to a parent folder, let's say "Folder 0" (see this question's diagram ...
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 | ...
0
votes
1answer
6k 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 ...
3
votes
1answer
1k 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
8k views

Change Windows network share permissions using command-line tools

Can it be done without downloading subinacl.exe at all?
0
votes
1answer
94 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 ...
3
votes
2answers
10k 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
820 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
946 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
469 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
71 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
5k 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
3k 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
306 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
392 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
4k 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
290 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
939 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
10k 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
18k 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
891 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
688 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
172 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
7k 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
1k 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
12k views

run bat file at startup

How do I run a bat file at startup in Windows 2008?