dos-batch

how to set date to current date using dos batch file command.

how to set date to current date using dos batch file command. ...

Windows batch assign output of a program to a variable

I need to assign the output of a program to a variable using a MS batch file. So in GNU Bash shell I would use VAR=$(application arg0 arg1). I need a similar behavior in Windows using a batch file. Something like set VAR=application arg0 arg1. Thanks! ...

Dos command to execute all sql script in a directory and subdirectories

Hi, I need a DOS command or a batch (.bat) file I can execute to run all the *.sql script in a directory and it's subdirectories. Any ideas? ...

Running batch script as windows service.

Hi All, We have a java application which run as server running on a remote windows system which is started though a batch script which includes some initialization configurations. To avoid login into the system every time and starting / stopping the service I planned to add that batch script as a "Windows Service" and use it remotely ...

Get parent directory name for a particular file using DOS Batch scripting

Hello, I need to find the name of the parent directory for a file in DOS for ex. Suppose this is the directory C:\test\pack\a.txt I have a script which asks me the file name C:\\>getname.bat enter file name: c:\test\pack\a.txt now the script should return just the parent name of the file. pack and NOT the ...

Batch : Renaming a folder in 'program files'

I need to write a batch to rename a folder in Program Files. I'm able to do it through the Explorer, so I guess I have all required rights. But when I write something like this in a command line : move "C:\Program Files\Ceebot4\train" train_old I get the following error : Access denied. Is it possible to do it ? ...

how to assign an ip address to a variable in batch

Hi all, I have assigned ip address to a variable in the following way. set /A myvar = 10.0.0.1 echo %myvar% but it is giving the result as only 10 not entire ip address.. so can some give the solution for it ...

How do you enter something at a DOS prompt Programmatically?

I have program, that must interact with at DOS program before my program can continue what it is doing. I'm trying to avoid my user from having to interact with this dos program. So, I created a .bat file that does everything I need to do except for the last step which still requires user interaction that I'm trying to avoid. Specifical...

Escaping an equals sign in DOS batch string replacement command

I need to replace some text in a JNLP file using a DOS batch file to tune it for the local machine. The problem is that the search pattern contains an equals sign which is messing up the string replacement in the batch file. I want to replace the line, <j2se version="1.5" initial-heap-size="100M" max-heap-size="100M"/> with specific...

command CHOICE in DOS batch replacement/reproduction in python

I want to reproduce the behavior of the command CHOICE in DOS batch but with python. raw_input requires the user to type whatever then press the ENTER/RETURN key. What I really want is for the user to press a single key and the script to continue from there. ...

dos batch iterate through a delimited string

I have a delimited list of IPs I'd like to process individually. The list length is unknown ahead of time. How do I split and process each item in the list? @echo off set servers=127.0.0.1,192.168.0.1,10.100.0.1 FOR /f "tokens=* delims=," %%a IN ("%servers%") DO call :sub %%a :sub echo In subroutine echo %1 exit /b Outputs...

How to run a powershell script within a DOS batch file

How do I have a powershell script embedded within the same file as a DOS batch script? I know this kind of thing is possible in other scenarios: Embedding SQL in a DOS batch script using sqlcmd and a clever arrangements of goto's and comments at the beginning of the file In a *nix environment having a the name of the program you wish ...

DOS batch file to enter commands in proprietary java app and receive feedback?

Hello, I'm working on a project in which I'd like to be able to turn lights on and off in the Duke Smart Home via a high frequency chirp. The lighting system is called Clipsal Square-D and the program that gives a user access to the lighting controls is called CGate. I was planning on doing some signal processing in Matlab, then creat...

How can I check the mysql connection for a user/password using batch/shell script

Hi, How can I check the mysql connection for a user/password using batch/shell script? I've user name and password, and I need to authenticate whether they are correct or not, but how? I tried this way: I've created a batch file "run.bat" with "mysql -u User--password=UserPassword < commands.sql" "commands.sql" file contains "\q" Wh...

Read ini from windows batch file

I'm trying to read a ini file with this format: [SectionName] total=4 [AnotherSectionName] total=7 [OtherSectionName] total=12 Basically I want to echo out certain values from the ini file(eg. the total under OtherSectionName followed by the total from AnotherSectionName). ...

dos batch programming: howto get and display yesterday date

i am using the date command for a dos script. i am wondering how to use dos command "date" to get yesterday date. ...

Copy & rename file using .bat file language?

I want to make a .bat to copy & rename a file multiple times. I want to have a list of names, and an original file, then I want to copy that file and rename it for each name on the list. How I can do this using a .bat file? Also is it possible to run winrar fromthe .bat to .rar or .zip every file after copying/renaming? Example: $fi...

Write/read count to txt file

Hi, I need a batch file that writes the count number to a txt file. Next time the batch file is run, it should read the current count number from the txt file and add 1 to count and save this new value in the txt file. (nothing else is in the txt file) When count is >5 it should start from 1 again Example: Count.bat runs 1 time: coun...

Batch file to wait for other program to load/initialize, then execute command?

I need some assistance writing what should be a fairly basic .BAT file. I load my main program, but that program takes ~20secs to load and be initialized. I have another command-line API I can execute to interact with this above program, but obviously until the above program is loaded and initialized there's no point in trying. If the...

.bat for shutdown/reboot on xp loop problem

hello! i have a little problem... on win xp, if i write on commandline shutdown -t 00 -r -f the reboot works fine. but if i paste it, as is, in a bat file...the prompt show me an infinite loop. anyone can say me why? thanks a lot for any suggestion :) ...