Im trying to get a value (IP address) from a W3C logfile (kinda like a text file). This is what I have so far but with no luck:
Set filename=ex%date:~-2,4%%date:~-10,2%%date:~-7,2%.log
For /F "tokens=2 delims=: . " %%A in ('E:\WINDOWS\system32\LogFiles\MSFTPSVC6141885\%filename%') do (Set ip=%%A)
and the log file looks like:
# So...
I have tried with the following, but it just says "& was unexpected at this time."
@echo off
:enter-input
echo Please enter a number between 1 and 15:
echo 1 = Selection one
echo 2 = Selection two
echo 4 = Selection three
echo 8 = Selection four
echo x = Quit
set INPUT=
set /P INPUT=Type number: %=%
if "%INPUT%" == "" goto enter-input...
I have a simple bat script that copies files from an known directory to a directory given by the user. How can I pass the path (it might contain spaces) to my script and use it with the xcopy command?
...
I would like to run a bat script on one of the machines on the domain, from my asp.net application. Machine with the batch script is a temporary storage machine, and script synchronizes it with the permanent storage machine. So, what is the optimal way of doing this?
The thing I tried is to use PsExec to run a script on the remote machi...
I want to distribute a command-line application written in Java on Windows.
My application is distributed as a zip file, which has a lib directory entry which has the .jar files needed for invoking my main class. Currently, for Unix environments, I have a shell script which invokes the java command with a CLASSPATH created by appending...
I have to write a bat script for a test scenario where the software that we are testing fails to write to file due to a disk full error. The test script must be automated, so that we can run it on overnight tests, for example. The test script must also work at different computers, so installing a software like a virtual machine wouldn't ...
I have this .bat script which I use to maven package my application. Problem is, just after it ends execution, it closes the console window. The last 2 lines somehow are completely ignored.
Does anyone know the trick to make this work?
I just want to have a quick check if the build was successful.
@echo off
cls
cd C:\svn\project
mvn pa...
We have some complex bat files where one calls another, which calls yet another. All of them have a @echo off at the top.
For debugging, I would like to selectively turn echo on in some of them. What is the easiest way to do this? Some ideas I have so far:
Change the setting only in top level files. But this will only work for the few...
I am trying to move certain lines from one .txt file to another. These lines all follow a certain pattern. I have been looking at using the find command in a batch file, but this does not delete the line from the original file.
For example:
find \i pattern "d:\example1.txt" >> "d:\example2.txt"
Is there any way to achieve this?
Th...
What is the order in which the Windows command prompt executes files with the same name but different extensions?
For example I have a bunch of executable files (something.cmd, something.bat, something.exe), which of these would be executed when I typed "something" into a command prompt (given they were on the path etc). If that file di...
how to get the output in column wise in a below batch file
@echo off
setlocal enableextensions enabledelayedexpansion
set Counter=0
for /f "usebackq tokens=2,5,6 delims= " %%a in (`findstr /c:"Cod "
1231.txt`) do (
set x=%%b
set x=!x:~3!
set y=%%c
if %%c LSS 10 set y=!y:~1!
set item!Counter!=%%a-!x!#!y!
set /a ...
Exact Duplicates:
How to write a batch file to delete the files which are 5 days or older from a folder?
write a batch file to delete 6 days older files from a folder
write a batch file to delete 5 daya older files from a folder
How do I write a batch file to delete folders and files on a time basis?
How do I create a batch script that...
Exact Duplicates:
How to write a batch file to delete the files which are 5 days or older from a folder?
write a batch file to delete 6 days older files from a folder
write a batch file to delete 5 daya older files from a folder
How do I create a batch script that will delete a folder on a scheduled basis?
write a batch file to remove ...
bash, bat, whatever...
What is your favourite command line hyperproductivity trick?
...
I have a batch (bat / cmd) file which should act as a filetype handler for jpeg files in Firefox, I just want it to copy the file to another folder, and then open the file in the Picasa Viewer. When I run it from the command line, even if I'm running it from another folder, it works fine, and opens Picasa Viewer. However, when setting it...
I need to problematically change the "Level" String found in \HKEY_CURRENT_USER\Software\Intuit\QBWebConnector to "Verbose"
What is the best way to do this? C#, bat file? I have never tinkered with the registry before...
Thanks.
...
I am writing a batch file for execute some other programs. In this case I need to prompt for a password. Do I have any way to mask the input text. I don't need to print *** characters instead of input characters. Linux's Password prompt behaviour (Print nothing while typing) is enough.
@echo off
SET /P variable=Password :
echo %vari...
I'm wonderin' how I can write a script to calculate the time the script took to complete.
I thought this would be the case, but obviously not..
@echo off
set starttime=%time%
set endtime=%time%
REM do stuff here
set /a runtime=%endtime%-%starttime%
echo Script took %runtime% to complete
...
I have a simple python script like so:
import sys
lines = sys.argv[1]
for line in lines.splitlines():
print line
I want to call it from the command line (or a .bat file) but the first argument may (and probably will) be a string with multiple lines in it. How does one do this?
Of course, this works:
import sys
lines = """This...
Hey guys
Just building a batch file to delete temp files on my vista machines @ home that i want to add to task scheduler. i have this so far, but i get alot of access denied, and it never finds a thumbs.db file or index.dat and there are heaps of them. what am i doing wrong?
attrib +a -s -h -r "%windir%\Temp\*.*" /s
del /f /s /q "%...