batch-file

Conditional PAUSE (not in command line)

I like to have a final PAUSE in my *.bat scripts so I can just double click on them in Windows explorer and have the chance to read the output. However, the final PAUSE is an annoyance when I run the same script from the command line. Is there any way to detect whether we are running the script from a command prompt (or not) and insert ...

Run bat as current user

Lets say that i open 1.bat which opens 2.bat i want the 3.bat to open with rights of the user current logged in and doesn't prompt for password Edit:i forgot to tell that 1.bat runs under system ...

How to create a batch file that accepts two integers as parameters

I am just beginning to learn command line scripts, and I have an assignment for school in which the first part is to create a batch file that accepts two integers as parameters. The integers will be subsequently manipulated throughout the question, and I am not looking for any help with that. I have googled this many different ways, an...

How to run a batch file over a period of time repeatedly : Scheduling a task

I've a task(.bat file) which should be performed/executed after every 15mins. I don't know where to make its entry so that it'll be scheduled? With this, I want to see the execution(progress) of the task running(in command prompt). ...

Trying to edit the registry in Windows with a batch file

I am supporting a few offices across the country running Windows XP. They are stand alone, no Windows Server or Active Directory, anything like that. I just switched them over to Google Apps, and in the process replaced Windows Live Messenger with Google Talk. I really want to stop Windows Live from being used, the platform sends so much...

Batch File/Script Delete every 3 files in a directory

I have a folder with sequentially named images (a0001, a0002, a0003, etc.) and I was wondering if there was a way to delete every 3 files without touching the others. So for example, I have: a0001, a0002, a0003, a0004, a0005 a0006, a0007, a0008, a0009 And after I would like to have: a0001, a0005, a0009 ...

Windows Bat file optional argument parsing

I need my bat file to accept multiple optional named arguments. mycmd.bat man1 man2 -username alice -otheroption For example my command has 2 mandatory parameters, and two optional parameters (-username) that has an argument value of alice, and -otheroption: I'd like to be able to pluck these values into variables. Just putting out ...

Paste a prefix into selected input field

Hi im using a .bat File via windows Shortcut to tag freshly created files vith a prefix containing the actual date. Id like to run this while saving any file in whatever application. set var= %DATE% set datu=%var:~7,4%%var:~4,2%%var:~1,2%_ echo %datu%|clip now when I run the shortcut my cursor exits from the actual input field. I'll...

Make Multiple Directories in Windows From Batch File

I would like to change the following batch file to use spaces instead of underscores. However, when I do that the directories come out weird. I've tried using quotation marks, but they come out wrong. md Sample_sample md Sample_sample\sample md Sample_sample\sample2 md Sample_sample3 md Sample_sample2 md Sample_sample\sample\sample PS...

Convert .bat file to .sh file

I have to convert the following .bat code in the .sh code echo Setting Bonita Environment variable set "JAVA_OPTS=%JAVA_OPTS% -Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory" set "JAVA_OPTS=%JAVA_OPTS% -Djava.naming.provider.url=jnp://localhost:1099" set "LOG_OPTS= -Djava.util.logging.config.file=D:\jboss-5.0....

A batch file to download and delete files from a server

Hi, How can i write a MS dos ftp batch file to: download files from the server to my local pc remove these files from the server after download cheers! Edit ok so far i have... Batch file: ftp.exe -s:ftp.txt FTP.txt: open domain.com usernamehere passwordhere cd /httpdocs/store/files need get, list an...

Cmd : not evaluating variables inside a loop

Hi guys, trying to make a .bat script, and need to get some strings working properly. This is what I've got so far @echo off for /r %%i in (*.csv) do ( set str=%%i set str=%str:csv=rar% echo %%i echo.%str% ) Say I've got this running in C:\, and got 5 csv, 1.csv, 2.csv... 5.csv First time I run it, I get output of: C:\1.csv C:\2.c...

Make command line stay open when running a bat file

I want my batch file to stay open after processing is complete. Here is my code: set CLASSPATH=C:\XSLTANT\examples\word_transform\apache-ant-1.8.1\bin set PATH=%CLASSPATH% ant >> transform.log echo "See transform.log for results" pause It closes instantly after it runs the ant build. Any ideas? Thanks. ...

create a log from a batch file

I have a batch file (.BAT) and would like to capture its output into a file automatically every time it is run. I know I can use redirection but then I wouldn't be able to watch it as it's running. Also, other people use this batch file and I want the log to be created without the user having to do anything special. ...

Delete temporary files on startup

I have a program which when it runs it fills Temp folder with lots of .tmp files. This is causing C drive to fill up. I have been asked to investigate if it's possible to write a script in dos to delete temporary files on startup. I also wish to delay the program starting until all files are deleted. This would need to happen every time ...

Why does only the first line of this Windows batch file execute but all three lines execute in a DOS command shell?

I have a batch file that executes three Maven commands, one after the other. Each command can be successfully executed in the script - by itself!. But when I add all three commands to the same file, only the first one executes before the script exits. Any idea why? mvn install:install-file -DgroupId=gdata -DartifactId=base -Dversion=1.0...

Embed VBScript inside Windows batch file

Is it possible to embed VBScript within a batch file? I currently have a .CMD file that calls a .VBS file using cscript //NoLogo MyScript.vbs but I'd prefer to distribute just a single .CMD file. ...

help in creating a batch script

Hi, I want a batch script which checks for a file(*.txt) for last 7 days in a folder. If the file are there, will ignore and exits. If there is no files in last 7 days, sent a alert email to [email protected] Thanks, Jay ...

How to Create Registry key using a batfile

Need to Create a Registry Key using bat file.Can I create Reg Key using Command prompt or a bat file. The main purpose behind this , I want to create envoirment variable using bat file. ...

How to get output of a FOR loop into a variable in a batch file

I have a file like this, that needs to be parsed and needs to extract a version number. [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible [assembly: AssemblyFileVersion("0.4.2")] ... ... I need to parse it and extract the 0.4.2 from it. I ha...