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

1
vote
1answer
284 views

Why does appcmd.exe behave differently when executed inside a batch file?

I have the following appcmd to add an exception to IIS7's ISAPI and CGI restrictions. The exception I am adding should look like: c:\perl\bin\perl.exe "%s" %s Here is the command line: appcmd set ...
3
votes
1answer
1k views

Automated method to convert .reg registry file to reg.exe commands

Occasionally I need to put registry entries into batch files to use in login scripts, unattended installers, etc. While it's pretty easy to add one or two registry commands to a batch file using ...
9
votes
6answers
31k views

Batch file to uninstall all Sun Java versions?

I'm setting up a system to keep Java in our office up to date. Everyone has all different versions of Java, many of them old and insecure, and some dating back as far as 1.4. I have a System Center ...
1
vote
1answer
307 views

Preventing expansion of : in batch file for loop

Trying to build a cmdline tool for reviewing TFS changesets. Currently I have this: rem I know there's redundancy here, but don't care for now set /A curr=%1 set /A prev=%curr% set /A prev-=1 for ...
1
vote
1answer
113 views

Delete windows profiles with similar names using a batch file or script

I’m on a Windows 2008 server and would like to delete 15 users (user1 till user15) without having to do this by hand. After deleting them completely I’d like to readd them (again, with a script) and ...
0
votes
1answer
312 views

Script to copy file from server and install software

Here is what I want to do - I would like to install a software on every PC in my domain. I would like it fully automated. I am sure this can be done either using a batch file or a vbscript. Here is ...
0
votes
2answers
874 views

Batch Script With SQLCMD Usage

Hi All I am Writing a Batch Script Which has to read a set of SQL Files which exists in a Folder then Execute Them Using SQLCMD utiliy. When I am Trying to execute it does not create any output file. ...
0
votes
1answer
162 views

Windows Batch File

I am trying to execute a Set of SQL scripts using a batch bile. When I try this Windows batch file it doesn't run. Please tell me know how to write the script to loop through the files? My script: ...
1
vote
2answers
899 views

How to send the current working directory as an argument in windows?

I want to send a path as an argument to an executable. what I want to do something like this: pushd some\folder set x=cd popd MyExe.exe %x% the problem is that the x variable is now equal to the ...
0
votes
2answers
157 views

Batch syntax issue. Not quoting or escaping correctly?

There's some syntax that I'm missing here. Running this batch file: for /d %a in ("c:\Documents and Settings\*.*") do mkdir "%a\Application Data\vlc" for /d %a in ("c:\Documents and Settings\*.*") do ...
2
votes
4answers
5k views

Create a Windows shortcut through a batch file (.bat)

Is it possible to create a shortcut from a .exe using batch scripting?
1
vote
4answers
5k views

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.
0
votes
3answers
2k views

Zip and FTP a File via a batch script

I am trying to ZIP and FTP a file in one batch file. The Zip part works, but the FTP application reads the entire batch script, rather than just the lines below the FTP commands, causing errors If ...
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
378 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
10k 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
668 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
3k 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
6k 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
5k 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
7k 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
4k 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
9k views

Change Windows network share permissions using command-line tools

Can it be done without downloading subinacl.exe at all?
0
votes
1answer
95 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
12k 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
906 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
968 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
547 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
75 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 ...
7
votes
4answers
3k 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
326 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 ...
2
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 ...
1
vote
1answer
401 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
2k 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
329 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
1k 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
3k 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 ...