tagged [batch-file]

Stop and Start a service via batch or cmd file?

Stop and Start a service via batch or cmd file? How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?

23 Apr at 19:49

How do you loop through each line in a text file using a windows batch file?

How do you loop through each line in a text file using a windows batch file? I would like to know how to loop through each line in a text file using a Windows batch file and process each line of text ...

24 Mar at 14:12

check if command was successful in a batch file

check if command was successful in a batch file How within a batch file to check if command was successful or produced an error? I want to use if/else statements to echo this info out.

24 Sep at 19:37

How can I run a program from a batch file without leaving the console open after the program starts?

How can I run a program from a batch file without leaving the console open after the program starts? For the moment my batch file look like this: The program starts but the DOS Window remains open. Ho...

4 May at 11:5

Iterate all files in a directory using a 'for' loop

Iterate all files in a directory using a 'for' loop How can I iterate over each file in a directory using a `for` loop? And how could I tell if a certain entry is a directory or if it's just a file?

23 Oct at 11:2

How to replace substrings in windows batch file

How to replace substrings in windows batch file Can anyone tell me using batch file in windows ...how to read from a file and replace string=`bath` from file containing=`bath Abath Bbath XYZbathABC` w...

4 Nov at 21:10

How to read input from console in a batch file?

How to read input from console in a batch file? How do I read input from the console in a batch file? What I am trying to achieve is the functionality of scanf in C. How can I do the same in a batch f...

5 Mar at 02:5

Append text with .bat

Append text with .bat I want to create a log of every operation processed in a batch file and used the following but to no avail. How do I fix it (the file was not created)?

30 Jul at 14:35

How to change the icon of .bat file programmatically?

How to change the icon of .bat file programmatically? I'd like to know what's the way to actually set the icon of a `.bat` file to an arbitrary icon. How would I go about doing that programmatically, ...

15 Apr at 19:8

concatenate variables

concatenate variables I need to do a .bat for DOS that do the following: so after defining ROOT I want to have SRC_ROOT = c:\programas\System\Source How can I do that?

16 Feb at 08:55

batch file to copy files to another location?

batch file to copy files to another location? Is it possible to create a batch file to copy a folder to another location everytime I login, or when the folder is updated? It could be written in VB or ...

4 Jan at 09:39

Open a Web Page in a Windows Batch FIle

Open a Web Page in a Windows Batch FIle I have a that does a bunch of things and at the end needs to to a page. Is there a way to, in essence, call `ShellExecute` on a to open the web page? Windows Co...

6 Oct at 20:39

How to get the path of the batch script in Windows?

How to get the path of the batch script in Windows? I know that `%0` contains the full path of the batch script, e.g. `c:\path\to\my\file\abc.bat` I would `path` to be equal to `c:\path\to\my\file` Ho...

7 Mar at 09:40

Run exe file with parameters in a batch file

Run exe file with parameters in a batch file Please have a look at my batch file. but it isn't working. Any ideas how do I get it working?

Execute a batch file on a remote PC using a batch file on local PC

Execute a batch file on a remote PC using a batch file on local PC I want to execute a batch file > D:\apache-tomcat-6.0.20\apache-tomcat-7.0.30\bin\shutdown.bat Which is on my server `inidsoasrv01`. ...

14 Mar at 15:38

How can I pass arguments to a batch file?

How can I pass arguments to a batch file? I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file. Here's what the command line looks like:

30 Jan at 10:3

How to test if a file is a directory in a batch script?

How to test if a file is a directory in a batch script? Is there any way to find out if a file is a directory? I have the file name in a variable. In Perl I can do this:

13 Mar at 21:44

How can I programmatically change a value in the Window's Registry?

How can I programmatically change a value in the Window's Registry? I need to programmatically change the "Level" String found in \HKEY_CURRENT_USER\Software\Intuit\QBWebConnector to "Verbose" What is...

22 Jul at 18:56

How to delete multiple db entities with Nhibernate?

How to delete multiple db entities with Nhibernate? What is the best practice for this problem? Is there any batching features built-in? Sample code: Thanks in advance.

Replace or delete certain characters from filenames of all files in a folder

Replace or delete certain characters from filenames of all files in a folder How do I delete certain characters or replace certain characters with other characters by some batch file execution, for fi...

13 Jan at 00:20

Bat file to run a .exe at the command prompt

Bat file to run a .exe at the command prompt I want to create a .bat file so I can just click on it so it can run: Can someone help me with the structure of the .bat file?

8 Mar at 20:22

Pass parameter from a batch file to a PowerShell script

Pass parameter from a batch file to a PowerShell script In my batch file, I call the PowerShell script like this: Now, I want to pass a string parameter to `START_DEV.ps1`. Let's say the parameter is ...

2 Dec at 12:0

CALL command vs. START with /WAIT option

CALL command vs. START with /WAIT option How is the START command with a WAIT option ...any different from using a CALL command? Is there a situation where one may behave differently that the other de...

18 Dec at 12:9

How to ftp with a batch file?

How to ftp with a batch file? I want a batch file to ftp to a server, read out a text file, and disconnect. The server requires a user and password. I tried but it never logged on. How can I get this ...

22 Apr at 23:3

Resolve absolute path from relative path and/or file name

Resolve absolute path from relative path and/or file name Is there a way in a Windows batch script to return an absolute path from a value containing a filename and/or relative path? I need the absolu...