Text file containing a sequence of commands or program invocations.

learn more… | top users | synonyms (1)

1
vote
1answer
2k views

How to determine the current directory in a batch file

How can I determine the current directory in a batch file. Other than %~dp0. So that when I run the batch file from source folder (consisting of my files) it returns the path of source folder, where ...
0
votes
1answer
185 views

Start EXEs from bat file

In the command line I can easily write start my.exe however when I do that in a bat file and execute it I get a cmd window called my.exe. How do I start exe's and shortcuts from a bat file? The bat ...
1
vote
1answer
4k views

Batch file equivalent in Linux

I have a few basic commands that I need to run on a Red Hat Linux 5 Virtual Machine with GNOME to start a couple servers. Example cd /home/user/scripts sh runTHISthing.sh pub cd /home/user/logs ...
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
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 ...
1
vote
1answer
1k views

A batch script for creating a folder for each file

It might be a duplicate of this but I need a little revision: Creating a folder from first 5 characters of filename in a batch file I don't need to select the first five letters of the file. I want ...
2
votes
1answer
191 views

Can I prompt a user to save a file using windows explorer?

I'm trying to build a windows batch file that will copy a folder and all its contents from the local user directory into an individually named folder on a shared server. The name of the folder on the ...
1
vote
1answer
400 views

If I wanted to use a batch file to restart 3 programs how would I do that?

I want to create a batch file that when ran it will exit 3 separate applications, wait a few seconds and then relaunch the same applications. Can someone assist me with some resources for ...
1
vote
1answer
1k views

Rasdial error 756 only solved by rebooting

I have a very frustrating issue with a VPN connection initiated with Rasdial. I have computers (Windows XP Professional SP2) which serve as an unmanned field measuring devices. They automatically ...
0
votes
4answers
1k views

Writing scipt to open multiple applications with a username/password

Is there a way to write and run a script that will enable me to: Run an app with a username/password Have that script carry out a few simple shortcut commands (ie connecting to and receiving from ...
0
votes
2answers
1k views

Run batch file on startup NOT LOGON

I want to run a batch file that maps a network drive but all of the solutions I have found run the script in the start-up folder which isn't really what it says it is. How do I map the drive BEFORE ...
2
votes
1answer
9k views

Windows 7 batch files: How to write string to text file without carriage return AND trailing space?

I am trying to have my batch file write a string of text to a text file. At first, the command I was using was writing an extra carriage return to the end of the string, but I found this command that ...
0
votes
2answers
1k views

Checking if a remote Tomcat server is running from Windows?

I am using Windows 7, and I have a remote Linux machine that runs a Java application in Tomcat (on port 8080). Sometimes, the remote machine is up but Tomcat doesn't respond. How can I code something ...
0
votes
2answers
933 views

Copying a folder into multiple folders

I have a folder with some content which I want to copy into 260 folders. I guess this is doable with a bat-file and a for-loop, but I can't seem to understand how to do it. Anyone keen to help? :)
23
votes
4answers
74k views

Remove USB device from command line

I'm constructing a backup script for Windows 7, and the last action I want it to perform is to safely "remove" the USB drive that it is backing up to. I am under the impression that plugging the drive ...
2
votes
1answer
13k views

How can I read a comma delimited text file in a Windows batch file?

I can get it to read the text file until it becomes a comma delimited text file. I would like to read the two variables on each line and test each one with a If statement for another condition. ...
2
votes
2answers
4k views

How can I set a time-limit on a batch file?

I have a batch file that calls an external program that periodically hangs. What I would like to do is set a time limit on the batch file / CMD prompt such that it automatically closes after a ...
0
votes
1answer
556 views

Is there a way to have a choice command in batch files - and wait less then a second

I want to do a pretty simple [y/n] question via batch. Can I make it wait less then a second before it automatically selects the default choice? Something like choice /d Y /t .5
0
votes
0answers
37 views

For /F command doesn't output anything to file or command line? [duplicate]

Possible Duplicate: Windows command FOR /F isn't working? I have a text file 'dist.txt' and it contains 'dist name,alias' on every line. I basically want to loop through the file and ...
0
votes
1answer
631 views

Run a .bat file upon logoff, windows XP, no domain controller

I have a standalone windows XP machine which is using pGina 1.8.8 to authenticate. Users log in using a single-sign-on ID (from LDAP) and are then logged into windows XP pro. I have a batch file which ...
1
vote
1answer
5k views

Better-quality FFMPEG conversion from MTS to AVI

I got the following code from some forum. I'm a beiginner, so please bear with my questions ... I need to convert a video from MTS to AVI in very good quality. Currently I'm using the following code ...
1
vote
1answer
20k views

Add registry key via batchfile

I'm trying to create a registry key with a batch file. I really need to be able to do this via a batch rather than a VBscript or .reg file. So far by using this guide, I've come up with this. but ...
2
votes
1answer
63 views

command line with spaces

I want to do a command line like: for /F "tokens=4" %%F in ('c:\spaces spaces\filever.exe /A /D D:\Spaces Other\a.dll') do (set VERSION=%%F) I encounter a spaces problem. How can I write that ...
0
votes
1answer
137 views

copying files with certain extension and overwriting

I do this often and I've seen similar questions but not quite the same. I want to copy from z:\foo to c:\bar all .cfm files and overwrite any conflicts. I also want to keep the directory structure ...
0
votes
2answers
2k views

Windows Batch FINDSTR searching for “” and < >

These two work seperately but I can't get then to work on the same line, and then to redirect to a text file.. FINDSTR "\""" testingbatch.txt > results.txt FINDSTR "< >" testingbatch.txt ...
2
votes
2answers
930 views

What is the command to check if a command's results mention OK?

Alright, so I was playing around with changing MTU size and wanted to make a batch file to automatically lower it and then raise it later. This is probably simple, but I just can't figure it out. ...
1
vote
1answer
1k views

Run windows batch file from ssh login - env vars missing

I am trying to run a windows batch file from a ssh login. I have successfully installed cygwin w/ OpenSSH on the server (windows 2003). I can log in and run the file, but the file does not run ...
10
votes
3answers
4k views

How can I tell which “explorer.exe” process is the main one?

I have a batch file that changes a few registry files, and then restarts explorer.exe so that they take effect. I'm using the commands taskkill /f /im explorer.exe explorer.exe This of course ...
0
votes
1answer
673 views

Script with .vbs (Internet Options\Browsing History\Settings)

I need to create a logon script that changes this option. It can either be a batch file or a .vbs "Internet Options\Browsing History\Settings\Check for Newer Versions of stored pages" Anybody have ...
0
votes
3answers
5k views

run 'net user' command as administrator

I was writing a simple batch file with the following command net user Abhi * where Abhi is my username and I am the administrator of my computer. On execution, it prompts for a password and then ...
1
vote
1answer
3k views

Batch file in right click menu

I'm making a batch file that is going to encrypt information. I made it so when I right click on the object and click on the "test" button it runs the batch file. In regedit I added ...
0
votes
1answer
3k views

Batch file - wait or quit if a process running

I have 2 small batch files that change the target location of a junction point (mkref /d), in order to switch between 2 iTunes libraries. It works well, but I would like it to stop if iTunes is ...
1
vote
1answer
2k views

How to run a .bat file as administrator automatically each time when I start a specific program?

In order to speed up my computer start time I disable the VM services in startup; and those services are mandatory for me to start the VMware Workstation when I need to use it. So I wrote a simple ...
26
votes
4answers
386k views

How can I check a system's current NTP configuration?

I need to verify the current NTP configuration on some Windows systems. Ideally, I'd like to be able to do this via command line instead of navigating through configuration screens. (I'm working on ...
0
votes
1answer
176 views

How to tell EXIST to look also in the path directories in windows batch file

I'm trying to do this simple thing on windows but it always fail and i think that the cause is that it's not looking in the PATH variable, how should i do? IF EXIST lessc.cmd ( lessc ...
0
votes
3answers
1k views

Which tools bundled with windows can be used to upload a text file to the web?

I have a text file, and I want to post its contents to a webserver. I would like to do it using applications that come bundled with Windows. I don't mind writing a batch script to do it. But I don't ...
25
votes
6answers
161k views

In Windows 7, how to change proxy settings from command line?

How do I change proxy settings from command line in Windows 7? I'm not talking about just the http_proxy. I need to set system-wide proxy settings (the ones in Internet properties setting). How ...
0
votes
1answer
776 views

Extracting file using 7-Zip is taking too much time

I am trying to extract a ZIP folder using 7-Zip from the command line: 7z x "%BackupFileDestination%" -o"%ExtractDestinationDir%" It is taking too much time to do so. It is even hanging on a few ...
5
votes
2answers
26k 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 ...
1
vote
2answers
324 views

Having problems writing a list of simple commands in a batch file

I am trying to run a few simple batch commands in one batch. For that matter each command is a batch command as follows: rails generate scaffold illness name:string rails generate scaffold ...
1
vote
3answers
1k views

How can I create a popup in Windows with the results of a command called in a .bat file?

I'm calling an exe in a .bat file that returns quickly and I'd like to popup a message box with the results of the text so I can read it (after the program has ended). My .bat looks like this: ...
0
votes
2answers
3k views

Cut a part from a filename (windows batch)

I got files named like this: cam1(word1 word2 wordN) (24-04-2012 00-11-13).mpg cam2(word1 word2 wordN) (24-04-2012 00-11-13).mpg cam3(word1 word2 wordN) (24-04-2012 00-11-13).mpg Need to cut (word1 ...
0
votes
2answers
761 views

WinXP SP3: run batch file when system returns from hibernation

I want to run a *.bat file every time system returns/"wakes up" from hibernation (NOT a sleep mode). How can I do that? System: Win XP SP3. I would very strongly prefer to solve it without using 3rd ...
1
vote
1answer
2k views

Using plink to establish a tunnel for the duration of a batch script

I have a batch script that synchronizes data between a local machine and a machine that can be reached over an SSH tunnel. Rather than leaving the tunnel open all the time, I'd like it to start when ...
0
votes
1answer
2k views

batch file execution failing with PostBuildScript plugin of jenkins

I am trying to execute a batch file to copy my files to another server under the "Execute batch or shell script" option of the "PostBuildScript" plugin of Jenkins. These are the commands in my .bat ...
2
votes
2answers
876 views

How to compile .bat file using QT Creator

Question: How do I compile a .bat file using QT Creator? More info: specifically, I am trying to install Windows Image Writer and the download only includes source files. The README.txt tells me to ...
2
votes
2answers
10k views

'C:\Program' is not recognized as an internal or external command

In Win 2003 I execute command "C:\Program Files\Windows Resource Kits\Tools\robocopy" "q:\SQLBackup" "\\SQLBackups\MyDB" /Z /S /MIR I am getting an error: 'C:\Program' is not recognized as an ...
3
votes
1answer
776 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
2
votes
3answers
18k views

Redirect pipe to a variable in Windows batch file

I want to stop and start a Windows service from a remote PC using the Windows command line, in a batch file. sc \\192.168.1.1 stop <ServiceName> rem sc \\192.168.1.1 query <ServiceName> ...
0
votes
2answers
2k views

Unable to copy files from protected folders

When I try to run the following copy %HOMEPATH%\"My Documents"\test.txt %CD% from c:\backupSettings I get the error: Access is denied. 0 file(s) copied.