Text file containing a sequence of commands or program invocations.

learn more… | top users | synonyms (1)

5
votes
1answer
104 views

Why do my .BAT files on Windows 7 not PAUSE properly?

I've been playing around with writing batch files on my computer for some time, and I am confused about why PAUSE doesn't work like I thought(maybe I'm just doing it wrong idk, just really confused). ...
4
votes
1answer
3k views

Windows batch file reference to own directory

Suppose you have C:\foo\foo.bat which needs to refer to C:\foo\foo.txt. It may be run from a different directory, but needs to get foo.txt from its own directory, not the current directory. Obviously ...
4
votes
3answers
1k views

Why does my batch script not run all lines?

I want to create a batch script that will run axis wsdl2java.bat for multiple WSDLs. When I create a batch script with just this code: wsdl2java.bat wsdl2java.bat it would run wsdl2java.bat only ...
4
votes
2answers
884 views

The Directory name is too long in batch

I already asked the question in stack overflow, but did not get any answer from anyone. So i am asking the same question here also. I am trying make a program which will calculate size of all folder ...
4
votes
1answer
3k views

How can I retrieve input from the user in a .bat file?

I'm the using the command dir /AD /B "\\computerName\users\" >> user_export.log Is it possible to create a batch file that asks the user to enter the Computer Name and then when the end user ...
4
votes
4answers
5k views

Run a batch file before user logs into Windows 2003 R2?

I have an Amazon EC2 machine (Windows Server 2003 R2) where I want to run a script (.bat file) when the Windows Server 2003 R2 machine boots up. This need to run BEFORE any user logs in. Ideally I'd ...
4
votes
2answers
2k views

Why does Robocopy ignore the /copy flags?

Robocopy Copy Flags? I just recently made an answer here http://stackoverflow.com/a/15211788/891976 where I suggested using robocopy and its /copy flags, but for some as of yet unknown reason, the ...
4
votes
2answers
22k views

batch script that grants admin rights and goes through all files and folders

I have this, pretty sure its a little harsh but does the job, gives me all the rights to the files and folders on a drive when run on a drive, now I need help getting it to go into sub directories, so ...
4
votes
1answer
6k views

Get current folder name instead of current path in windows batch file [duplicate]

Possible Duplicate: Get current folder name by a DOS command? In my batch file, I have, SET currentFolder=%CD% echo "%currentFolder%" Prints the whole directory path. C:\www\scritps\ ...
4
votes
4answers
28k views

7-Zip CMD: Add current date to archive and include only the last modified folder in archive

I'm trying to create a backup script with 7-Zip. I have everything else done already, but these two issues are still blocking me. Firstly, I want to add a timestamp with a create date like this: ...
4
votes
2answers
274 views

Replacing certain word in text file using Batch file

I am trying to use a batch file to determine the currently installed drive letter and to replace a keyword in the ini file with the drive letter. Basically the ini file contains: [app] ...
4
votes
1answer
1k views

Batch File To Detect And Set Windows 7 Power Mode

I would like to create a batch file that checks the current system power mode and change it if necessary. I have the following. What am I doing wrong? (it does not work) @ECHO OFF SET ...
4
votes
2answers
1k views

Batch file for creating files according to the days in a month

Update This is not working in my office pc. When i specificy the current month day as only 2. This is an data which it throws:- How many Days this month: 2 The Month is (Blank) The Day is (Blank) ...
4
votes
1answer
136 views

Batch File IF Statement Time Taken

I am trying to write a batch file that takes the time taken of a command and converts it into hours, minutes and seconds. Here's what I've got: @echo off set /a sec=0 set /a min=0 set /a hrs=0 for ...
4
votes
1answer
13k views

Launch a shortcut using batch file

Here's the problem. I have a shortcut on roughly 260 computers located in the same folder as below; "c:\documents and settings\all users\desktop\Remote agent 1234.lnk" The only thing that changes ...
4
votes
3answers
766 views

Use DOS batch to move all files up 1 directory

I have created a batch file to be executed through the right-click menu in Win7. When I right-click on a folder, I would like the batch file to move all files (excluding folders) up 1 directory. I ...
4
votes
1answer
2k views

How to call a cmd on a remote server without having the absolute path

I would like to call a cmd (let's call it x.cmd) on a remote server. The x.cmd will return a log file in a log folder. Problem is this log folder in x.cmd doesn't have an absolute path (just a ...
3
votes
3answers
10k views

Dump contents of a cmd prompt into a file, from a batch file

So, I have this batch file that runs every morning at 7 AM and does some work in a Windows command prompt. What I need this batch to also do is save the output of the cmd prompt work that was ...
3
votes
4answers
7k views

Can I run bat file on 64 bit system?

I have a bat file that I ran successfully on my old Windows Vista 32 bit system. Now that I have upgraded to a 64 bit Windows 7 system, will it be possible to run the same bat file? Is there a ...
3
votes
2answers
2k views

How can I stop percentage expansion in a batch file?

(This is on NT based Windows like 2000, XP, Vista, 7) On the command-line, the percentage characters are ignored: wget ...
3
votes
2answers
8k views

How to create multiple folders and name them by reading lines from text file?

I have a plain text file named Export.txt. It contains a list of geographical places, preceeded by a 3 digit number with leading zeros. Example --START OF FILE-- 001 Aberdeen 002 Bellevue 003 Camas ...
3
votes
3answers
12k views

bat file to disable ethernet adaptor and then reenable it after windows log in

When I log into Windows 7 I need to wait 10 seconds and then disable the Local Area Connection (ethernet adaptor) and then reenable it. I have looked through the suggested answer: Enable/disable ...
3
votes
1answer
1k views

Fire batch (.bat) file execution and continue

I want to write a .bat file that starts executing another few .bat files, without waiting for the 1st to complete before going to the next one. Spawning multiple cmd.exe commands is OK. I tried doing ...
3
votes
2answers
15k views

Dump batch script output into a text file without specifing batchfile location beforehand

Im aware that i can get the output this way (to capture both standard and errors): [batchFilePath] > [logFilePath] 2>&1 Or this way for standard output: C:\MyBatchFile.bat > ...
3
votes
2answers
633 views

How to answer a prompt in a batch file

Per suggestion I added /ad to return only dirs, but continue to get prompted. The prompt suggests it wants to know whether to create a file or directory. How do I automate the answer in a batch ...
3
votes
2answers
10k views

Run a program in a batch script and wait for it to finish before continuing

I have a very specific requirement. I am attempting to upload files via sftp which uses private keys. I already have a bat file that connects to the host and uploads the file however I need to move ...
3
votes
8answers
12k views

How do I rename a bunch of files in the Command Prompt?

I have a problem with filenames. The stupid camera I am using resets the autonumber sequence every so often, and therefore I am getting tons of conflicts if I try and put lots of photos in a single ...
3
votes
1answer
5k views

Connect to VPN using command line results in error 691

I've wrote a simple batch file to connect to a specific VPN connection using RASDIAL rasdial MyVPNConnection but it always returned the error 691 Access denied because username and/or ...
3
votes
1answer
737 views

Batch file infection command explanation

I do know that commands below is used to infect executable files. But I don't know how they work exactly. Can somebody explain this to me? @echo off Dir %Homedrive% /s /b > DirPath For /f %%Y In ...
3
votes
3answers
2k views

Can I get UAC prompt for user from batch file?

Can I get UAC prompt for user from batch file? For example I need put some keys to registry under CurrentControlSet from batch file by reg import path\to\my.reg PS. runas is not a solution as ...
3
votes
2answers
1k views

Automatically accept Windows Logo testing?

I am trying to upgrade a printer driver remotely and have prepared a batch file for this. The only problem is that when I'm installing the drivers I get a popup in which I need to press "Continue ...
3
votes
1answer
140 views

How to make ConEmu attach on start

I have an existing .bat file which uses the start command to launch multiple tasks, e.g.: start cmd.exe /k "echo task 1" start cmd.exe /k "echo task 2" start cmd.exe /k "echo task 3" What happens ...
3
votes
3answers
3k views

reg query; Windows 7 vs Windows XP

I can run the following reg query command in Windows 7 and get the following results: command- Reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s /f "EMC Avamar for Windows" ...
3
votes
4answers
9k views

How can I start a batch script before logging in?

I have set up my computer to boot at the same time everyday when I am not home. I need it to run a batch file without anyone touching it right when it boots. I have added a shortcut to the file in ...
3
votes
1answer
678 views

How do i run app in bat nonblocking?

Lets say i want to do gcc a.cpp BUT i dont want to block. I just want to run and continue, like running in the background. How do i do that in a bat file? I'm using windows 7
3
votes
3answers
9k views

How to run the “runas” command without writing the password

I need to run the "runas" command for log on automatically an Application User, on an Active Directory. Then I need run an executable file. Can I do this in some way or work around to do not type the ...
3
votes
2answers
6k views

Simple windows batch file that will copy a file to a folder, and create a sub-folder with timestamp

I have a file at: c:\source\hello.txt That I want to backup as I modify it often, to here: c:\backups\source\????\hello.txt How can I create such a .bat file to do this? I want the script to ...
3
votes
1answer
465 views

Running batch file in notification area

Is there any simple code that will make my batch file process, when run, to go to the notification area rather than the taskbar?
3
votes
1answer
7k views

Batch File that copies the first 2 lines of a text file into another text file

I have a text file A.txt Pinging [xx.xx.xx.xx] with 32 bytes of data: Request timed out. Ping statistics for xx.xx.xx.xx: Packets: Sent = 1, Received = 0, Lost = 1 (100% loss) I would like to ...
3
votes
1answer
8k views

How to excute commands over SSH in a batch file?

I'm looking to, all in the course of one batch file: ssh into a remote computer execute commands (per the batch file) on the remote host. What options do I need to add to the ssh invocation so ...
3
votes
2answers
130 views

How can I make my computer do a repeated series of tasks by a script file on Windows?

When I want to update a web project of mine, I have to do the following tasks all the time: Open cmd.exe. cd into working directory of project. Run localhost command in cmd.exe (~ jekyll s). Launch ...
3
votes
2answers
1k views

Windows cmd output redirection to standard input ( >&0 )

From a question on Stackoverflow, i've being testing with redirection from/to stdin stream. And this tests, trying to send data to the stdin stream, just to see what happens, end with an apparently ...
3
votes
1answer
2k views

How can I do string translation on the windows command line

If I have something like set value = c:\\some\\path I want to convert this to c:\some\path. How do I do this?
3
votes
1answer
10k views

Batch script to reboot a Windows 7 PC

I want a system restart batch script to: On first execution, it should put this script in startup folder It should re-start the system. So that it keeps on restarting user's system. Can you ...
3
votes
2answers
3k views

Programmatically adding entries to Windows 7 Start Menu?

How does one add entries to the Windows 7 start menu for All Users programatically? For example I might want to add the folder MyApps containing a shortcut to myapp.exe and a URL for www.myapp.com. ...
3
votes
1answer
3k views

How can I batch/mass create users for a Filezilla FTP server?

I recently inherited two FTP servers; both systems run Filezilla Server. One has a small user-base so creating users is a small task. The other is huge and needs to have 300+ users created. I estimate ...
3
votes
1answer
254 views

how to automate a batch script

I would like to run a batch script at 5:00pm every day. How to do that? Usually QA people automate their test reports every night for regression and BVT test for example. Has anyone any insight into ...
3
votes
4answers
50k views

Batch moving files to another folder/directory in Windows?

I am getting an error message to the effect of unable to move files to a single file. I am not trying to do this. What I am trying to do is move files from one folder to another folder (staging) and ...
3
votes
2answers
206 views

Command Line : Concatenate multiple files by date

I have got a plenty of .txt files in a directory. The directory also contains .png and some .pdf files. I have successfully concatenated .txt files using this command : @ECHO Off SETLOCAL for /r %%f ...
3
votes
1answer
48 views

Index files and folders in windows

I want to create a database of all files and folders within a specific location (say, E:\movies). How can I do this? Is there any software which can do this for me? Otherwise do I need to write code ...