Over 1 million tech questions and answers.

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

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

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.

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

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 -- Read Random Line from External File into an Environment Variable

Read other 6 answers

People, I am from Brazil. My English is not very well! Sorry.

I need read a file .txt, where, I need put the last line in a variable.

I am tryng find de number of lines and with a FOR /F read line and line.

But not this going right.

@echo off
setlocal enableextensions enabledelayedexpansion

set/p n=<teste.txt

REM ### Here I cat the number of the lines ###
type teste.txt | find /v /c "" <teste.txt >nlinhas
set/p l=<nlinhas

REM ### Variable that sum ###
set num=0

REM ### Read line and line ###
FOR /F %%n in (teste.txt) do (

if %num%==%l% (
echo %%n
goto :fim
set/a num=num+1 <== Where I put this code, occurs syntax error


A:How I read a file .txt and put the last line in a variable

This should be enough:

for /f "tokens=*" %%a in (teste.txt) do SET LINE=%%a
echo %LINE%

Every new read line will set the variable LINE. When all lines are read, you'll end up with the last line as the value.

Read other 1 answers

Hi, any advice for the following problem? Thanks for any help possible.

I wish to have a batch file to read the filename from folder A and later display a menu from these filename.

For example folder A has 5 file(1.zip, 2.zip, 3.txt, 4.exe, 5.zip). It will read all the .ZIP file and assign variable so that I can call upon these variable for use later.

The final output on screen should be something like these and when I enter 1, I can call the filename 1.zip. Likewise when I enter 2, I can call the filename 2.zip.

1. 1.zip
2. 2.zip
3. 5.zip

Please enter an input:

A:batch file to read filename and assign different variable to be called upon

Read other 7 answers


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.


A:Batch File Read Line Of Text File

Read other 7 answers

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

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

Read other 16 answers

Hello Everyone,

I am new here so please pardon my question if it has been answered before.

I am running Vista 32 and office professional 2007. When I fire up word I get a

" can not create work file, check the temp environment variable"

I was directed to the regedit in the blogs, yet all leads to dead ends.

Without word working correctly.... office is useless

Any help would be greatly received

all the best

A:Can not Creat work file,check temp environment variable

IE7 runs in "low integrity" mode on Vista (aka "Protected mode") - this means that, by default, it has even less access to your system for security reasons. If Word is started from IE7 when accessing a URL still in "Protected mode" (i.e. not in "Trusted sites") then it will also be launched in "low integrity" mode.

However, the "Content.Word" folder in "Temporary Internet Files" is probably marked as "medium" integrity, because it was probably created when IE7/Word was executed previously when in Protected mode. This means that the folder cannot be accessed by Word now, as Word is "low integrity" and the folder has A higher integrity!

You may need to lower the integrity of that folder using a tool such as Mark Minasi's chml.exe: http://www.minasi.com/apps/[/URL] to get it to work with URLs in Protected mode. Or add the site of the document to your Trusted security zone.


Read other 2 answers


I keep getting this message every time I am trying to attach a word doc into an email. Check temp environment, sims ok, followed instruction to move the folder, every thing ok until I have to get the temp internet file, its not there. I am using windows 7. Can anyone one help?
Many thanks in advance


A:word could not create the work file. Check the temp environment variable

Regedit>HKEY_CURRENT_USER\Software\Microsoft\Windows\Current Version\Explorer\User Shell Folders>make the cache variable --- %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files

Read other 7 answers

Every time I open Word this pops up. I can no longer insert pictures of clipart into my documents and I looked into the system properties/environment variables but am at a loss....someone who knows what this means please inform me as to what needs to be done so that my
program begins to work properly again. Thank you.

A:Error : Word could not create a work file. Check Temp Environment Variable

There is some sort of problem with the Windows temp folder (perhaps deleted by mistake?). To check (and fix if needed) right click on "my computer" and select "properties". In the box that opens click on the "advanced" tab. Now click the button near the bottom marked "environment variables". The path to the Windows temp folder will be shown at the top part of the box. Check to see if the path actually exists or edit it to a folder of your own choosing. Check both "TEMP" and "TMP" and, if you alter them, make them use the same folder. Okay your way out and reboot. Now try the programs you are having difficulty with.

Read other 6 answers

@echo off
color C
SET IPaddress=0
set /p IPaddress=Please enter the destination Ip Address:
color A
ping IPaddress
okay, so i want the IPaddress variable to be used as the ipaddress to be pinged. When i run this, it is ineffective. Can someone teach me as why and how to properly code this?

Actually i just figured out how to reference the variable with modulus/percentage symbols.

A:.bat file, batch coding simple variable use

Quote: Originally Posted by Skylais

Actually i just figured out how to reference the variable with modulus/percentage symbols.

Does this mean that you no longer need help?

You might also want to make the batch file loop back to the start.

Read other 3 answers

For example, if i set a variable as the date, 11/11/2010, what command could i use to remove the "/", making the variable 11112010?

A:How do I remove a certain piece of a variable in a batch file?

Read other 7 answers

On one of my PCs, I get "The system could not find the environment option that was entered" when I try to open the command prompt at the administrator level (and when I try to pen various other things). I think I need to reset the windir system environment variable, but I can't do it through the GUI - properties of the Computer won't open at all. I've read that it can be done using setx, but I'm not that familiar with the syntax needed when working with the command line. As far as I can tell, I need three parts - setx, %windir%, and C:\. How do I put these together the right way? I can boot into an administrator-level command prompt in Safe mode, so I'd like to give it a try.

A:How do I set the environment variable using the command line

Read other 16 answers

I am trying to write a batch file in Windows xp that will get the system time store it in a variable then compare that to a constant time such as 10:10 PM. Then, if they are equal it will run the rest of the code, but until it is equal it needs to keep checking. Is there like while or do while loops? I am a total noob in batch file writing. Also, Is there a way to get that batch file to run even if the computer is not logged in? For example the computer is sitting at the log on screen and the right time comes around so the batch file runs and does its thing anyways?
Thanks for any help in advance.

A:Comparing a variable to the system time in a batch file

This sounds more like something you should use Scheduled Tasks for. It can be set to run a batch file when the user is not logged on.

If you have to do it in a batch file, use the built in %time% variable. On my system the format is HH:MM:SS.SS. Regional settings may affect this, so type Echo %time% in a command prompt to see how it's displayed on yours. You'll need to parse the hours and minutes before doing the check.
You can also use now, but that includes Month, Date, Year and possibly Day of week as well, so would need even more parsing.

There are no while or do loops in batch, so you would need to constantly loop, which will load the CPU, or add a delay before checking again.
Two ways to add a delay are to use ping, or use the sleep.exe utility, part of the Windows 2003 Resource Kit.

This will do what you want. I've included two wait routines, as there are two ways to use ping to create a delay. To use the 2nd, change the call statements from Call :_wait to Call :_wait2.
If you use sleep.exe, just replace call :_wait with sleep
If you run the batch, then log off the account, it will exit.
If you add it to the HKLM run key, it should start at boot.
You might be able to keep it running using the at command to start it.
I've not tested either method.

@echo off
Set _hour=20
Set _min=10
:: If you want to specify the time on the command line, use this instead:
:: Set _hour=%1
:: Set _min=%2
:: And call using name h m
:: Do not include a leading z... Read more

Read other 2 answers

Hi, is it possible to read from a text file with a batch file to define a certain variable?

So if i have a "start.txt" file with the following:

and a batch file with the following in it:
Set _Start=

can i make the batch file read start.txt and put the "1" after set_start= ?

A:Solved: reading/setting a variable from a txt file with batch.

set /p _Start=<start.txt

Read other 1 answers

I'm not a script expert but I'm trying to right something simple (or so I believe).

I want to run a command in a batch file: systeminfo

This command returns a lot of information.

I want to be able to extract two lines and place their content into variables, more specifically, "Host Name" and "System Up Time". Than I would write them to a file (as if it was a log). I already got something similar doing the following:

systeminfo | find /i "Host Name" >> text.txt
systeminfo | find /i "System Up Time" >> text.txt

The problem is that this only creates a string that I can't treat. I would like the "System Up Time" to be broken into hours, minutes and seconds (or translated into seconds) because I want to add a statement that if the "system up time" is less than 10 minutes, then do something.

Is this possible?
Is there any other command that I can use?
Any help is appreciated.

Read other answers

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

I don't know scripting or PowerShell (yes I need to learn something)
I'm not an expert batch file maker either.

I have a WinPE flash drive which I used to deploy OS images. I have the WIM, drivers and anything needed else outside the WinPE environment to ensure that updates, changes are easier for me to make.

I use the "STARTNET.CMD" batch file which is part of the WinPE
The reason to go through the letter drives is that the WinPE always gets the X letter drive assigned

The flash drive itself can receive a random letter which always changes.

My deployment menu is located on the flash drive it self and not inside the WinPE. This is so that if I need to make a change I don't have to re-do the WinPE.

I am able to locate the "menu.bat" batch file and launch it

I use a variable to capture the letter drive

I call the second batch file named "menu.bat" and pass the variable to it

When the second batch file loads, I believe that I am calling the variable correctly. If I break out of the batch file I can echo the variable and see the expected reply.

The issue is that I can't use the variable to work with anything on the second batch file.
In my test, I can get this to work over and over.

When it runs from the real USB flash drive it does not work.

I removed comments from the second batch file to make it smaller.

My issue is that files below all get a message stating that the system cannot find the path specifie... Read more

A:WinPE Startnet.cmd Variable passed to custom batch file

Read other 9 answers

Need aid in figuring out how to set the _Var(x) variables read in from the text file (which contains directory listings) file to either new variables or a way to incrementally reference (_var1, _var2, _var3...) in an IF or FOR statement later in the batch file. ISSUE - the second IF will not iterate properly the string saved from the input file in _var1, _var2, _var3....

SET cnt=1
SET cnt2=1
SET SYNCCmd="C:\Program Files\SyncLaptop\SYNC.CMD"
SetLocal EnableDelayedExpansion
::This line is just in case n has been defined before the batch file is run
::This FOR loop works flawlessly - reads in all file paths to _var variables
Set n=
Set _InputFile=c:\TEMP\SYNCLOG\SyncDirList.txt
For /F "tokens=*" %%I IN (%_InputFile%) DO (
Set /a n+=1
Set _var!n!=%%I
:: Line will display the variables just assigned - delete when not needed
Set _

:: LOOP through directory listing variables _var(x) until there are no more
IF %%_var!cnt!%=="" GOTO CLEANUP
ECHO first variable is: %_var!_cnt!%
SET _LocalDrv=_var%_cnt%
SET /a _cnt2=_cnt+1
SET _NetDrv=_var%_cnt2%

:: Check if real directory values where set to the variables - delete later
ECHO LocalDrv is: %_LocalDrv%
ECHO NetDrv is : %_NetDrv%
:: Open net CMD window, set color etc & call the XCOPY SNYC.CMD file to sync the two designated HD folders
START /W CMD /C "ECHO OFF & CLS & MODE CON: COLS=60 LINES=15 & COLOR 74 & %_SYNCCmd% "%_LocalDrv%&quo... Read more

A:Batch Script - Variable issue from parsing an input file

Welcome to TSG!

You initialize these

SET cnt=1
SET cnt2=1

Note there is no leading underscore.

This line uses the correct name, but should not have the doubled % symbol, just a single one:

IF [COLOR=Red]%%[/COLOR]_var!cnt!%=="" GOTO CLEANUP
Should be
IF %_var!cnt!%=="" GOTO CLEANUP
But these use a leading underscore:

ECHO first variable is: %_var![B][COLOR=Red]_[/COLOR][/B]cnt!%
SET _LocalDrv=_var%[B][COLOR=Red]_[/COLOR][/B]cnt%
SET /a [B][COLOR=Red]_[/COLOR][/B]cnt2=[B][COLOR=Red]_[/COLOR][/B]cnt+1
SET _NetDrv=_var%[B][COLOR=Red]_[/COLOR][/B]cnt2%
Change the variables so all are consistant, either using an underscore or not.

Also, you are setting the _LocalDrv and _NetDrv variables to _var+the number in _cntX. These lines should be:

SET _LocalDrv=[COLOR=Red][B]%[/B][/COLOR]_var[COLOR=Red][B]![/B][/COLOR]_cnt[COLOR=Red][B]![/B][/COLOR]%
SET _NetDrv=[COLOR=Red][B]%[/B][/COLOR]_var[COLOR=Red][B]![/B][/COLOR]_cnt2[COLOR=Red][B]![/B][/COLOR]%
Set _var= only clears one variable named _var. It won't clear _var1 or any others.
If you want to clear all of the _varX variables use this loop:

For /F "Tokens=1 Delims==" %%I In ('Set _var') Do Set %%I=
Use ('Set _') to clear all variables that start with an underscore.



Read other 1 answers

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.

@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

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

[SIZE=3] 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 " " 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

Hi Guys ,
I want to copy some files to a specific user profile for many PCs via batch file . For example ,  User name is AAA . I need to copy files to "C:\Users\AAA\Appdata" .  
As sometimes the user profile of AAA located in "C:\Users\AAA" or "C:\Users\AAA.Domainname". So currently I copy the bat file in the startup folder of AAA . The content of bat file is as below . 
xcopy files "%userprofile%\AppData /S /Y

But the shortage is that it will start to run bat and copy file when AAA login every time . So I want to improve the deployment .
So Does any guys know how to assign special user account (AAA) to %userprofile% variable ? So I can run bat file only once via SCCM deployment and no need to add it into startup folder run again and again .

Read other answers

Hi i think this cant happen but im asking

can i make it so when on a file is dragged and dropped onto a batch file it is assigned a variable or becomes a variablev and the assigned variable or file is copy to a folder

basically i want a file dragged and dropped onto the batch file to copy to specific folder

thx in advance

A:file Dragged and Dropped on batch assigned variable then xcopied to a folder

bump one day

Read other 2 answers

how do i read the top line of a text file into a variable>
I am writing to a script to read only the first line of multiple text files.
Instead of using cumbersome for %%% in filename.txt and create single loop, i tried to use
set /p var=<filename
doesn't seem to work as when
echo %var%, the output is echo is on.
Is it because i am using xp?

A:read text file to a variable

Is this a batch script? You should always mention what language you are using.

Read other 2 answers

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:


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

Read other 5 answers

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

A:more complex batch file data from external file

Read other 7 answers

Hi, i have problem to run  Deployment and Imaging Tools Environment as admin and run my exe file in the batch file. i manage to open the  Deployment and Imaging Tools Environment as admin using this codes in batch:

Start "" "C:\Deployment and Imaging Tools Environment" --- i works perfectly. but after i edited the codes so that the  Deployment and Imaging Tools Environment will run my exe file it cannot run. Here is the codes that i use to
run my exe file after opening  Deployment and Imaging Tools Environment as admin.

 Start "" "C:\Deployment and Imaging Tools Environment" firsttime.exe ---nothing happen. it just open the Deployment and Imaging Tools Environment and nothing happen after that.

can someone help me with this?

Read other answers

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.

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

Hi there,
I have a batch file that opens a notepad window with a file and then does some other stuff.

It basically looks like:

notepad.exe C:\file
ntbackup.exe etc etc etc
shutdown -s -t 200 -c "Automatic Shutdown"

However any lines after the "notepad.exe C:\file" do not execute until the notepad window has closed. Is there anyway to get the code to go to the next line even if the notepad window has not been closed?

Thanks very much,

A:Solved: Batch file go to next line of code.

Sorry everyone, I should have looked at other threads before posting:-(

Just found the answer in

I need to add the word start to the beginning of the line to start notepad, then its not waiting for an exit code.


Read other 1 answers

Hi Everybody.

I am attempting to execute a Command Line Interface for a scheduling software called JAMS, execute the relevant processes and then exit (see attatched code) all within a batch file.

I came up with the following but simply can't get the JAMS CLI to populate from SET SERVER ********4001 onwards. I know the rest of the script executes once I manually exit the JAMS CLI (inclusive of the SET SERVER ********4001) so I assume the JAMS CLI isn't being passed the remainder of the batch.

Does anyone know of a way to achieve this? I don't expect that a huge number of people will have used JAMS, but any information relating to similar issues would be greatly recieved.

Thank you for your help.

SET OUTPUTLOCATION = [URL="file://*********/any/old/directory"]\\*********\any\old\directory[/URL]
SET SERVER ********4001


A:Batch File - Passing To Another Command Line

Read other 12 answers

Under Windows 7, is it possible to determine if a specific computer is logged in to a network? If so, how?

Thank you.

Read other answers

First and foremost, before I am told to go download this program or that program or what have you, please note the use:

I am creating a test fax program. I have it set so my users (some who still think computers come with a built-in cupholder) are able to run this fax.bat program I made, where it asks for the number, and then runs this command:
START mailto:fax="%fax%"[email protected]?subject=Text%%20Fax^&body=Residential%%20Repair:%%20/%%20Business%%20Repair:%%
The %fax% is the variable, and this sendto will open an email that the user can send without typing or doing anything else. My issue is that to make it work best, I would like to have it attach a text file that I would have created.

My search on the net all points to programs that run a CMD prompt. This will not work, as I cannot install a server or files on all the the computers that someone might use.

We run 32bit WinXP Professional Version 2002 SP3 (please don't think less of me ) with Outlook 2007. I honestly think it is a lost cause and cannot be done. The best I could do was come up with a list of command-line switches at:


However nothing jumps out to send a file with all the info. The best I could do was "outlook.exe /a testfile.txt" which will load the file as an attachment, however the to address and subject are blank. At at this point, I can do one, or the other. Is there a out... Read more

Read other answers

I have a properties file (myFile.filter.properties) that contains the line

These two serves as my parameter, and I want to pass the value of these two parameters to a batch file...
so that the batch file will process it.

is that possible??


Read other answers

I have username and password in txt file-one string.I have batch that run application that require username and password.I want that batch supply username/password from txt file,in variable form:

sqlplus "username/password" -argument

So i want that instead "username/password" put variable which will read data from txt file:

sqlplus @variable -argument.

I need this because we need to change password every month,and because we need to run more instances of this app (every have it's own batch),i want to change password only once in txt file,not in every batch files

Thanks in advance

A:Batch to read password from txt file

Read other 6 answers

Hi there!

I was wondering if there is any script to read data when a URL is given as an input and save it in .csv format?

Any help is appreciated!


A:Batch file help! How to read data from URL

Read other 16 answers

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

Hello all. I'm trying to write a request to COM2 and capture the answer. My device is 19200 baud 8/1 non parity.

Using a freeware terminal called termite I can send the hex instruction and receive the answer, as verified in HHD serial monitor.

My batch file looks like this:

MODE COM2: baud=19200 parity=N data=8 stop=1 to=off
TYPE request.txt>COM2
COPY COM2 text.txt
where request.txt contains my request.

HHD sees the request being written, but the device does not respond.

Any ideas please?


A:Serial read/write in batch file?

Are you aware this is a Windows 7 forum?

Read other 9 answers

Hi guys, I would really appreciate any help on the following. I had a machine which only hard drive (running Win. XP Pro. SP2) was labled as "E". I changed this to "C" using Partition Magic 8, now when I try and boot the system I get the following error:

partitionmagic (xmnt2002.exe)

PartitionMagic is unable to read the batch file.

Verifiy that the system32 directory is not compressed or corrupt.

press any key to continue.

Once I press any key it says it's completed and then just hangs, I don't get to the Windows log on screen I have tried several things but got no where. I have a copy of Bart PC so can boot using this and edit the registry if need be but have had no success in what I have tried.

Thanks for reading this and if you think you can help please do, really appreciated! I have limited time to sort this as I leave this wkend

A:PartitionMagic is unable to read the batch file - Cannot log into Windows :(

The basic issue is that you can't simply change the drive letter of a bootable Windows installation. If you created the recovery disk for PM, use that to restore the changes you made.

Read other 3 answers

I recently bought an external HDD to back up my files. I wrote a simple batch file to automatically backup files when its plugged into a pc.
Its only after writing this and playing around with an autorun.inf that I realised that autorun is disabled in windows 7 for usb devices.

Is there any workaround for this? I only need this to work on 3 computers so I've no problems installing additional software, changing registry keys or whatever is need to do to these computers to get it working.


A:Autorun batch file on external hdd?

See http://www.sevenforums.com/tutorials...e-autorun.html

Read other 7 answers

[Relevant OS here is XP sp2.] Hi! Norton Internet Security 2004 (which includes NAV) Live Update stopped working right on my parent's PC, couldn't be remedied, and I decided it was time to get rid of the beast as I had long meant to anyway, and put on AVG and one of the reputable free firewalls.

Knowing that for some tricky programs it's best to stop its services before uninstalling (e.g. zone alarm), I turned off all norton in msconfig and rebooted. That's apparently what caused my problem to begin -- guess norton services need to be left on to start an uninstall. It wouldn't uninstall, and only later did I see at the symantec site that the error message I was getting is often caused by services being stopped when uninstalling this product: "Error: A Norton Internet Security account with Supervisor access must be logged in... when uninstalling Norton Internet Security..." (Which was not accurate since I was logged on as sup/admin.)

I did manage to uninstall most lesser, "peripheral" norton components using Reg Cleaner free. Then, feeling fed up, I decided to be hasty (and insane?) and assume I could uninstall the primary parts by picking what I needed to out of Windows Explorer and the registry. After awhile it hit me how stoopid that was, since norton is so notorious for leaving leftovers that interfere with future security progs even when uninstalled properly. And, I saw that if I had checked symantec's site after first ... Read more

A:Solved: Helllllp, lost head, tried removing Norton file by file, line by line!

Read other 15 answers

I have created a batch file where i am passing command line arguments to java class. But some how my parameters are passed to class file. 

Below is the syntax of my batch file.

I even tried printing the arguments on console but the not able to display. Please help me if i am missing anything. This is very urgent.
@echo off 


echo TODAY'S DATE : %date%


set /p user = ENTER USER : 

set /p user2 = ENTER PASSWORD : 

echo arguments %user% %user2%

JAVA -jar bulkUploadScript.jar %user% %user2%




Read other answers

I really need help in creating a batch file that opens a random file from a text file containing numerous file paths.
The list reads as following:
I also don't know the exact length of the txt as I want to be able to use this batch on numerous text files

A:Open a random file Batch

We just did a very similar batch file the other day on the forums. Browse thru this forum category. You should be able to find something that will help you. Otherwise you can wait for me to get back on a computer on Monday to give you the code.

Edit: Found the previous thread. Very similar concept.

Read other 3 answers

Hello everyone,

I am currently working on a generic batch to rotate logfiles. To do so, i must set all relevent info into a "config" file of my choice. I am trying to use a simple .txt file containing a variable number of lines in the following format:


What i am trying to accomplish is to have the batch read each line in a FOR loop (easy enough) and for each line set the following variables:


I just can't seem to find how to read specific portions of each line........

Has anyone encountered such an issue?

Thanks for your help,

Best regards

A:From a batc file, read a line and its content into variables

I just wrote about this on my blog. Here's code sinpet for rotating logs in a batch file.
setlocal enabledelayedexpansion

set LogPath=%SystemRoot%/system32/LogFiles/MyLogFiles
set LogFileName=MyScheduledTask

pushd %LogPath%
if exist %LogFileName%-10.log del /f %LogFileName%-10.log > nul
for /l %%i in (9,-1,1) do (
set /a j = %%i + 1
if exist %LogFileName%-%%i.log ren %LogFileName%-%%i.log %LogFileName%-!j!.log
if exist %LogFileName%.log ren %DatabaseInstance%-Backup.log %LogFileName%-1.log
I explain more of how this works in my blog posting. This should get you started.

Read other 2 answers

I have a few questions about my simple batch to copy a Outlook pst file to an external drive. First, robocopy doesn't copy my file; Second, is there a way to prevent the taskeng.exe window from appearing; and Finally, I tried the command "copy" instead and it copies the file but the taskeng.exe window "hangs" and does not continue to restart outlook and therefore close on its own. By the way, the pst file is over 4Gb. Any help is appreciated, thank you!

:: Backup pst file to Server external drive
@echo off
setlocal EnableDelayedExpansion
start "" "C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe"
taskkill /im outlook.exe /f
@ping -n 5 -w 1000>nul
@ping -n 5 -w 1000>nul
robocopy "C:\Users.pst" "\\SERVER\Outlook Backup\user.pst"
start outlook.exe

A:Batch to copy Outlook pst file to external drive

Read other 6 answers

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.


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.

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

Read other 1 answers

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

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


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

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