A batch file is the name given to a type of script file, a text file containing a series of commands to be executed by the command interpreter under MS-DOS and Microsoft Windows.

learn more… | top users | synonyms (1)

0
votes
3answers
2k views

Autostart Cygwin on Windows boot and run a cygwin command

Sometimes my Windows server reboots at night to install new updates. Then the next day I find out that my cygwin instance has been stopped. What I want is on Windows start, also run Cygwin AND run a ...
0
votes
1answer
766 views

Rename folder using wildcard windows

I've got a piece of software that includes its own backup utility, but it generates folder names with the current date and time appended. I'd like to write batch script that will remove the date/time ...
1
vote
1answer
450 views

more than one start statment in the same batch file?

I wrote the following batch file: start D:\folder1\bin\run.bat start D:\folder2\bin\run.bat start D:\folder3\bin\run.bat start D:\folder4\bin\run.bat It executes the first start but then gives me ...
3
votes
5answers
5k views

Is there a way to submit a batch of commands to a Cisco router and have them execute from the router?

I need to change the configuration of a remote (6 hours' drive) client's Cisco 871 (IOS 12.4.15T) from my location because of some new internet service at his location. To be more precise, I need to ...
7
votes
2answers
8k views

Locale-unaware %DATE% and %TIME% in batch files?

The %DATE% and %TIME% environment variables provide the current date and time on Windows machines on the command line and inside a batch file. Sadly, those values are locale-aware! Meaning that, say, ...
1
vote
2answers
4k views

Running a batch file as a system service in Windows Server 2003

I currently have a batch file used to start a voice server application in C:\Teamspeak. The application cannot start directly because the batch file passes settings to the application. Is it possible ...
2
votes
1answer
1k views

VboxManage in a Batch File

I have the command below in a windows batch file, whenever I run the above batch (ipconfig.bat) to get the ip of my linux vm, it outputs the ip fine but doesn't ends the batch file, I have to press ...
2
votes
3answers
3k views

How to put DayOfWeek value into file name?

I would like to use the numerical part of the output of "wmic path win32_localtime get dayofweek" to number backup files. Something along the lines of: FOR /F "tokens=2 delims=\n" %%DoW IN ('wmic ...
1
vote
3answers
1k views

.bat files to find all files on drive bigger than X

So far I run a .bat file to find all the media files stored on our student shared drive, which then writes to a .txt file in my documents, for example: dir S:*.mp3 /s > "M:\logs\student\mp3.txt" ...
1
vote
4answers
2k views

Batch file to change all network shares on computer

I need to change all shares of //foo to //bar in a batch file. Say i have R: //foo/foo and Z: //foo/bar I need to have a batch script that makes them R: //bar/foo and Z: //bar/bar Anyone have any ...
1
vote
3answers
9k views

Send a batch file to a Windows machine, and execute it

I know PsExec is perfect for sending files over a computer on a network and then execute it on that remote computer, however I can't use PsExec because I'm developing a piece of software and I can't ...
4
votes
5answers
2k views

shortcut for Eventvwr > Connect to another computer

I was wondering if you can write the following action in a batch command? eventvwr (open the event viewer) Menu Action > Connect to another computer Type in the name of the computer. Connect. This ...
1
vote
3answers
2k views

How to work with batch script dialog?

I am working on a batch script to remap a network drive in windows xp. I have found it to work out well for the most part with: net use G: /delete net use G: \\file\share However, if there are any ...
2
votes
2answers
863 views

using xcopy or copy to back up files?

I have a local drive that contains a directory per user: c:\user1\ c:\user2\ c:\user3\ and I have a remote drive (via a share) that contains the same directory tree: f:\user1\ f:\user2\ f:\user3\ ...
0
votes
2answers
1k 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
11k 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, ...
8
votes
8answers
26k views

Need leading zero for batch script using %time% variable

I came across a bug in my DOS script that uses date and time data for file naming. The problem was I ended up with a gap because the time variable didn't automatically provide leading zero for hour ...
2
votes
2answers
3k views

Executing batch file from sql server job

I want to create backup job on sql server. And i want to execute batch file in job. I just wonder the part of executing batch file from sql job. Do you have any idea? Any help would appreciated. use ...
1
vote
2answers
777 views

batch script to retrieve zero byte files

How to retrieve zero byte files and copy into a folder using batch script. can someone help me out. i want the script should check the subfolders and displays the output as complete folder path in ...
2
votes
5answers
8k views

How do I redirect/save the console to a file and keep it visible on the screen?

I want to save a program's output (stdout) to a file but still be able to see the output on the screen in realtime. I need a solutions for both Linux and Windows.
3
votes
6answers
3k views

Batch scripting: iterate over drive letters?

In windows batch scripts, how can I iterate over all drive letters which correspond to physical volumes or mapped shares?
2
votes
2answers
1k views

Execute a remote command on a Mac from Windows

What's the easiest way to execute a single command on a Mac from a remote Windows machine, via batch? I would like something that works without a preset configuration (like SSH credentials) on either ...
1
vote
1answer
275 views

How to limit SMTP delivery to hourly batches

Moved over from StackOverflow. Sorry if you saw it there first In an effort to keep us from being labeled spammers by major ISPs (in addition to SPF records, privacy policies, CANSPAM compliance and ...
1
vote
1answer
89 views

Is there a way to create a custom installer package to do batch installs of a bunch of programs at once?

Basically I want to create a file which will automatically install a bunch of files without having to manually install each of them (i.e. Flash, Adobe Reader, MS Office, etc.). I'm guessing the ...
0
votes
2answers
275 views

Cron jobs in cascade array

If anyone it's like me and work even once with IBM Mainframe batch jobs, then it's possible that you know CONTROL-M, that is a tool to schedule jobs not only in a date and time fashion but also in ...
2
votes
6answers
1k views

PHP vs Batch file for mysql cronjob?

My server details: OS: Windows Server 2003 IIS6 Plesk 8.xx installed (currently using Plesk to set the cronjob) I need your advice. I have 2 methods: Method 1: Using php + mysqldump, create ...
0
votes
1answer
99 views

Plug-Start-Pull Windows batch script

I'd like to preface this by saying I'm not a system administrator at all, just a lowly Java programmer. However, I've been tasked with writing a batch script to be run on a sizable number of laptop ...
2
votes
14answers
39k views

Finding day of week in batch file? (Windows Server 2008)

I have a process I run from a batch file, and i only want to run it on a certain day of the week. Is it possible to get the day of week? All the example I found, somehow rely on "date /t" to return ...
1
vote
2answers
723 views

Reg Query Issues

I have a batch script that does reporting on our systems and part of it queries the registry for information. The script fails to get the key's value when its ran by the system, but whenever I run ...
1
vote
5answers
3k views

Quickest way to scheduled file deletion on Windows

I have a windows server machine that takes daily backup daily and each daily backup takes 1.5gb thus every night, I want to remove backup files that are older than 1 week. This is how my back up ...
1
vote
1answer
3k 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 ...
1
vote
1answer
1k views

'net use' error after 'rasdial' in batch file

I'm writing a batch script that does the following: rasdial - connect VPN net use - map a drive to a remote folder share (on the VPN) xcopy - copy a bunch of files from the mapped drive to the local ...
1
vote
1answer
734 views

Batch sending s/mime encrypted email - How?

I need to send some sensitive data periodically to a set of recipients via email. Due to the nature of the data, we need to send it encrypted. Some of our clients use PGP/GPG, so it's not an issue, ...
0
votes
2answers
24k views

Check free disk space using Batch commands

Is there a way already to check the free space of a hard drive in a batch script? I'd rather not use third party apps since I need to fill out a lot of forms, and in that case I think I'll write a ...
1
vote
2answers
420 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 ...
3
votes
5answers
1k views

Web interface for torque

Can someone recommend a good web interface for Torque? I'm interested mostly in monitoring the status of the job queues.
0
votes
2answers
3k 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 ...
4
votes
2answers
6k views

delete registry key using wildcards

I'm hoping to find a way to delete registry keys based on wildcards using a batch file rather than writing some vbscript. Does anyone have an example? I'm forced to proceed with MS's wonderful ...
2
votes
2answers
2k views

Setting Variables in Windows Batch Scripts

I need to set some variables based on an argument for a windows batch script. @echo off if [%1]==[] ( echo "Usage: xxx <AAA|ZZZ>" ) else ( if [%1]==[AAA] ( SET ...
1
vote
1answer
791 views

Running a windows batch script in a separate process

I want to start a long running process from a windows batch file. The start script should just call the second script and return, end. How can I achieve this? Thanks!
3
votes
2answers
7k views

Adding numbers stored in variables in windows batch script

I have a loop in a batch script and I would like to do some arithmetics with the loop counter. I found out how to evaluate expressions, how to add numbers here: ...
3
votes
2answers
3k views

Evaluating expressions in windows batch script

This one could turn out as the dumbest question ever, as I am probably missing out the obvious. Anyway, here it is: Can you evaluate expressions in a batch script. For example, I want to add two ...
2
votes
2answers
1k views

Batch file to call multiple batch files and keep going after errors

I have a batch file like this, the issue that I have is that if the first batch file fails, the second one never gets started, how can I get them to both keep going? @echo off MapNetworkDrive_J.cmd ...
16
votes
3answers
80k views

For Loop counting from 1 to n in a windows bat script

I need to run a windows command n times within a bat script file. I know how to do this in various programming languages but cannot manage to get it right on the windows command line :-( I would ...
1
vote
6answers
2k views

Copying Directory Tree on Windows

I need to copy a full directory tree (aka recursive copy) with a bat files on windows. On *nix systems I use the -R argument on the copy command, like so: cp -R fromDir toDir and that did the job. ...
0
votes
2answers
2k views

Create a batch file that deletes all user data folders except for All Users and Default User?

I am using Windows XP and would like to create a batch file that deletes all user data folders except for All Users and Default User. How can I achieve this?
0
votes
3answers
2k 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 ...
0
votes
2answers
468 views

Post-startup & Pre-Login shutdown

Is there a way [using a batch file] that I can set a system to shutdown PRE-login but POST-startup? I've tried a scheduled task to run this batch file with the "/SC ONSTART" flag .. That didn't work. ...
1
vote
3answers
3k views

Need to exclude a specific result from a Batch For Loop

I have a script that recursively loads files from a specific directory (and subdirectories) into a java classpath using a FOR loop. It looks like this: FOR /r directory %%F IN (*.jar) DO call :addcp ...
3
votes
1answer
18k views

cmd.exe: how to start a background process, run some things, stop background process

I want to run a batch script that: starts a background process (a Selenium RC server, if that matters); waits until the background process starts to listening some port (or wait a fixed amount of ...