Computer Support Forum

Batch/VBS File, 'Bring To Front' help

Question: Batch/VBS File, 'Bring To Front' help


Can someone help me with this as i really can't think of how to do it, a quick Google search hasn't helped either and the only other place i could think of that is as useful as Google is... Seven Forums

I would like a Batch or VBS file to do the following (or something that will at least do it)

I have 1 PC with 1 Monitor...
I have 2 browser windows running full screen...

I would like to open/display/bring them to front alternately automatically.
How can this be done?

Example in readable form, well i hope:

Bring to front
"browser window 1"

Bring to front
"browser window 2"
GOTO :Start


Relevance 100%
Preferred Solution: Batch/VBS File, 'Bring To Front' help

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 (This link will automatically start a download of Reimage that you can save to your computer.)

Answer: Batch/VBS File, 'Bring To Front' help

Unless they are different browsers, it could be impossible to program something that would be able to discern "window 1" and "window 2" across many different browsing sessions.

Can you explain more of why you'd like to do this so we can think of other ways to possibly address it?

6 more replies
Relevance 75.03%

how can i bring Control panel to desktop using batch file or registry key or command prompt

More replies
Relevance 72.57%

Hello TSG Development----

THANKS for your advise, time, and help!!!!

It's been a long time since I have done DOS Batch file development and I cannot remember if the following can even be done with a DOS BATCH command line.

The problem solution is probably simple:

What DOS command line logic is required to prefix a string to records on a file.​
And, this is where my rememberance of DOS command line falls short----How to get the string, any string added to the front of each record on a filename.txt file.
The concept is to RENAME files using a pattern matching type technique, using the full filename (>8.3), a filename that contains a SPACE character as part of the filename, and in batch.

The following processes have been reviewed and many work as required, but the ones that do work as required do not allow full batch execution of the process to rename the files as required.

AF5 Rename
Tried using the following CHOICE command to create a bat file to be executed recusivley with the full filename, plus a SPACE in the filename. However, using the following CHOICE command on a filename that contains a SPACE will create the output file, but the CHOICE command n... Read more

Answer:DOS Batch-add a string to the front of records on a file.

9 more replies
Relevance 64.37%

This started this morning. Running Windows 10 Pro. I can run the browser (Chrome), luckily. Word also. But I cannot most other apps (I think), like WinSCP, but not Calc, not Notepad++, not Notepad. If I try to run Calc, it loads in the task try and if I hover the mouse over it I can see the image of it. Same with Notepad++, But if I click on the icon, nothing happens. Word is fine when loading or clicking on the task try icon. Same with Chrome. Same with Edge, Firefox, Visual Studio. So far, limited to Notepad, Notepad++ and Calc but there could be more.

More: Explorer as well.

WELL, not exactly. I use a program called Agent Ransack to search the desktop. I don't use it much but I know that you can click on an Explorer icon and choose the folders you want to search. I did that and explorer came up OK. BUT not from the Start Menu or task bar.

Unfortunately running Explorer from this program limits me to selecting folders.

Answer:Cannot bring some apps to the front

Switch to and bring to the front in Task Mgr does nothing.

If I run Word and then File->Open-Browse, I can use Explorer no problem. Just not from Start or Task Bar.

more replies
Relevance 64.37%

This started this morning. Running Windows 10 Pro. I can run the browser (Chrome), luckily. Word also. But I cannot most other apps (I think), like WinSCP, but not Calc, not Notepad++, not Notepad. If I try to run Calc, it loads in the task try and if I hover the mouse over it I can see the image of it. Same with Notepad++, But if I click on the icon, nothing happens. Word is fine when loading or clicking on the task try icon. Same with Chrome. Same with Edge, Firefox, Visual Studio. So far, limited to Notepad, Notepad++ and Calc but there could be more.

More: Explorer as well.

WELL, not exactly. I use a program called Agent Ransack to search the desktop. I don't use it much but I know that you can click on an Explorer icon and choose the folders you want to search. I did that and explorer came up OK. BUT not from the Start Menu or task bar.

Unfortunately running Explorer from this program limits me to selecting folders.

Answer:Cannot bring some apps to the front

Switch to and bring to the front in Task Mgr does nothing.

If I run Word and then File->Open-Browse, I can use Explorer no problem. Just not from Start or Task Bar.

2 more replies
Relevance 63.96%

Hello, trying to find some key+click combination to bring all windows for a given application to the top of z-order. For example, I have several Putty terminal windows open in the stacked taskbar icon and I want to display all of them, not just the last used. The only work-around I have found so far is to shift+right-click and "minimize all windows" followed by "restore all windows". Any simpler way to do this?

Answer:Bring to front all windows for a certain application

+1 +1 +1...
Completely surprised that this has received no response in almost two years (698 days). Are droidix and I the only Win7 users who use more than one window of the same application and would like to bring them all to front at once?.

Without even going into third party applications - what if you just want to open two or more explorer windows to copy files from folder to folder? Win7 has given us new "side-by-side" and "stacked" window arrangements that help with this but as soon another application covers these it take many mouse clicks and/or key combinations to display them all again.

Hey Microsoft! Please add a "bring group to front" context menu command to the taskbar! <-- this will probably fall on deaf ears so if there are any third party developers out there that can do this I would gladly pay for the application, could be your road to riches.

2 more replies
Relevance 63.14%

This is the second time I've gotten this bug, and it seems to occur roughly two weeks after a fresh install.

Long story short, I pin all of my favorite applications to the taskbar and when I click on a running program, I expect it to bring focus to that program (bring it to the front). Instead, it flashes yellow and the window that I want stays behind every other window. The only program that does not do this is Digsby for whatever reason. Basically, the only way to see an existing window is to minimize all of the windows in front of it and only clicking on the window itself will give it focus. That's partly a lie, because I've discovered that a series of clicks on the taskbar icon will do it, namely: right click, left click, right click, left click. I don't want to have to do four clicks when one normally works.

I am running Windows 7 Professional 64-bit acquired through the MSDN program for students (Academic Alliance or something). I do know that I never had these issues in the beta with Ultimate edition.


Answer:Taskbar bug, doesn't bring programs to front.

I am also having this problem. I'm using Windows 7 Professional 32-bit and am having the same symptoms. Clicking a program on the taskbar doesn't bring it to the front, it just blinks yellow/orange. I have to Win-tab or minimize windows in front of the program to get to it. Any help on this would be most appreciated.

9 more replies
Relevance 63.14%


I am working with a powerpont presentation where I have put a logo in the slide master, it needs to show on every page. So here is the problem. On some slides I have to insert pictures that cover up the portion of the logo that is saved on the master. However, the part of the picture that is covering up the logo is just dead white space, and I figure there is a way to make the logo always go to the front.

Let me know if anyone has any ideas or needs more clarification.


Answer:Bring image to front in PowerPoint 2010

10 more replies
Relevance 62.32%

Whenever i click on a button for a window in the taskbar instead of bringing it to the front it makes it flash orange like a messenger window. Also i cannot right click on the taskbar window buttons but i can right click the taskbar itself.

other thoughts:
windows xp pro sp2
internet explorer 6

More replies
Relevance 61.5%

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:


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.

Answer: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.

3 more replies
Relevance 60.68%

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?

More replies
Relevance 59.04%

hi all of u. i have found a lite gameing 64bit xp. its cool. but i have a problem with (Visual Effects-Active window tracking-Focus & bring to front on mouseover).

i found one it says

When the mouse is moved over an open window it automatically sets the focus to that particular window. It does not bring the window to the foreground of the open windows.

Registry Key: HKEY_CURRENT_USER\Control Panel\Mouse
Modify/Create the Value Data Type(s) and Value Name(s) as detailed below.
Data Type: REG_DWORD [Dword Value]
// Value Name: ActiveWindowTracking
Setting for Value Data: [0 = ActiveWindowTracking Disabled / 1 = ActiveWindowTracking Enabled]
Exit Registry and Reboot

but it wont work

can any one tell me how to stop it. itssss a great problem for me. is there any patch or something for bring it to normal pllllzzzzzz help

More replies
Relevance 56.17%

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
[COLOR=red]for /f "tokens=1 delims=[" %%G in ("PHASEID" %path%\%myfile%) DO ([/COLOR]
[COLOR=red]set PhaseID=%%G[/COLOR]
[COLOR=red]echo Phase: %PhaseID%[/COLOR]

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....



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

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

16 more replies
Relevance 55.76%

I am looking for a way to startup multiple applications with batch scripting. After the batch file has been executed it has to be closed automatically.

for example:

"C:\Program Files\Wos_Portable\wos.exe"
"C:\Program Files\Internet Explorer\iexplore.exe"
The code will run WOS and Internet Explorer, but the batch file won't shutdown until I have closed wos and iexplore.

Any idea's how to fix this?

Answer:Batch scripting: Startup applications and close batch file


7 more replies
Relevance 55.76%

How can i make my batch file open new batch files in new windows? I have tried everything but it just overrides the one i have open currently.Please help!

Answer:How can i make my batch file open new batch files in new windows?

Show us what you have.

4 more replies
Relevance 55.35%

Hi Gurus,Need ur help to automate a process.I am working on a process where i call .xml file using a .bat file. The bat file i use is my application utility file.Now when i run this xml file using my batch file i get a folder in an export format.Here my requirement is that whenever the folder is generated it should have appended in it the System Date along with the system name.I just did some search on the net and found that i can call batch comands in the xml file ...So needed the syntax to call batch rename command "ren" in my .xml file  which would rename the folder with system date included in it.I was using something like this in my .xml code ...but that dosent works ...something is wrong in the syntax :<?xml version="1.0" encoding="UTF-8"?>    <command name="Ren" sequence="1">        <option name="C:\Documents and Settings\*****\Desktop\Folder1" arg="" />        <option name="C:\Documents and Settings\*****\Desktop\Folder1_%date:~-4%%date:~4,2%%date:~7,2%" arg="" />    </command>Please SuggestThanks in Advance.

More replies
Relevance 54.12%


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


Answer: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

1 more replies
Relevance 50.84%

I did a search for all .doc files so I can copy them to a flash drive but when I checked, the search results showed duplicates of every file right down to the path. I'm running XP if that has a jot of relevance.cheers

Answer:why does search bring up duplicates of every file?

click here - Don't click on View the Solution but scroll down to near the bottom of the page.

4 more replies
Relevance 50.43%

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.


Answer: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.

@echo off
echo.lcd C:\Some\local\directory /Some/server/path
echo.get Some_file_to_download.txt
) > "%TEMP%\_%~n0.ftp"
ftp -s:"%TEMP%\_%~n0.ftp" ""
del "%TEMP%\_%~n0.ftp"

1 more replies
Relevance 50.43%

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

More replies
Relevance 50.43%

Hi All,I need some urgent help..I have one file files.lst, it will contain filenames,dialy the number of filenames  will be change.let us assume that this file.lst has following file namesa.dat \b.datc.datI need a batch file , it has to read this file names from filename.lst and has to check a.dat file is there or not in c:\informatica\srcfilesfolderlike that it has to check all the file names mentioned  in file.lstcould you please help me to write a batch fileThanks Mahesh Goli

Answer:need batch file for reading file names and chekcing the file name

You seem to have given three input file names Files.lst, File.lst and Filename.lst so uncertain that this is what you want:Code: [Select]@echo off


set path=c:\informatica\srcfiles\

for /f "delims=" %%# in (files.lst) do (
    if not exist %path%\%%# (echo ----- %%# does NOT exist in %path% -----
    ) else (
    echo +++++ %%# DOES exist in %path% +++++

1 more replies
Relevance 50.02%

I am using Windows Vista Home Premium Intel Core 2 Duo, 2.8GHz. Downloaded photos and video clips from my Panasonic DMC-LZ2 into Windows. The videos have a .mov extension. When I try to bring Video clips into Movie Maker, the message "not enough storage is available to complete this operation" appears. As I am very much a beginner, would appreciate any assistance available to be in straight forward, easy to follow language. Thanks in advance.

Answer:Solved: .mov file unable to bring into movie maker

8 more replies
Relevance 50.02%

Hello. I know how to bring up the I.E. 7 menu (File, Edit, View, etc) but I'm unable to. Actually, the situation is a little more complicated. I have three Windows users on my computer. (Windows XP.) One user can bring up the menu, the other two cannot. For the two users that can't, the MENU BAR option under TOOLS is checked even though the menu is not visible. And I cannot uncheck the menu bar option. It remains checked no matter how many times I try to check or uncheck it. Also, pressing the ALT key fails to bring up the menu temporarily.

I changed the two users without the I.E. menu from Standard Windows users to Administrator. This made no difference.

I am up to date with Windows Updates and anti-virus protection.

Any ideas?

Answer:Solved: Can't bring up I.E. 7 menu (File, Edit, View, etc)

10 more replies
Relevance 49.61%

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

Answer: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"

1 more replies
Relevance 49.2%

Hi,I have a very simple batch file script to copy files in the current folder to another folder, but it also copies the actual .bat file. How can I exclude the .bat file from also being copied?here is what I have so far:copy /-Y *.xml F:\\TestExitI tried this:except *.bat copy /-Y *.xml F:\\TestExitwith and without brackets but it does not work.Any help would be appreciated.Jaime

Answer:Batch file to copy files but not copy the batch file?

The simple way is to have the batch file itself in another directory.Let's say your stuff in in D:STUFF and the bat file name MYBAT.BAT is in D:\BATthen  go into D:STUFF directory  and give the commandd:\bat\mybatWhich will only operate on files in the current directory and sub directories.

5 more replies
Relevance 48.79%

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.

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

6 more replies
Relevance 48.79%

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 :-(

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

10 more replies
Relevance 48.79%

Hi,I would like to have a batch code to automatically find the latest excel file created by a server inside this location D:\report\,  and automatically opens it from other PCs connected in the same LAN.  The filenames inside the D:\report starts with the date eg: 20090417*The reason I need this help is because I do not want the user from the other PCs to use windows explorer and navigate to all other locations in the server harddrive.  They might do some damage if unintentionally deleted any of other files.  I am not allowed to change any file attribute in the server to make things hidden & etc.  Thanks in advance for your help.

Answer:Batch file to find latest excel file created and open it in windows xp

do you share d:\report\ folder in the server?if yes then, the code is something like this:Code: [Select]@echo off
for /f "tokens=*" %%a in ('dir/b/o-d/tc \\servername\sharename\*.xls 2^>nul') do (
start "" %%a

1 more replies
Relevance 48.79%

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.


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

6 more replies
Relevance 48.79%

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.
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 \
dir /D /N 0
for /D %%f in (XX*) do rmdir %%f /s
%comspec% /k

Thank you

Answer:Batch file or command to delete directories named in a text file

It's easiest to clean out the files before removing the directory.
echo Y|del *.* will clean out the files in a directory as long as there are no hidden or system files, you need to remove the attributes of files with the attrib command before the bat will delete the directory.
the echo Y| simply answers yes to any confirmation messages

1 more replies
Relevance 48.79%

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,

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

9 more replies
Relevance 48.79%

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

Answer: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.

C:\>set target=Squashman

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

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



3 more replies
Relevance 48.79%

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...

Answer: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

4 more replies
Relevance 48.79%

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


Answer: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"

2 more replies
Relevance 48.79%

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 !

@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 -n 1 -w 600 >NUL
goto UACPrompt
) else ( goto gotAdmin )

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

exit /B

title Got a... Read more

Answer:Solved: Batch file closes when downloading version file

7 more replies
Relevance 48.79%

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

Answer: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:


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:

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

5 more replies
Relevance 48.79%

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.

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

ECHO Please Wait Paitently. . .


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 (
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

Answer: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.

3 more replies
Relevance 48.79%

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

Answer: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

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

1 more replies
Relevance 48.79%


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.

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

6 more replies
Relevance 48.79%

 got a problem in copying a file from one path to another path with a 'variable folder name' in the pathThe following code works fine if the folder name doesnot have a space in it.(hear Folder1 is the variable folder name)CODE:    @echo off&setlocal enabledelayedexpansion    SET inpu="Folder1"    ::SET /p fil=enter file name:     for /f "delims=" %%x in ('dir "C:\Users\kumark3\Desktop\"%inpu% /ad /b') do (    set /a userslen+=1    set "usersarray!userslen!=C:\Users\kumark3\Desktop\%inpu%\%%x"    )    for /l %%x in (1,1,%userslen%) do (    xcopy "!usersarray%%x!\geth\gr.txt" "C:\Users\kumark3\Desktop\Folder2" /c /h /r /y /i    )But if the folder name has a space, the code is not working for eg if the 2nd line in the code is likeSET inpu="Folder 1"Please give me a solution for this problem

Answer:batch file - copy file from one path to another with a variable folder name

Please Tell ME Are you Trying To Auto Increment The Folder On Copy?And dont add @echo off&setlocal enabledelayedexpansion USE @echo off ONLY!!

1 more replies
Relevance 48.79%

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.

Answer: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

1 more replies
Relevance 48.79%

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:
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

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

16 more replies
Relevance 48.79%

Hi there forum,

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



Answer: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

more replies
Relevance 48.79%

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.

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

Take a look at XXCOPY:

2 more replies
Relevance 48.79%

Hi there forum,

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



Answer: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.

2 more replies
Relevance 48.79%

hi all,
i have created a batch file that will run 171234 lines of code to rename 171234 files.
chcp 1252
Ren "75%.pdf" "146574 - Puttsawamy N - acceptance terms received - 75 loading - 29.09.09.pdf"
timeout 100
Ren "£100.pdf" "14234224234246574 - Puttsawamy N - acceptance terms received - 75 loading - 29.09.09.pdf"
timeout 100
this batch file worked on the majority of files but those with "£" characters and "%" did not due to the fact that on the output screen the characters are either not displayed or are different on the screen.
the file names containing a "£" were eventually fixed by changing chcp from default to 1252 but i cant resolve the "%" files.
(if they are input manually the problem is solved but they do not work in the batch file)
any help with this would be greatly appreciated.

Answer:CMD - Batch file to Rename files - % in file name causing issue.

I expect it's simple if you know your way around Code Pages and Character Sets
Have you looked at 3rd Party utilities?
I'm afraid I can't recommend a particular one
click here
click here
click here

1 more replies
Relevance 48.79%

Hi there forum,

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



More replies
Relevance 48.79%

Hi Guys,

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

C:/111 folder has following files. had yesterday's date had yesterday's date had last sunday's date

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

So C:/222 contains following had yesterday's date had yesterday's date

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

More replies
Relevance 47.97%

If I have: set /p filename=What is your filename?: ... How do I take the user input and 1) output to namelist.txt (already existing text file)and 2) output to output.txt (dynamically created text file)? Thanks! --oops.. put this in the wrong forum. sorry. guess there's no way to delete now..

Answer:How to write batch file input to text file?

This is the wrong forum to post Programmig have posted this in Programming forum`s file there....this one should be removed !Google is your not present,press F1 to continue...

2 more replies
Relevance 47.97%

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...

Answer:[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).


10 more replies
Relevance 47.97%

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

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

6 more replies
Relevance 47.97%

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?

Answer:Batch file to replace words in a text file

16 more replies
Relevance 47.97%

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

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

16 more replies
Relevance 47.97%

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: and a couple of spaces.

So this...

becomes this...

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 " " 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.

Answer:Batch File To Read And Modify Text File

9 more replies
Relevance 47.97%

op sys=NT40
Need this in batch

Need to remove a space or spaces that are at the end of every string



Answer:Batch File to remove a space at the end of a charcter in a txt file

you can use notepad's find and replace feature. Or any text editor really.

2 more replies
Relevance 47.97%


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.

Menaka B

Answer:Batch file that takes input from text file

7 more replies
Relevance 47.97%

Hello I used the info given in this site to rename a file using a batch file under Win 7. Batch file is as follows:echo Press to rename the old File.exeecho Renaming old File.exe if it exists...IF EXIST File.exe (   for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename ?File.exe" File-%%e-%%f-%%g.exe)Wit 7 complains that %%d was unexpected at this time.Where is the problem? Thank you.

Answer:Batch file to rename a file with date stamp in Win 7

Perhaps you could tell us what your think this part is going to do.Code: [Select] for /f "tokens=1-5 delims=/ " %%d in ("%date%") And then maybe we can tell why it won't do that.

8 more replies
Relevance 47.97%

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

Answer: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.

1 more replies
Relevance 47.97%

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:

And in each folder there is a master file that includes the folder name and the word master (for instance):

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

Answer:more complex batch file data from external file

7 more replies
Relevance 47.97%

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:

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.
[email protected]

More replies
Relevance 47.97%

I need a batch file that will delete position 805 in every row of a text file.  Any help would be appreciated!

Answer:In need of a batch file to remove position in text file

Could you please be a bit more clear? Do you mean you want to read a text file, line by line, and delete the 805th character of each line? That is, the new line will be characters 1 to 804, and then characters 806 to the end?

4 more replies
Relevance 47.97%

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.

Answer: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.

@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


1 more replies
Relevance 47.97%

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?

Answer:Batch File find final file total

Try this look for /exclude (scroll down)

2 more replies
Relevance 47.97%


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.


Answer:Batch File Read Line Of Text File

7 more replies
Relevance 47.97%

Have a situation where a local copy of a file is kept on several PCs. There is a master copy on a server which is changed and updated occasionaly. When the master copy is updated it has to be copied over to the local PCs.What I would like is a batch file (or something that does the same thing) which would check the last modified date on the master file and if newer than the local file download and replace the local copy before loading.Any ideas on how to do this?

Answer:Batch File-overwrite existing file newer available

No ideas?

5 more replies
Relevance 47.97%

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?

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

10 more replies
Relevance 47.97%

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!

Answer: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?

10 more replies
Relevance 47.97%

How can I add to this batch command to include the date:

xcopy C:\all\* Z:\Allbak\* /E /Y /C

I'd like the resulting file to be named "Z:\Allbak171129" (yr mo day).

The plan is to set up a task schedule to run the batch file every week. I want to keep several previous backups just in case.

More replies
Relevance 47.97%

Is it possible to create a list of file descriptions (Properties => Details => Description) via batch file.  I'm using Windows 7 Professional.  See link below for clearer picture:

Answer:Create List of File Descriptions via Batch File?

I do not believe it is possible to offer a generic solution; is there a particular kind of file that you are interested in?

3 more replies
Relevance 47.97%

Hello, I am trying to use a batch file to read a path in an ini file and start an application. I am able to get dos to read the path until the myapplication1.00.exe. Below is what I have.Batch File:@echo off for /f %%a in (myapplication.ini) do set Mypath=%%a start %Mypath%myapplication.ini File:"\\link\share\PSO Train\My Training Folder\myapplication1.00.exe" This is a shared directory and I trying to make the .bat capable to work if a shortcut is created.Thanks,

Answer:batch file error in .ini file path, not starting .exe

If no tokens or delims are specified by default in an options string,  FOR /F splits each data line into tokens, the default delimiters are spaces and tabs so in your example %%a is going to expand to "\\link\share\PSOThis is not what you want. If you put echo %Mypath% you will see what I mean. Try with a "delims=" options string in the FOR commandtype FOR /? at the prompt to see the documentation

1 more replies
Relevance 47.97%

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?

Answer: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\"

3 more replies
Relevance 47.97%

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

@echo off

"C:\Program Files (x86)\VideoLANold\VLC\vlc.exe"

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?

Answer: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

9 more replies
Relevance 47.97%

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?

Answer: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
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

5 more replies
Relevance 47.97%

Dears,How can I create a Batch File which will identify number 0 in the text file and immediately trigger a pop out message to alert people. Please help.

Answer:Create Batch File to read text file

Tell us more about the text file. How was it crated? Does it have some kind of fixed formant like a data record?

3 more replies
Relevance 47.97%

I need help creating a batch file which will pipe out the system variables to a text file daily.

set | more >> c:\system_variables.txt

I also want to put in a time stamp in the file before the details are added to the text file.

Ideally when the batch file runs it will input the time/date and then the system variables without overwriting the details of the previous day.

system details
system details

Any help appreciated


Answer:Batch File time stamp and appending to the end of a file

It would probably be easier to write a C++ program to do that and set it to run each day. (if you have access to a compiler...)

2 more replies
Relevance 47.15%

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
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.


Answer:Pull information from a ini file from batch file

7 more replies
Relevance 47.15%

HI can anybody please post me a batch file which will let me automate saving a file to directory on a server or point me in the right direction on how to create one it need's to run at a set time every day .Please help

Answer:Need A batch File to automate saving of file

16 more replies
Relevance 47.15%

Example, I have a text file and the contents are:DogCatBird fliesBird is smallHorseHorseCat eatsDogCow eatsCowBird eatsHow do I write a batch file that will remove any line that has the word "Bird" in it and export the result into a new file?Thanks!!!

Answer:Batch file to delete lines in txt file

Correction! My question actually is: How do I write a batch file that will remove any line that has the word "Bird" AND any line that has "Cat" in it and export the result into a new file?Thanks again!!!

4 more replies
Relevance 47.15%

hello everybody,my question:i have a Image made with Ghost 2003, i would have my image on a bootable DVD.what must i do to make the DVD bootable and how can i do that,i wil make a batch file so the DVD will runs automatic, but how,The batch file must start first Ghost.exe (thats on the DVD) then he must get the image file "test1.GHO" and "test1.GHS" from the DVD then the image file must run the image to the disk,but how?can someone help me

Answer:How to make a batch file to run a image file

3 more replies
Relevance 47.15%

I intend to spool a batch file activity (whatever shows up in command window while batch is executed) to a log file in XP.

I tried to use setlocal and endlocal as mentioned in microsoft but found that they are specific to DOS and cant be used for XP.

Can someone help me with this? Thanks.

Answer:Spooling Batch File Activity To A Log File In Xp

someone please help me with this...

3 more replies
Relevance 47.15%

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

I've seen a couple batch files around that don't do exactly the same thing, but I'm not sure what I would need to modify.

Answer:Batch File/Command: Deleting every Xth file

Would like to see the examples you saw. But what I would do is setup a for loop to list all the files in the directory. setup a counter. When the counter does not equal one delete the file. after you have deleted the 3rd file (essentially the 4th file in the list) reset the counter back to zero.

1 more replies
Relevance 47.15%

I'm using this batch file to take the newest file and copy it to another location. FOR /F %%I IN ('DIR *.* /B /O:-D') DO COPY %%I <<NewDir>> & EXIT My exact syntax is this:FOR /F %%I IN ('DIR H:\*.* /B /O:-D') DO COPY %%I F:\ But I'm getting an error saying the system cannot find the specified file. I had it working once about an hour ago, edited my live bat file to add this command and it stopped working. I don't know what I did as I accidentally closed the unsaved editor. Currently there are 3 files in H, I want the newest to go to F. Any help appreciated.

Answer:Batch file copy newest file

FOR /F "delins=" %%I IN ('DIR H:\*.* /B /O:-D') DO COPY "%%~fI" "F:\"

7 more replies
Relevance 47.15%

I have a couple hundred mixed images of different file types. 80% of them do not have file extensions in the name. Mostly Tiff, EPS (in CMYK), PS, AI, and Jpg. I need to add in file extensions for the correct image type. So all the Tiff files without .tif at the end need .tif added. Same for EPS, AI etc. Some images DO have the extension already and I do not want those changed or an extra extension tagged onto them.

Any suggestions for software to read the file type from the image then add the correct extension if it is missing? I could do it manually but hundreds of manual renames are not my idea of a fun time. I have Vista, XP, 2K, A few Linux distro's etc available, so I can run most modern software.

Answer:batch add file extensions to file names.

Do you have "Hide Extensions for Known File Types" enabled in Windows Folder Properties by chance? Or do you just want to have the file extension in the file name?

"The Rename" will do what you want.

4 more replies
Relevance 47.15%

Can someone help me out with this? I don't know what I'm doing wrong. I put:Quotemplay32 /play /close c:\Users\Connor\Desktop\abc.wavinto notepad and name it file.batbut it's not working.

Answer:Playing an Audio File with Batch File

May I suggest something. When ever you have a problem with batch files, it helps to simplify things and make them more direct. You should have received some type of error message if the Windows media player was not available, or could not find the file.Just now I made a new audio file that I called "test.wav" and after adjusting the volume level and effects, I placed it in an empty directory on the C: drive. I had named the directory WAV so  now the new audio file I just created is in that directory.So now this is what I do at the command prompt.C:\WAV>mplay32 /play /close TEST.WAVWorks fine for me. Can you duplicate this on your system?

7 more replies
Relevance 47.15%

I've got a task that I need to repeat 100 times in a CAD program.

I've written a small script in the CAD program that takes a model and does a bunch of things to it, saves it, and closes it. (That part is taken care of, but I want to automate it)
That script is written in a text file. But it's specific to that model.

What I want to do is write a Batch file that will:
1. Look into a folder and put the list of files in a variable or list.txt
2. Replace "filename" in my script with the first file in the variable/list.txt
3. Run my script
4. Select the next "filename" in the variable/list.txt
5. Repeat 2-4 until there are no more files left

Thank you very much for your time

I've never written a batch before, so please bear with me.
What I've got so far, and commented to finish what I want to do but don't know how:
REM Prompts user for the directory
set /p pathName=Enter the File Path of the folder:

REM Get file names and store in a text file
dir /s /b "pathName*.*">"list.txt"

REM Count number of files in list="numfile", set number of loops
REM SET i=1, For i to "numfile" DO

REM Take 1st file from list and store in variable "filename"

REM Put "filename" in script

REM Run script

REM Close script
Close C:\fileLocation\script

REM Goto "filename" i+1

REM Repeat Put/Run/Close/Goto until done

Answer:Batch file that replaces a filename in a txt file

Hi and Welcome to SevenForums,

Not sure what you want to do with the filenames so i have put an example together here that may help.

I can see you are counting the files and then trying to repeat until all files have been done, i think this task would be better using a FOR LOOP, this may help understand it a little - For /f - Loop through text | Windows CMD |

Here is the code i have put put together quickly, towards the bottom is where you see the FOR Loop, essentially what it is doing is looping through the stated file (list.txt) and setting them to the variable %%a then i am telling it to echo %%a, you need to change that bit... rather than echo %%a you need to make it do what you want, depending on what that is the script may need more work.

Disclaimer - Always test the code on dummy data before using on live data

REM Prompts user for the directory
set /p pathName=Enter the File Path of the folder:

REM 1. Change to the location set above
REM 2. List all files in that directory and store in a text file on desktop
cd %pathName%
dir /s /b *.* > c:\users\%username%\desktop\list.txt
REM Runs 'for loop' to run script against each file in list.txt

REM Currently it just echos the names of the files to the screen and pauses
REM so you can see them on screen, you need to replace the "ECHO %%A" with your command
for /f %%a in (c:\users\%username%\desktop\list.txt) do (echo %%a)


8 more replies
Relevance 47.15%

HiI have one text file that looks something like this. (text1.txt)=================================%type-cliwpa set password Cybershot1%cli_end=================================I have another text file that will include one single random password. (text2.txt)I want o create a batch file that will open text2, copy the word and then open text1 and replace the current password "Cybershot1" with the copied word.

Answer:Batch file to edit another text file

This should be posted here:

2 more replies
Relevance 47.15%

I need a command line for bat files . I want an Exe file open a target file . For Example I write >>> Open "target.img" With "XnView.exe" . then I save this code as a bat & when I run it the target file will open with My exe file . I don't mean association , I want write a code for One file Only to be open with a software .

Answer:Open File With Exe File Command for batch

It should be in the form:<path1> XnView.exe <path2> target.imgIt is important that there is a space between .exe & <path2>The rest is a matter of syntax but this will cause XnView to run target.img (assuming the two are compatible).some other bloke...

2 more replies
Relevance 47.15%

Hello, I was wondering if there was anyone who could please help in writing a batch file. What I am trying to achieve is fairly simple but I'm having trouble getting all the code together to make it work. What I am trying to do is simply copy a file off a network share and place it into a specific location on quite a number of PCs (around 200-300). Now the specific location I am referring to on the users PC will differ depending on what OS they are on. We only use XP or Win 7 so I want the batch file to first determine is the user a member of a certain AD security group (which is called 'Teachers') and if the user is using Win 7 then copy the file else if the user is a member of the 'Teachers' security group and is the user is using XP then copy the file to a different location. I have written 2 batch files which accomplish what I need to do however there are no if else statements in there. Here is my 2 batch files:Windows 7 - @ECHO OFFECHO.xcopy "\\cgkewsccm01\necprojector\user.lst" "\\%COMPUTERNAME%\C$\Users\%USERNAME%\AppData\Roaming\NEC Projector User Supportware\Communication Settings\" /C /R /H /K /YWindows XP - @ECHO OFFECHO.xcopy "\\cgkewsccm01\necprojector\user.lst" "\\%COMPUTERNAME%\c$\Documents and Settings\%USERNAME%\Application Data\NEC Projector User Supportware\Communication Settings" /C /R /H /K /YThe file I am copying is a small config file needed to update some networked NEC Projectors and must go into the 2 locations I have specified above. Thank you all fo... Read more

Answer:Batch File to copy a file based upon OS

Ok I have managed to write a batch file to accomplish most of what I need (see below) I just need this to now only copy to member of a certain distribution list. I will keep working on it so if anyone has any ideas please [email protected] offver | find "XP" > nulif %ERRORLEVEL% == 0 goto ver_xpif not exist %SystemRoot%\system32\systeminfo.exe goto warnthenexitsysteminfo | find "OS Name" > %TEMP%\osname.txtFOR /F "usebackq delims=: tokens=2" %%i IN (%TEMP%\osname.txt) DO set vers=%%iecho %vers% | find "Windows 7" > nulif %ERRORLEVEL% == 0 goto ver_7goto warnthenexit:ver_7xcopy "\\cgkewsccm01\necprojector\user.lst" "\\%COMPUTERNAME%\C$\Users\%USERNAME%\AppData\Roaming\NEC Projector User Supportware\Communication Settings\" /C /R /H /K /Yecho Windows 7goto exit:ver_xpxcopy "\\cgkewsccm01\necprojector\user.lst" "\\%COMPUTERNAME%\c$\Documents and Settings\%USERNAME%\Application Data\NEC Projector User Supportware\Communication Settings" /C /R /H /K /Yecho Windows XPgoto exit:warnthenexitecho Machine undetermined.:exit

4 more replies
Relevance 47.15%

How can I tell the batch file that if the name already exists to change the current file name to the same file name but with the current date and time in the file [email protected]

Answer:file incremental change (batch file)

if exist %1 ren %1 %~n1%date%%~x1

3 more replies
Relevance 47.15%

Help me make a batch file that copies a file from one computer to another computer in a network...

PC1 = Source
PC2 = Destination

I want to copy a file from PC1's Drive E: to PC2's Drive E:

Answer:How to copy a file from 1 pc to another pc in network using batch file

Yes I want to copy files from PC1 to PC2 over the network...

PC1's Drive E:\Online Games\Battle of Immortals\Battle of the Immortals
PC2's Drive E:\Online Games\Battle of Immortals\Battle of the Immortals

9 more replies
Relevance 47.15%


I need some kind of program/batch file that will place the current IP address (I have dynamic so it changes every two hours) in a text file that I have specified. The text file would have to be in this way:
Click to expand...

Click to expand...

I am using graburl to update my host of my location, so I thou ht that I could use graburl to do something like this. If it is not possible to include date and time in the text file it is not completely required. However the latest IP address would have to be at the top of the list not at the bottom (This must also happen even if date and time columns are in the list).

Any help would be great.

Answer:Batch file that will put current IP in a text file

12 more replies