Over 1 million tech questions and answers.

Batch file to Ping

Q: Batch file to Ping

I want to check few machines whether they are pingable or not by running a batch file. Please help me to check whether machines are reachable. Please share the batch file and I can edit it to check all the machines whether they are reachable.

RELEVANCY SCORE 200
Preferred Solution: Batch file to Ping

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: Batch file to Ping

This is pretty simple.

Just save a file as a .bat with ping and the IP addresses, one per line.

ie:

ping 192.168.0.1
ping 192.168.0.2

Read other 1 answers
RELEVANCY SCORE 69.6

Hey all,

I am in charge of searching for files at our clients' firms using a batch file. One issue I run into is that some computers at a firm may be left off, and so the search for the files is unsuccessful. It'd be nice to have a way to check if the relevant computers at a firm are on. As such, I am working on an automated ping batch file that reads IPs from a text file and logs the results to a batch file.

I am not so experienced with writing batch files, but I was able to cobble something together based on some code I saw online. However, it's not working--it logs IP addresses as responding whether or not they actually are. I have reproduced the batch code below. I assume that the problem has something to do with the error level. If someone could take a look and give me some pointers on getting the code to work (and perhaps some insight into why what I have doesn't work), I would greatly appreciate it. Thanks.
Code:
@echo off

Set CompList=complist.txt
Set PingListLog=pinglistlog.txt

If Not Exist "%CompList%" (

Echo Cannot find list of computers called %CompList%
Pause
GoTo :EndOfScript

)


echo Scanning began on %date% at %time% > %PingListLog%

for /f %%i in (%CompList%) do call :ScanLbl %%i

echo Scanning completed on %date% at %time% >> %PingListLog%

GoTo :EndOfScript

:ScanLbl

echo Scanning %1
set attrib=responding
ping -n 1 %1
if errorlevel 1 set attrib = nonrespons... Read more

A:Help making an automated ping batch file

Read other 6 answers
RELEVANCY SCORE 60

Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can...

First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg.

Here's the code that I'm using:

ffmpeg -i folder\video.mp4 -f mp3 -ab 160000 -vn "\different folder\music.mp3"

what I would like to do is add to this so that I don't have to write out this code for every file I have... :/

I have the mp4 files in one folder and than the mp3 files are saving to another folder.

So here's an example of what the code will do if it isn't clear yet.

Folder 1:

video1.mp4
video2.mp4
video3.mp4

what it should do is grab video1.mp4 and convert it.

ffmpeg -i folder\video1.mp4 -f mp3 -ab 160000 -vn "\different folder\music1.mp3"

and than move onto the next one

ffmpeg -i folder\video2.mp4 -f mp3 -ab 160000 -vn "\different folder\music2.mp3"

and than the next one

ffmpeg -i folder\video3.mp4 -f mp3 -ab 160000 -vn "\different folder\music3.mp3"

It's going to have to grab the name from the mp4 file and insert it for the mp3 file.

I can get around pretty good in cmd if it's basic commands but when it comes to something like this I'm a little confused...

Thanks for the help in advance!
I'll see what i can do about searching some more on what I would have to do and if I find the solution I'll post it here if it isn't already answered.

A:Batch File that grabs file names from folder to insert into batch file

A DOS "for /f" loop should do the trick, although changing the filename extension for the output to do everything in one line escapes me at the moment.

Perhaps you could do a dir .\folder\*.mp4/s/b > mp4s.txt, then make a copy of that and edit each line to rename the file to the destination name, and save it as mp3s.txt. Then you just feed both the source (mp4s.txt) and destination (mp3s.txt) filesnames into the for /f loop which handles the ffmpeg conversion.

Quite a crude solution and you'd have to handpatch the destination filenames, but i can't think of how to get a source mp4 filename and then just change the extension.

Read other 3 answers
RELEVANCY SCORE 59.2

Hi,
I have a question  that how to copy file from remote desktop user drive to my local machine using  xcopy or any other protocol.

This is my server path "\\Trail01" and here is the file location "c:\Users\ashique.sheikh\Desktop\Day2.R"
How can i give this is in my batch file. I have used this
net use "\\Trail01" "[email protected]" "/USER:ashique.sheikh"
XCOPY /Y \\Trail01\c:\users\ashique.sheikh\Desktop\Day2.R  "D:\VMI"
But its not working. It is give path error.
How can i download this or is there any other way to do it?

Read other answers
RELEVANCY SCORE 54.8

If someone can Please help, I just need the Data in the XML tag extracted to Batch File Variable....the rest i figured out and works great for the backup...just need the extracted tags...
thank you

i have a parent directory that contains a sub directory and a XML file that i need a batch to read 2 specific tags then create a Set command in the batch with those 2 lines to create a backup folder with the tags as the names and such. looks like this:

Parent Directory = XML
XML Folder contains > WJFKB02229001.D Folder & Config.xml File

I need to read the contents of the xml "Config.xml" extract the PhaseID Tag data "WJFKB02229001"
Also need to extract the BoxID "D", I don't need anything else on these seperate lines.

keep trying the following For /F command but no luck
Code:
[COLOR=red]for /f "tokens=1 delims=[" %%G in ("PHASEID" %path%\%myfile%) DO ([/COLOR]
[COLOR=red]set PhaseID=%%G[/COLOR]
[COLOR=red])[/COLOR]
[COLOR=red]echo Phase: %PhaseID%[/COLOR]
pause

and i've searched so many sites and forums with no real help on this one....the data is contained in the xml, weird enough i guess that it's enclosed in brackets "[", which all the forums i read and try it either replies with a blank variable being passed or says it can't find the file at all....

PLEASE HELP, lol

Code:

:StartSet
Set PhaseID="[COLOR=red][B][I]Extracted PhaseID from xml[/I][/B][/COLOR]"
Set BoxID="... Read more

A:Solved: Batch File Extract TAGID to Batch Variable? weird

Read other 16 answers
RELEVANCY SCORE 53.2

Hiya,

I'd just like to run a simple batch file at logoff to backup some settings. I plan to use Robocopy, which is what i use to more thorough backups.

Two questions:
1. How make it run by clicking Start > Shutdown? (i realise i could make a shutdown batch file and run it instead, but i'd rather keep a standard 'workflow' for other users who use the machine.

2. I'm 'ok' with batch files, but i've never tried to mirror to a different folder each time (automagically). What i'd like to do is have it backup a folder and call it "blah.1" then "blah.2" each time it is run, and then repeat once it gets to "blah.9" so it doesn't keep growing forever. I don't know how to do this.

I realise no.2 is not really for this forum, but someone might know and i might as well ask

Thanks.

A:How to run a batch file at logoff & some batch scripting help please

I found an answer to the logoff/shutdown:
How to schedule a task to run when shutting down windows - Stack Overflow

And the batch file folders:
robocopy - Insert current date in to destination folder structure - Stack Overflow

Read other 1 answers
RELEVANCY SCORE 48.8

Hi all,

Any idea how to write Batch File .bat to copy file from File Sharing & FTP Hosting to local directory.

Current the File Sharing & FTP Hosting is SMARTFILE.

I don't want to use WINSCP as the connector.

Thanks

A:Batch File .bat to copy file from File Sharing & FTP Hosting

Hi Chacha,

Give this batch file a try. All text in red, you should adjust before running.


Code:
@echo off
(
echo.Username
echo.Password
echo.lcd C:\Some\local\directory
echo.cd /Some/server/path
echo.binary
echo.get Some_file_to_download.txt
echo.bye
) > "%TEMP%\_%~n0.ftp"
ftp -s:"%TEMP%\_%~n0.ftp" "12.34.56.78"
del "%TEMP%\_%~n0.ftp"

Read other 1 answers
RELEVANCY SCORE 48.8

Hi all,
I need help to create windows batch file for following requirements.
1. Remove .txt and .log file format in sub folders.
2. Zip individual file inside any sub folders and give file name through command prompt. 
3. Create sub folder zip file include file zip

Read other answers
RELEVANCY SCORE 48.4

Hello All.

I am trying to create a batch file that calls other batch files (device simulators).

The problem I am having is the batch file will not continue until the the call terminates, is there a way to continue it after the call (the batch only terminates after the user exits the simulator).

Thanks avamore
 

A:batch file: batch within batch

Welcome to TSG!

Use Start. The first set of quotes is for a title. It's needed in case the file name/command needs to be quoted, as in the 2nd example.

Start "" batch.cmd

This will open in a 2nd window. If the batch file you call doesn't use the Exit command that window may remain.
In that case use this instead:
Start "" "cmd /c batch.cmd"
 

Read other 1 answers
RELEVANCY SCORE 47.6

I've been searching the web on how to accomplish this but am coming up empty handed so I am hoping someone here can help...

I want my batch file to read a random line from a text file into an environment variable - can this be done?

I am using Windows 2000.
 

A:Batch File -- Read Random Line from External File into an Environment Variable

Read other 6 answers
RELEVANCY SCORE 47.6

Dear All,

I need to create a batch file which can read the size of file(e.g. 1kb, 2kb...etc) from specific folder and detect 0kb file and convert it to text file (showing 0kb file size) with alarm.

I am not really sure how to write command for this batch file. Please help :-(
 

A:How to create a batch file to read size of file on specific folder path

Read other 10 answers
RELEVANCY SCORE 47.6

How to create a batch file that will move files based on the file type?

My Requirement : I need a batch file to copy all .doc files in all my HardDisk to a removable disk say (Z: drive) . Can anyone make it possible using a batch file?Please...Its urgent...

A:How to create a batch file that will move files based on the file type

Download XXCopy
XXCOPY, A Versatile File Management Utility --- Boldly Extended Xcopy
This is a vastly improved and extended version of DOS XCopy
Sorry, can't remember the syntax, but its quite simple if you read the manuel carefully :-)
Put the command line in a .bat file and it will run

Read other 4 answers
RELEVANCY SCORE 47.6

I'm working on a batch file that will download a file I maintain, look for a string of text, and if it doesn't find the string, rename a file or folder, or change the file or folder's attributes to read-only.

I think I can handle the last part, and I already have the ftp part done, but I am having a hard time finding any good resource for the text string lookup/IF statement.

Any help is greatly appreciated. I'm new here, please excuse my ignorance if I am posting in the wrong area or violating any rules.

Thanks,
Jash
 

A:Batch file to compare text and rename file or driectory on fail

Read other 6 answers
RELEVANCY SCORE 47.6

I am trying to write a batch program the list the current directory files that end in *.dwg
into a file on my C drive.
I have used the following code:
dir *.dwg /b >C:FileListing.txt
start notepad C:FileListing.txt

This code only gives file names in the current directory.
I need to have a list of path and file names in the file FileListing.txt
Is there a way to do that without including subdirectories??

Thank you,
 

A:Solved: Batch file to list file names in current Folder.

Read other 9 answers
RELEVANCY SCORE 47.6

I created this batch file to log certain users logins. It creates a text file to log in, but doesn't populate any of the data to it. Could someone please take a look at it and see what I did wrong. I'm new to writing batch files.

Thanks in advance. Here is the code.

@echo off
set target=JDoe
if %username% == target echo %username% %date% %time% %computername% >> c:\logfile.txt
 

A:Solved: Batch file creates text file but does not populate data to it

target is a variable. You have to surrournd it with %% like any other variable.
Code:

C:\>set target=Squashman

C:\>if %username% == %target% echo %username% %date% %time% %computername% >> c:
\logfile.txt

C:\>type logfile.txt
Squashman Fri 05/23/2008 10:34:14.74 BUMBLE-BEE

C:\>

 

Read other 3 answers
RELEVANCY SCORE 47.6

I am wondering if anyone can provide the equivalent to this linux script. When run against a text file with one entry per line being the name of a directory, it deletes the named directories.

On linux, I run this against the text list.
#!/bin/bash
while IFS='' read -r line || [[ -n "$line" ]]; do
rm -R $line
done < "$1"

I am not sure how to make it do the same for Windows. I can do this, but I'm hoping there's a way to delete based on what's in the text file. Also, wouldn't want it to prompt for deletion of each, but to just delete.

@echo on
cd \
cd %USERPROFILE%
dir /D /N 0
pause
for /D %%f in (XX*) do rmdir %%f /s
pause
%comspec% /k
pause


Thank you

Read other answers
RELEVANCY SCORE 47.2

I want a batch to select and open a random link file in a folder i have. All the links are music videos I like to listen to, and I kind of want to just have an option for 'surprise me!'.
I can change the file names if I have to, and I have a basic batch file ability. I know the simple commands, but nothing of the variables, signs-involving commands (&%!?), etc.

Also, I want to learn a whole lot more about programming/java/batch file, so it'd be awesome if any code could be explained. Thank you, in advance

A:I need a batch file to open a random file within a certain folder/path

There's a free Windows scripting language called Autoit3 that would do this task easily using these functons:

Random
_FileListToArray

AutoIt - AutoItScript
It has a Basic like syntax and is easy to learn.

Another popular scripting for Windows is AutoHotkey
AutoHotkey: macro and automation Windows scripting language

The syntax can be confusing but it has object support and is more powerful.

Of course there are tons of others for Windows:
Rexx
Python
Perl
Ruby

Here's a list. The details for each tell which OS are supported:
Free Programming Languages - Freebyte's Guide to

Read other 5 answers
RELEVANCY SCORE 47.2

If anyone can help it will be greatly appreciated,I am taking A + Essentials and my instructor isn't explaining it,

A:How to switch file type name to contents using a batch file for notepad

If you are as it appears you are paying for a Course for a Comptia A+ certification and the teacher isn't doing the job why haven't you gone to the school and asked them to switch you to a course with a different instructor? Or Demand a refund?

When I got my A+ back in 2000 it wasn't that hard to pass. I believe it was two tests and I was over 95% on both with no training course. I was experienced in computers and doing things and They did have a sample test as I recall it.

And of course that old standby Google
http://www.google.com/search?sclient=psy-ab&hl=en&site=&source=hp&q=A+%2B+Essentials&btnK=Google+Search

I'm afraid I can't help you further as the tests have changed a lot over the years.

Read other 1 answers
RELEVANCY SCORE 47.2

Hi Guys,

I want to make one batch file which daily copies yesterday's files from one folder & paste it to another folder.

I.e.
C:/111 folder has following files.
1.zip had yesterday's date
2.zip had yesterday's date
3.zip had last sunday's date

now, when i will run batch file today, it only copies 1.zip & 2.zip & move to another folder C:/222

So C:/222 contains following
1.zip had yesterday's date
2.zip had yesterday's date


Please note , i have to run this batch file daily which should not require any changes.

Read other answers
RELEVANCY SCORE 47.2

I have a computer that is a drone specifically for an outside LED sign. This computer is designed to never shut off and doesn't have any other program on it besides Operating System and the sign software. I need to create a batch file that I can place in the "start-up" folder that will open the program (LEDStudio10) and open the file that I want to play. I have already tried multiple attempts and I was hoping someone out there in sevenforums world would be able to point me in the right direction.

A:batch file open file for program in the startup folder

Task Scheduler. Create a new/basic task. You can invoke your batch script there. This can occur after boot completes, after user logon, etc. You can set it to run daily weekly hourly, etc. You can even have it delay X (preseleted time amounts) minutes/hours after boot/logon if you want.

Task Scheduler - Create New Task

Read other 1 answers
RELEVANCY SCORE 47.2

Hi . I'm making a "PC TuneUp" project , but something is wrong . When the batch file tries to check for updates , it closes . Fortunately , i know that it closes because it doesn't find the file . But i tried everything - nothing worked . Please help !
Code:

@echo off
for /F "tokens=1" %%G in ('tasklist /V /NH /FO TABLE /FI "WINDOWTITLE eq TehDansorz"') do IF %%G==cmd.exe exit /b
if exist newest%winver%pctuneup.ver del newest%winver%pctuneup.ver
if exist %winver%pctuneup.ver del %winver%pctuneup.ver
set winver=Win7+WinVista
set ver=1.6a
set title=title TehDansorz's PC TuneUp for Win7/WinVista Version %ver%
title Requesting admin permissions ...

:: BatchGotAdmin
::-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Administrator privileges are required for this app to work .
echo Please click OK in the following screen .
PING 1.1.1.1 -n 1 -w 600 >NUL
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

"%temp%\getadmin.vbs"
exit /B

:gotAdmin
title Got a... Read more

A:Solved: Batch file closes when downloading version file

Read other 7 answers
RELEVANCY SCORE 47.2

Hi there forum,

how do you change the Visual effects using a batch file or registry file.

Thanks,

Edward.

A:How to change visual effects using batch file or registry file?

Hello Edward, and welcome to Ten Forums.

The links in the blue note box under OPTION FOUR in the tutorial below may be able to help with this.

Visual Effects Settings - Change in Windows 10

Read other answers
RELEVANCY SCORE 47.2

More as an alternative to twiddling my thumbs than anything else, I tried to produce a batch file that would count up the number and size of files in a folder, as well as the number and size of files with each extension. Hence it would say how many word documents I have and how much space they're taking up, etc.

I've managed to get a vaguely working model, but the output formatting is terrible (I just wanted it to say X bytes in Y "Z" Files, none of that ugly dotted variable names) and I have failed to get it to equate .htm and .html, .jpg and .jpeg, etc.
Code:
@ECHO OFF
REM THIS BATCH FILE ITTERATES THROUGH ALL THE SUBFOLDERS AND FILES IN A FOLDER (IDEALLY A DRIVE)
REM IT TOTALS THE NUMBER OF FILES CONTAINED IN THAT FOLDER, AND THE SIZE OF THOSE FILES.
REM IT ALSO TOTALS THE NUMBER AND SIZE OF FILES WITH EACH EXTENSION IT ENCOUNTERS.
REM ALL INFORMATION IS THEN PRINTED TO THE SCREEN AND FTYPEDST.TXT

IF EXIST FTypeDst.txt ERASE FTypeDst.txt
ECHO. >FTypeDst.txt
ATTRIB +A FTypeDst.txt

ECHO SCANNING FILE TREE FOR FILE EXTENSION DISTRIBUTION
ECHO Please Wait Paitently. . .

(SET /A ALLNUMBER = 0) & (SET /A ALLSIZE = 0)

REM cycle through the current directory and subs, Increment Allnumber, Allsize, define and increment Number of * files, size of * files.
FOR /R %%F in (*) DO (
SET /A ALLNUMBER += 1
SET /A ALLSIZE += %%~ZF
IF NOT DEFINED Number.of.%%~XF.files (SET /A Number.of.%%~XF.files = 0)
IF NOT DEFINED Size.of.%%~XF.files (SET /A Size.of.%%~X... Read more

A:Solved: File Type Distribution analysis: Batch File.

Posted via Mobile Device
You would be better off using third party software that already does this. Plenty of them out there.
I personally would check the extension of each file using the cmd extensions of a for loop. then do an if statement for each file type you want to keep track of. then use a call statement to branch to a function that adds up the file sizes and number of files.
 

Read other 3 answers
RELEVANCY SCORE 47.2

Hi there forum,

how do you change the Visual effects using a batch file or registry file.

Thanks,

Edward.

Read other answers
RELEVANCY SCORE 47.2

Hi,

I have a file in a folder on a network drive whose path is : "\\sql\imp\ssis"

I need a windows batch file that looks into the above folder for a file with a name like : "abcd_03052012_84373.txt" .

The above file name has a date embedded in it in "ddmmyyyy" format. I want that to be extracted and put into a variable or a file somewhere so that I can read that later and store into a sql table.

Please help.
 

A:Solved: Extract Date from File Name - Using Windows Batch File

Read other 6 answers
RELEVANCY SCORE 47.2

I've come into contact with Mandriva Linux. I know of a concept called standard permissions, that it provides. It's pretty convienient. I don't exactly know how it really works under the hood or anything, and I don't need to know exactly how it works right now either, even though it's probably available.

What I want to do, in effect, is create a feature pretty close to equivelant of this feature, only for Windows XP. I want to set standard permissions using a batch file. Whenever this batch file is run as administrator it can enforce the permissions. What are these permissions it enforces? Well, what I want is for these permissions to be gotten from a text file. The syntax in no way resembles the syntax of the Linux file I'm describing.

Basically the syntax is this:
PATH <TAB> MODE <TAB> USER1,USER2,... <TAB> PERM
PATH <TAB> MODE <TAB> USER1,USER2,... <TAB> PERM
...
The path is the path to a file or folder in exact syntax. The mode is one of the switches that can be given for XCACLS in the Windows Resource Kit thingy. This can be replace, edit, etc. The users are the user or group to add/replace/remove/etc, and there is a comma allowed so more than one user or group is allowed to be specified. The permissions are the permissions that you can specify in the utillity.

So the first thing the script needs to do, is call some program that safely detects whether or not the filesystem is NTFS or not. If the sys... Read more

A:Get ACL permissions from a text file enforced by a batch file in Windows XP

Read other 16 answers
RELEVANCY SCORE 47.2

Hi all,

Please help!! I'm having a problem to copy some files from a folder.
My folder have lots of files and is there any way for me to write a batch file to copy only files according to "date modified"? For example last week files or yesterday files.

Please help!! Urgent!!!
Thank you.
 

A:Urgent!! Copy file by date modified using Batch File.

Take a look at XXCOPY: http://www.xxcopy.com/index.htm
 

Read other 2 answers
RELEVANCY SCORE 47.2

I would like to know if there is a way to open a file in a program. Basically I want something like this (this is totally wrong):

open "C:Users\*My name*\My Documents\run.swf" in "C:\Program Files (x86)\Mozilla Firefox\firefox.exe

Thanks
 

A:Create a batch file to open a certain file in a certain file

The more standard way to do that is to use the start cmd. You call the program first and the file name second.

start "" "c:\windows\notepad.exe" "c:\somepath\logfile.txt"
 

Read other 2 answers
RELEVANCY SCORE 46.8

Hi, I was wondering if it is possible to make a batch file that will open a file with a specific program?

Say I want to open "targetA.txt", with the program "noteviewer.exe"
Is it possible with batch file? or not?

If it is, could you please show me how?
 

A:making a batch file open a file with particular program?

Read other 10 answers
RELEVANCY SCORE 46.8

I need to write a batch file or vb script that will take the following share names (which are stored in a .csv Excel file) and then run the following command:

NET USE \\[entry from 1.csv file]

The object is to have this command establish a NET USE connection to each share name from the 1.csv file.
These are the first five entries from the 1.csv file:
\\s0002234\c$
\\s002631\c$
\\gb2130\c$
\\s00460\c$
\\gb2143\c$
\\gb3205\c$

Can you please write a command script that will do this for me? My OS is Windows XP Service Pack 2.
Contact me with any further questions.
Dennis
[email protected]
 

Read other answers
RELEVANCY SCORE 46.8

So I recently had a case of hard drive failure in which basically nothing of value was recovered in the original directory structure, however the drive was full of .chk files from a chkdsk run. I ran a quick script to change all of the extensions to .jpg, and most of the files were in fact intact.

Many of the files, however, are either corrupt, or are simply not JPEG files, and so will not open with the .jpg extension. Is there any batch renaming application that can analyze files by their header data, and append the appropriate extension automatically for the most commonly used filetypes?

A:Batch file extension processing by file header?

Usually file recovery software does that (before the files are recovered as chk files). I don't know of any app that will do what you said though. But if you don't have too many files, use a hex editor to open them and rename accordingly. I use winhex (just for viewing though), but any other will do. Here's a few strings that may help:
JFIF .jpg
RIFF AVI LIST .avi
PNG .png
MZ .dll or .exe (at least 32-bit - dunno how they are for 64-bit or 16-bit executables)
moov somewhere in the file .mov (may not be at the beginning)
GIF89a .gif
ftyp .mp4
**\rtf1 .rtf
000001BA21000100 (in hex) .mpg (MPEG-1 at least - don't have MPEG-2 samples to test ATM)
3026B2758E66CF11 (in hex) .wmv or .asf

Read other 5 answers
RELEVANCY SCORE 46.8

Hi,

I want to write a batch file to add the numbers. The inputs are in the text file. I need to add all the numbers in the text file that are in consequent lines. Please help me in doing that by giving an example.

Regards,
Menaka B
 

A:Batch file that takes input from text file

Read other 7 answers
RELEVANCY SCORE 46.8

Alright, so what I'm trying to do is list all the shortcuts & folders in the start menu and list all the shortcuts & folders on the desktop and put this into a text file. The reason is to get a full list of programs our teachers use before we re-image their machine and not all of their programs are listed in add/remove programs and not all programs make a folder in Program Files, that is why I'm trying to do it in this roundabout way. What I have so far is this:

@echo off
mkdir "p:\Program List"
DIR "c:\documents and settings\all users\start menu\*" /S/B/OD > "p:\Program List\%computername% Start Menu.txt"
DIR "c:\documents and settings\all users\desktop\*" /S/B/OD > "p:\Program List\%computername% Desktop.txt"

This works perfectly but the only problem is the file has these:
c:\documents and settings\all users\start menu\
c:\documents and settings\all users\desktop\

before each entry in the text file. Is there an easy way to remove these lines so the text files are easier to read? I've checked other sources and can't figure out how to get this to work...

A:[SOLVED] Delete text from .txt file in a batch file

Open the files in Notepad, click Edit, then replace, and enter the string C:\Documents and Settings\All Users\ and replace it with nothing (no entry).

:)

Read other 10 answers
RELEVANCY SCORE 46.8

I wrote this batch file which does what I want it to do so far.


Code:
@echo off

"C:\Users\xxxxxx\Documents\HideTaskbar\HideTaskbar.exe"
"C:\Program Files (x86)\VideoLANold\VLC\vlc.exe"
"C:\Users\xxxxxx\Documents\HideTaskbar\ShowTaskbar.exe"

exit
VLC is a video program so I want to associate video files to this bat file. This would mean that when i clicked on a video file in Windows Explorer, the bat file would execute and VLC would open the file I double clicked. At the moment the only thing that happens in this setup is that the bat file executes like normal but no video is played.

Is this possible, and if so how can I accomplish it?

A:How can I write a batch file that opens a file in a program?

Have you tried associating the video files to open with VLC by default ?
Maybe you don't need a BAT file ?

Default Programs - Associate a File Type or Protocol

Read other 9 answers
RELEVANCY SCORE 46.8

Okay, so basically, I have a whole list of links in a plain text Notepad file, each link on a seperate line. All I am wanting to do is to add a bit of text before each link, specifically: 127.0.0.1 and a couple of spaces.

So this...
Code:

[SIZE=3]somelink.com[/SIZE]
becomes this...
Code:

[SIZE=3]127.0.0.1 somelink.com[/SIZE]
By now you've probably already guessed what I'm trying to do here and what it's for.

So I am wanting some batch file code, executable in a .bat file, which basically reads a Notepad text file, and then add "127.0.0.1 " at the beginning of each line with text on it. I am guessing this is probably a very simple piece of code for someone with some knowledge of MS DOS and batch file code, but that most certainly isn't me, and the only batch files I have ever written have been with help like now.

Thanks for any and all help in advance with this, much appreciated.
 

A:Batch File To Read And Modify Text File

Read other 9 answers
RELEVANCY SCORE 46.8

I have a text file located at \\thedrive\a folder\another folder\log.txt. This file contains several lines of this kind of data "jdoe upgraded 09-20-2011 13:42:49.62".
I have a batch file located "d:\folderName" that needs to read the "log.txt" file and obtain the local computer user username if it is in the file. If it is not in the file then a file is to be copied to the d drive from \\thedrive\a folder\another folder\ to "d:\folderName" and then run the file. This is what I currently have
@Echo Off
SetLocal EnableDelayedExpansion
::This line is just in case n has been defined before the batch file is run
Set n=
Set _InputFile="\\thedrive\a folder\another folder\log.txt"
For /F "tokens=*" %%I IN (%_InputFile%) DO (
Set /a n+=1
Set _var!n!=%%I
)
but the log file is not read. If I move the "log.txt" off the network it works just fine. I cannot move the "log.txt" file as other processes use it nor can I copy it.
 

A:Batch file to read from a network text file

Because you have Quotes around your file name you need to use the USEBACKQ option.

Please use CODE tags when posting code.

Code:
@Echo Off
SetLocal EnableDelayedExpansion
::This line is just in case n has been defined before the batch file is run
Set n=
Set _InputFile="\\thedrive\a folder\another folder\log.txt"
For /F "usebackq tokens=*" %%I IN (%_InputFile%) DO (
Set /a n+=1
Set _var!n!=%%I
)

 

Read other 1 answers
RELEVANCY SCORE 46.8

Hi,
I am trying to write a batch file that replaces a word in a text file with another word given as a batch parameter. I know of the FOR /F command to loop thru the lines. I know also about doing a simple string replacement. But I can't seem to piece it together. Can somebody help me?
 

A:Batch file to replace words in a text file

Read other 16 answers
RELEVANCY SCORE 46.8

Anyone know how to take the contents of a text file, numbers only, calculate and then store them as a value? I'll be constantly adding to this text file and they need to be calculate. Like the balance of a bank but a little different.
 
Please and thanks!

A:Batch File, Calculating the Contents of a Text File

I think that would actually be very hard to do as the numbers in your text file are not integers but text and doing calculations would not be possible. Is there any reason you can't use a spreadsheet to do this?

Read other 10 answers
RELEVANCY SCORE 46.8

Hi,
I am new to batch files and have read up a little on xcopy and robocopy. 
We currently have a folder which new builds are copied and compressed to .zip files and stuck in a  folder. Dozens of zip files are created every day
What I want to do is the following:

I want to copy the newest zip file from folder 1 to folder 2 and extract it. 

What is the simplest way to find and copy the newest zip file considering multiple zip files are created each day?

A:using a batch file i would like to copy the newest file to a new location.

Try this:
@echo off
for /F "delims=" %%a in ('dir  /b /od "d:\My Files\*.zip"') do set Youngest=%%a
xcopy /y "d:\My Files\%Youngest%" "Folder2\"

Read other 3 answers
RELEVANCY SCORE 46.8

I am wondering how to write a script that would delete all files of a certain extension from a folder.
 

A:Solved: Batch file to delete all .xxx files from a file

Read other 6 answers
RELEVANCY SCORE 46.8

Hi,

Can anyone tell me how to get part of a bacth file to read a line from a text file and then set it to a variable.

For example the file contains computername =computer1

how do i get the batch to read that and set computer1 to a variable that can be used within the batch file.

If possible what i would also like to be able to do is once set that to variable, compare it against the correct computer number and if incorrect go back into the batch file and set the line to the correct computer name

Any help is appreciated.

Thanks
 

A:Batch File Read Line Of Text File

Read other 7 answers
RELEVANCY SCORE 46.8

Backround: I am a college student majoring in Information Technology with a focus in programming. I also work for my school's IT department as an IT associate. I have 4 years of experience dealing with hardware and software and have studied Net+ and A+ certification books.

Problem: At my school my boss, the IT Director, wants to schedule a batch file to run weekly that will delete items from the desktop and folders of the "Student" account on all of the student computers. He asked us associates to go around to every student computer with this batch file on a thumb drive and schedule the task. Seems simple enough right? The problem is we are talking upwards of 300 computers throughout the campus. I proposed a solution to him where we would use a script that would essentially consult a text document with the names of all of the student computers in it, then run the file.

I am 99% this can be done, I just have a very small amount of programming experience. If anyone has an answer or knows of an easier way to accomplish this I appreciate it. Thanks in advance.

EDIT: All student workstations are running Windows XP SP2
 

A:VB Script to Run a Batch File and Utilize a Text File

Read other 16 answers
RELEVANCY SCORE 46.8

Hey I've written lots of batch files before, but it's been a while and I don't think I've ever tried to add external data.

I've got a list of folder names and I'd like to make a batch file that I can run every once in a while to copy a master file in each folder to a new file. I know this is long, but I know exactly what I want so I thought I'd be as specific as possible. I'd love to get an example script but I really do want to learn more--if I could get pointed in the direction of where to learn this stuff, that would be awesome.

So for instance the folders are:
folder1
folder2
folder3

And in each folder there is a master file that includes the folder name and the word master (for instance):
c:\folder1\folder1-master
c:\folder2\folder2-master
c:\folder3\folder3-master

And I want to copy the files to a new file:
copy c:\folder1\folder1-master folder1-copy
copy c:\folder2\folder2-master folder2-copy
copy c:\folder3\folder3-master folder3-copy

Now I don't want to do every folder every time I run the batch file, but I already have a list of the files that I have to make copies of. So I was hoping to have a text file with:
folder1 folder2 folder4 etc

Then the batch file would grab that info and run a loop till it ran out of info. So if the first data was folder1 it would put folder one in %data% or something and then:
copy c:\%data%\%data%-master c:\%data%\%data%-copy
Then the loop would go back and put the second data in %data%... Read more

A:more complex batch file data from external file

Read other 7 answers
RELEVANCY SCORE 46.8

Any suggestions here would be appreciated but I think this is so bizzare or deep into Windows that I'm not expecting any. I am developing a scheduled task that will run every morning unattended. The script starts Excel and specifies a workbook to open. The 'workbook_open' event runs and when finished, starts another batch file (via Shell(batFile, 1) and shuts down Excel. The 'batFile' starts Access and specifies the database to open. The database runs an AutoExec function and then shuts Access down. This sequence runs fours times for four separate databases. Here's the problem:

When the scheduled task runs under my account, everything works fine. However, when we change the scheduled task to run under the System Administrators account (we have to do this for reasons not important here), the Excel/Access sequence for one, and only one, of the databases does not run. I have isolated the problem to the 'Start' commands for both Excel and Access. What appears to be happenng is that for the Excel 'Start', Excel starts but the 'specified' workbook is not opened, hence Excel just sits there as an open process not doing anything. When I changed the name of the 'specified' workbook, the Excel 'Start' works okay, opening up the renamed workbook. The same thing happens with the Access 'Start' command. Access starts but the 'specified' database does not open, hence Access just sits there ... Read more

A:DOS Batch 'Start' app file command cannot find file

I've found a workaround to this problem by renaming the parent folder to which the database's location folder trees. But I sure would like to know what caused this problem.
 

Read other 1 answers
RELEVANCY SCORE 46.8

On my XP backup batch file, I am doing a comparison of the total files in the source and target directories to confirm they are the same (and consequently everything backed up ok). What I am trying to do is display the final file total line, excluding all of the other file total lines of the individual folders. Additionally, I want to exclude system files from the total, as I am not backing them up.

I am using "dir /s /a-s d:\*.* | find "File(s)"

This give me the total lines of all folders in addition to the final total files and bytes which is the only line I want.

I have used attrib with find /c /v "", which works, however I cannot find a switch with attrib that will exclude system files.

Any ideas?

A:Batch File find final file total

Try this look for /exclude (scroll down)

Read other 2 answers
RELEVANCY SCORE 46

I have a batch file that essentially stops my virtual server, copies files, starts virtual server, compresses files and finally removes temp folder.

I would like to have a ini file to store information like:

VMStop Path=cd c:\virtual machines\vmware\vmware server
VMStop Command=call vmware-cmd "c:\virtualmachines\xp\xp.vmx" stop
CopyPath=C:\backups\server1
VMStart PAth=cd c:\virtual machines\vmware\vmware server
VMStart Command= call vmware-cmd "c:\virtualmachines\xp\xp.vmx" start

I was able to put a ini file in place and store set commands in it and pull those out, but not sure how to do teh above. Any help would be appreciated.

S
 

A:Pull information from a ini file from batch file

Read other 7 answers