I need to grab the folder name of a currently executing batch file. I have been trying to loop over the current directory using the following syntax (which is wrong at present):
set mydir = %~p0
for /F "delims=\" %i IN (%mydir%) DO @echo %i
Couple of issues in that I cannot seem to pass the 'mydir' variable value in as the search stri...
Hi all,
How to use batch file to check if an application still running or not? If the application still running, this process will loop again and again. Else, there will be error message.
Thank you very much
...
Is it possible to use batch file (for XP) to call another batch file from different computer? if yes, how identify the target computer? Is it by IP comp ID?
...
How do I run a batch file each time windows boots up also I need to run it in the back ground(without that command window getting displayed)? I use Windows Xp.
My actuall requirement is I want to start the Tracd server using the command line commands whenever Windows boots up.
Thanks...
...
Think the title says it all :)
...
I want to have an executable file that will call some other programs. The way I would do this in Linux is with a simple bash script that looks like this:
#!/bin/bash
echo "running some-program"
/home/murat/some-program arg1 arg2
What's the best way to do this kind of thing under Windows?
...
I have a folder "FolderA" which contains three sub-folders: foldera1 foldera2 and foldera3
I need to write a batch file which resides inside "FolderA". It should delete all the folders under "FolderA" as a cleanup activity. I don't know the folder names. rmdir does not support wild cards.
Could someone provide a solution for this small...
I'd like to write a batch file that checks to see if a process is running, and takes one action if it is, and another action if it isn't.
I know I can use tasklist to list all running processes, but is there a simpler way to directly check on a specific process?
It seems like this should work, but it doesn't:
tasklist /fi "imagename e...
I created a simple batch file (.bat) containing a bunch of commands to be triggered automatically into the command window. The batch looks like this:
mmd dll1.dll -mf -aW
mmd dll2.dll -mf -aW
mmd dll3.dll -mf -aW
If I copy and paste the bunch of cmds into the command window, they are all correctly executed. However, if I try to direct...
I'm writing a simple .bat file and I've run into some weird behavior. There are a couple places where I have to do a simple if/else, but the code inside the blocks don't seem to be working correctly.
Here's a simple case that demonstrates the error:
@echo off
set MODE=FOOBAR
if "%~1"=="" (
set MODE=all
echo mode: %MODE%
) else (...
I have two SQL scripts which get called within a loop that accept a number parameter. Here is what I'm currently using:
for /l %%i in (1, 1, 51) do (
sqlplus u/p@name @script.sql a%%i.html %%i
sqlplus u/p@name @script.sql b%%i.html %%i
)
Everything works fine, but it seems like a waste of time and resources to connect twice fo...
How do I create a batch file to delete files older than a specified date?
This does not seem to work;
:: --------DELOLD.BAT----------
@echo off
SET OLDERTHAN=%1
IF NOT DEFINED OLDERTHAN GOTO SYNTAX
for /f "tokens=2" %%i in ('date /t') do set thedate=%%i
type %1
pause
set mm=%thedate:~0,2%
set dd=%thedate:~3,2%
set yyyy=%thedate:~6,4%
...
For the moment my batch file look like this:
myprogram.exe param1
The program start but the Dos Windows still open... how can I close it?
...
I have a file with n lines. (n above 100 millions)
I want to output a file with only 1 of 10 lines, I can't split the file in ten part and keep only one part, as it must be a little more random. later I have to do a statistical analysis I can't afford to create a strong bias in the data).
I was thinking of reading the file and for each...
I am writing a batch script which I wish to open a file and then change the second line of it. I want to find the string "cat" and replace it with a value that I have SET i.e. %var% . I only want this to happen on the second line (or for the first 3 times). How would you go about doing this?
...
Is it possible to run a batch file as a menu item in studio 2008?
...
how to create a shortcut for a exe from a batch file.
i tried
call link.bat "c:\program Files\App1\program1.exe" "C:\Documents and Settings\%USERNAME%\Desktop" "C:\Documents and Settings\%USERNAME%\Start Menu\Programs" "Program1 shortcut"
but it did not worked.
link.bat can be found at
http://www.robvanderwoude.com/amb_shortcuts.ht...
On a Unix systems it's very easy to compile the CLASSPATH by using find:
LIBDIR=`find lib/ -name \*.jar`
for DIR in $LIBDIR:
do
CLASSPATH="$CLASSPATH:$DIR"
done
java -classpath $CLASSPATH com.example.MyClass
What would be the aquivalent in a Windows batchfile?
...
I want to move about 800gb of data from an NTFS storage device to a FAT32 device (both are external hard drives), on a Windows System.
What is the best way to achieve this?
Simply using cut-paste?
Using the command prompt ? (move)
Writing a batch file to copy a small chunks of data on a given interval ?
Use some specific application t...
Hey All,
Having read an existing post on stackoverflow and done some reading around on the net. I thought it was time to post my question before I lost too much hair!
I have the following code within a batch file which I double click to run, under Windows XP SP3:
SETLOCAL ENABLEDELAYEDEXPANSION
::Observe variable is not defined
SET t...