Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

6401.

Solve : Parsing from a web source?

Answer»

Is it possible to take lines of text off a web source using a batch file? If so, how would you do it?

ThanxI don't know whether that can be done, but I would think this question is relevant. Would the exact format of the web page always be the same? In other WORDS, would the text always be exactly in the same place/position on the page? Does this make sense?You can load the site down with "wget". (Gnu package).
A very powerful command. :-)
Parsing the text is another thing...

hope it helps
uliYes, the format would always be the same. It be setup like...

c:\windows\test.txt
c:\windows\system32\test.txt
...

and the list would continue on. It's going to be used to help stop spyware from running by using the cacls command to deny permission. Right now I'm taking the lines off a text file but it would be far more effective if I could take them off a web source if the user should choose to do so.

This is my current code.

Code: [Select]for /f "delims=" %%a in ('type caclslist.txt') do echo y|cacls.exe "%%a" /p guest:n|find /i "processed">>caclslog.log 2>NUL
How would I implement the wget command? I put it in but it said it was an invalid command. Is there something else I would have to download? If so I'm trying to find something that anybody can use without having to download anything new.

Thanx in advance for you're helpYes, WGET is an AWESOME tool, but it does not come with Windows. It is actually a Unix / Linux tool, but they have a version for Windows that you can download from http://unxutils.sourceforge.net/ .

You can use it like:
wget http://www.domain.com/source.html

Then it will depend on the format of the file on how you want to parse / extract lines from it. The example you gave appears to be a text file, and not a "web" file, like HTML.

To parse the file you can use a FOR loop with the SKIP param, and FIND or FINDSTR to look for your text to output or save to a file.Kinda figured that it would something I had to download. Is there any way I can do it without having to download something?

Also, I know it's a text file. I just put that there to show what I'm using to see if you had any ideas on what would need to change to make it WORK properly.If you have a Windows machine, you can use VBScript which came free with your OS. You can script your browser to select data on a web page and utilize the clipboard to hold the data before dumping it in a file.

The example below GETS a new HOSTS file from the internet.

Code: [Select] Const ForWriting = 2
Const TristateUseDefault = -2
Const OverWrite = True

Set objIE = CreateObject("InternetExplorer.Application")
Set fso = CreateObject("Scripting.FileSystemObject")

objIE.Navigate("http://www.mvps.org/winhelp2002/hosts.txt")
Do Until objIE.ReadyState = 4
WScript.Sleep 100
Loop
objIE.document.parentwindow.clipboardData.SetData "text", objIE.document.body.Innertext

Set f = fso.GetFile("c:\windows\system32\drivers\etc\HOSTS")
Set ts = f.OpenAsTextStream(ForWriting, TristateUseDefault)
ts.Write objIE.Document.ParentWindow.ClipboardData.GetData("text")

ts.Close
objIE.Quit
Set objIE = Nothing

After saving the script with a vbs extension, you can run from the command line as cscript scriptname.vbs

Hope this helps. 8-)

In the example above, you will never see the browser as it's never made visible.

6402.

Solve : change icon?

Answer»

How can I change icon for one shotcut


pls help me
Right clik it..
PROPERTIES...
Change icon.you can change icon using vbscript
Code: [Select]Set Shell = CreateObject("WScript.Shell")
SNAME = "c:\temp\myshort.lnk"
sTARGET = "c:\temp"
sDIR = "c:\temp"
sICON = "c:\test.ico"

Set Scut = Shell.CreateShortcut(sNAME)
Scut.TargetPath = Shell.ExpandEnvironmentStrings(sTARGET)
Scut.WorkingDirectory = Shell.ExpandEnvironmentStrings(sDIR)
Scut.IconLocation = Shell.ExpandEnvironmentStrings(sICON)
Scut.HotKey = sHKEY
Scut.Save


For speed and convenience #1 is the obvious winner.Quote from: GX1_Man on May 28, 2007, 07:25:35 AM

For speed and convenience #1 is the obvious winner.
yup i agree. personally i don't see the purpose of changing icons, except for personal preferences and for fun.
If its for fun, i wouldn't want to right click every time anyway. I would make it change icon every few hr/min/sec/days/weeks ...up to me...
I just change the icon for my flash drive.
Other than that, i dont see the point of it.
6403.

Solve : Two commands on one line??

Answer»

Is there a way to write two dos commands on one line?

The problem I'm having is that I want to start a java file from a .bat file

It navigates to the folder and enters the command:

java blahblah

to open my blahblah.class file

the next line is:

exit

When running the batch file, the java GUI opens up, but the java command hangs over so the exit will not execute. I was hoping to put SOMETHING like:

java blahblah, exit

so both would run at the same time. But if there's another way, like inserting a break into a .bat file that I don't know about that would help too. Thanks!Using an ampersand may work:

java blahblah & exit

8-)

This will depend on whether JAVA interprets the ampersand as a meaningful character in which case you may have to use the escape character ^Thanks for the suggestion, unfortunately it didn't work.

I tried

java blahblah & exit
java blahblah & ^
java blahblah ^

then:

java blahblah
^

as soon as it hits the java part it GOES to the next line and has a blinky cursor until the GUI is closed.Actually I meant to escape the ampersand:

java blahblah ^& exit

JAVA may parse all the characters on the command line, in which case the command processor never gets control back to interpret the characters after the blahblah

When your program ends, does not it give control back to the calling program which should be the command processor?

Just a thought. 8-)Yeah java parses everything on the line with java on it because you can run multiple FILES that way.

So the ^& exit thing didn't work either.

When my program ends, it does give back control to the console, but the thing is that my program's GUI is pretty small so you can still see the console running in the background, which is kind of what I want to avoid.
I'm confused as to why java blahblah would open a Java GUI.

As an example, after the proverbial "Hello World" program is compiled and then run, it simply outputs it's message and returns control to the command processor. Run from a batch file, the processor would simply execute the next instruction.

Am I missing something? 8-)What is the purpose of the EXIT command after the JAVA command? And why do you think EXIT needs to be on the same line as the JAVA command?

Try each of these (and maybe combinations of each) to see if they give you the desired result:
Code: [Select]start java blahblahCode: [Select]javaw blahblahCode: [Select]java blahblah.classWell I'm not sure why, but the FOLLOWING worked:

start javaw blahblah
exit


What happens now is exactly what I want. The batch file opens up my java program (which has a GUI) and then the batch file closes, leaving the java window still up and running.

This way it's like they click an executable file and ran the program.

Thanks for all of the help folks.

6404.

Solve : How can I stablish the prompt information of date/t like a File Name...?

Answer»

Hello, I have an issue making my batch PROGRAM, I'm using the command rar to compress a file and this .BAT file is executed everyday automaticly. I WANT to know how can I put the information prompted when I execute the command date/T like the file name before it be compressed..

Thanks and Please SORRY my English, It isn't my root language...I'm not exactly sure what you're wanting unfortunately, I'm sure it's a language barrier issue. Maybe you could explain it a different way or give an example of what you want?What OS are you running? If Windows 2000 / XP / 2003 / Vista, you can do something like:
Code: [Select]@echo off
setlocal
set /p filename=Enter the file name:
rar.exe a "%filename%" compressed.rar
In this example, the word between the "set /p" and the "=" is your variable. It will be set with whatever you type in at the prompt when the batch file is run. You can then access the variable later in your batch file.

Is that what you were looking for?Thanks for your help, but I find a better and easy way to MAKE it, I use the rar compressor switch like this:

rar a "prefix of the filename (not necesary)" -agYYYYMMDD ".zip (The extension of file)" file to compress.xls

I hope it be useful to another user...

6405.

Solve : how do i erase a file folder in dos??

Answer»

I "safely" assume that is DOS that comes with Windows, not pure MS-DOS. That's what i observed most of the time when posters did not indicate their OS.To be technically correct, DOS is not part of Win XP or Win 2K. But, DOS commands can be used by opening a "command prompt" panel. That may seem like a contradiction but this reference gives a very brief explanation: http://www.5starsupport.com/xp-faq/1-59.htm

Your assumption is probably correct. I don't spend much time in the Microsoft DOS forum here, but I'd guess that very few of the questions pertain to systems where DOS is the actual OS. I mean, how many computer users are still running computers with MS-DOS as the OS?Quote from: soybean on May 27, 2007, 05:41:31 PM

I mean, how many computer users are still running computers with MS-DOS as the OS?

I suppose what I should realise is that most of the people who post on here are from the 4 corners of the world, often English is not their first language, and they do not KNOW or care if the command prompt they are using is called MS-DOS, Windows NT, or Loonix. They just want to fix some immediate problem and get back to playing World Of Warcraft. The only person I am giving a hard time to, by getting all *censored* about the terminology, is myself. So no more rants.

Windows 95, 98, 98SE, and ME all use MS-DOS 7 or 8 as the command interpreter so when a user of one of those OSs opens a command box they are using MS-DOS in a 16-bit virtual machine. Also when a user boots from boot disk prepared in Windows they are running MS-DOS. Vista boot disks contain MS-DOS 8.

# MS-DOS 7.0 - August 1995 – shipped embedded in Windows 95. Included Logical block addressing and Long File Name (LFN) support

# MS-DOS 7.1 - August 1996 – shipped embedded in Windows 95B (OSR2) (and Windows 98 in June 1998). Added support for FAT32 file system (COMMAND.COM is 93890 BYTES)

# MS-DOS 8.0 - September 2000 – shipped embedded in Windows Me. A subset is included with 32-bit versions of Windows XP and Windows Vista. Last VERSION of MS-DOS. Removes SYS command, ability to boot to command line and other features

The 'subset' is what you get if you type "command" at the 2K or XP prompt

CODE: [Select]c:\>ver

Microsoft Windows XP [Version 5.1.2600]

c:\>command
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

c:\>


cmd.exe is the NT prompt interpreter, and command.exe is the DOS one.

Also, NT CLASS OSs can run 16-bit DOS using DOS 5 command.com in an NTVDM (NT Virtual DOS Machine) like this...
Code: [Select]C:\>ver

Microsoft Windows XP [Version 5.1.2600]

C:\>exit

c:\>command.com /k ver

MS-DOS Version 5.00.500


C:\>


6406.

Solve : need help to run exe with automated input from txt?

Answer»

:P1.at dos,the intention is to run c:\TVUPlayer_1.5.12_20060209.exe without need to enter next> next> next>
FYI,there are about 5 "next>" that need to be accepted while installing the program.

2.Read about redirection from google groups and other forums, which recommended I do this

c:\TVUPlayer_1.5.12_20060209.exe < input.txt
where input.txt contained the 5 "next>"


3.the content of input.txt which I attempted

a)
^M
^M
^M
^M
^M

b)<-
<-
<-
<-
<-

where the "<-" is the unicode left arrow character which I cannot be formatted correctly here.

Both a) and b) did not work for me

4.Is there anywhere which I did wrong or some other way to do this?
I suspect the problem here is that I don't know the proper value for 'carriage return'.

The program i am trying to install can be found in this link
http://www.download.com/TVU-Player/3000-2194_4-10549204.html?tag=listAs best as I can tell, TVUPlayer is a Windows program. You will not be able to send keys from the batch environment to the Windows environment. You can use any of the Windows Scripting languages (VBScript, JSCript, Perl, REXX, etc) to mimic keystrokes and send them to a running Windows application.

There is also a free program, AutoIt which may be helpful in this situation.

Good luck. 8-)I agree with Sidewinder. I don't think either DOS or a batch file is the proper solution for your problem. If you really want to use a batch file, have it create and run a VBS file.

Create and run a .VBS with something like:
Code: [Select]set WshShell = CreateObject("WScript.Shell")
WshShell.Run "c:\TVUPlayer_1.5.12_20060209.exe"
WScript.Sleep 2000
While WshShell.AppActivate("TVUPlayer") = FALSE
wscript.sleep 1000
Wend
WshShell.AppActivate "TVUPlayer"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 2000
WshShell.SendKeys "{ENTER}"
You can run the VBS file from a command line or batch file with
cscript filename.VBSThanks guys for setting me in the right direction.
I tried using the .vbs
However,I could not get past the 1st window on the .exe which prompts me to enter the language and to hit 'ok' after that.

When i manually hit OK at the first pop-up window the wscript took over.

Is there different syntax required for pop-up windows?

another alternative can try Expect for windows
http://bmrc.berkeley.edu/people/chaffee/expectnt.htmlFor the VBS, I took a GUESS on what the Window was CALLED. Replace the lines:
While WshShell.AppActivate("TVUPlayer") = FALSE
WshShell.AppActivate "TVUPlayer"

"TVUPlayer" with what the window is actually called (name in the bar at the top) and SEE if that works.hi GURUGARY,

I just removed those two lines and it worked for me.

A follow up question to this,will the script work if the application were to be installed in another server?

In other words
Server A contains the .bat file
Server B can contain the .vbs
Server B contains the .exe to be installed.




If they are both on the same NETWORK, and you have proper permissions, you should be able to set it up to work. The hardest part would be if you need launch one of the programs on command from the remote machine.

6407.

Solve : extending input over multiple line in batch file?

Answer»

I have an INTEL utility that needs its input spread accross several lines DUE to
the command LINE LENGTH limit .

When the utility sees a "&" character, it KNOWS its input comes on the next line.

However, the command line processor sees the next line as separate input and tries
to process it as a separate command.

I tried a makefile backslash character at the end of the line but that didn't help.

Anybody know the trick to extend batch lines?This is confusing. What process is requesting the input? If the command processor is the requestor you can try using the ^ escape character before the &

ex. line1 input [highlight]^&[/highlight] line2 input

If the utility program is the requestor, the ampersand should work as the command processor never gets involved.

8-)

6408.

Solve : redirect input?

Answer»

i really blank this time...

@echo off
ver >myver.txt

if "98" appear at myver.txt GOTO 1.bat
if "XP" appear at myver.txt GOTO 2.bat

with my narrow knowledge... i cant use find

can anyone help meQuote

i really blank this time...

@echo off
ver >myver.txt

if "98" appear at myver.txt GOTO 1.bat
if "XP" appear at myver.txt GOTO 2.bat

with my narrow knowledge... i cant use find

can anyone help me


use find : eg

ver | find "Windows XP"

then check for %errorlevel%: eg

IF %errorlevel% EQU 0 Goto whateverthanks ghostdog74...

the lines u gave me is working well in XP..

and for win98, the line below should be OK..
but my writing SCRIPT is not very good...
i believed, other people would do this better

@echo off
ver |find "XP" >NUL
IF NOT ERRORLEVEL 0 echo Its 98
IF ERRORLEVEL 0 echo Its XPOr shorter:

@echo off
ver|find "XP">NUL&&echo.It's XP||echo.It's 98


guys...
i'm USING WIN98 (ver 4.10.2222)

i want user to enter the filename.rom... -->(i'm afraid i cant use CHOICE)
i have a list of filename(s).rom in C:\BIOS...
i want to compare user entry with the list of filename(s).rom in C:\BIOS
if exist the entry filename.rom the system will copy content from exist filename.rom in C:\BIOS into the new.rom to be executed for the next stage...

1.user enter filename.rom
2.compare the filename.rom with C:\BIOS
3.if exist the filename.rom in C:\BIOS copy filename.rom into new.rom

please help me... thanks in advance#!/bin/bash

echo "Choose your NEW.ROM.."; ls
read new
cd C:\BIOS
if [-e $new]
CP C:\BIOS\$new C:\NEW.ROM
else
echo "You not enter correctly"

echo "Choose your OLD.ROM.."; ls
read old
cd C:\BIOS
if [-e $old]
cp C:\BIOS\$old C:\OLD.ROM
else
echo "You not enter correctly"

i feel something weird.. but i dont know...
is this OK?woah..it seems like you are using unix bash shell? are you running cygwin or something?...don't confuse yourself.....i really depressed now...

what i really want to do is run this script at the start up MontaVista Linux OS. i believed i have to create the cfg file to receive this variable and to be used for next stage... but i just don't know where to start.

it's really hard to get the OS while not bothering other staff to test the script...i posted at a wrong forum huhu... sorry..

my question would be how i want to check whether file is exist in one folder or not? most challenging part is.. the file name is entered by user

cannot used this
if [ -e "$filename_by_user ]
then
echo Exist
else
echo Not Existyou are doing shell here...which is apparently, the "wrong" forum...

echo "Please key in path"
read userinput
echo "User keyed in $userinput"
if [ ! -e $userinput ] ;then
echo "$userinput does not exist"
exit 1
fi

## continue ....i'm gonna run this at WIN98 DOS...
.bat file..

Quote
you are doing shell here...which is apparently, the "wrong" forum...

echo "Please key in path"
read userinput
echo "User keyed in $userinput"
if [ ! -e $userinput ] ;then
echo "$userinput does not exist"
exit 1
fi

## continue ....

absolutely not Ok for batch file.. above script could only be ran as .bash...

how to do the same script in DOS..

from my understanding, dos 98 can accept user input as choices..
or user have to enter the filename and the variable..
ie test.bat variable
and INSIDE test.bat
@echo off
if %a '==' GOTO exit

please help meXset is very useful!

my problem finally gone..

xset.tripod.comwe have to pay for xset...
other solution is using LMOD..

try this out..
http://home.mnet-online.de/horst.muc/index.html
6409.

Solve : if exists a string in a file do this...?

Answer»

Hello,


Can someone help me with the syntax in a .BAT file to do the following?
If exists the string "hello" in a file ECHO hello exists
If not exists the string "hello" in a file echo hello does not exists
use findstr and errorlevel

findstr "hello" textfile
if %errorlevel% EQU 1 echo Not found

This is a similar version of what Ghostdog did, but I included the output for hello existing, and not existing (and I prefer to use if errorlevel instead of comparing the errorlevel environment variable). This ASSUMES you are running WINDOWS 2000 or NEWER and you want to find any case of "hello":

Code: [Select]@echo off
find /i "hello" file.txt >NUL
if errorlevel 1 (echo hello does not exist) else echo hello exists

6410.

Solve : dos animation?

Answer»

Hi,

a friend gave me an very very old computer (386 or older). It runs only in DOS.
As an artist I just want the computer to do something - for example flare like a fire.
I'm not so routined with Programming in DOS so I've found some adequate exe-files in the web, but they does not function on this old computer - they seem to be to new.
Other examplefiles from 1988-1990 did function - but they do not animate the monitor.

Did anyone have an idea, where I can find examplefiles from around 1989 that can simulate a fire on the monitor?
Did anyone have an idea how I can let the pc automatically type WORDS and sentences for hours?

I'm very thankful for any advice.

Greetings,
Aldero

(sorry for my mediocre english)For an animated fire on the screen, you can try using an animated GIF file like:
http://www.awesomebackgrounds.com/templates/as-fire-apb-anim-1.GIF
or
http://ddickerson.igc.org/animated-fire.gif may work on a black background
and then just find a DOS animated GIF viewer (http://garbo.uwasa.fi/pc/gifutil.html).

For the typing words or sentences, you can do something with a batch file, or I think the BASICA and / or QBASIC programs came with DOS that you could probably use. If the PC is REALLY slow, then a batch file may give you the results you are looking for. If the PC is a 386 or faster, then it may scroll too quickly for what you are looking for, in which case a BASIC program should be able to do what you want.

For a batch file, you could do something like:
Code: [Select]@echo off
:Sentences
echo Insert your own random, witty text here
echo Insert more random, witty text here
echo Just keep going with whatever sentences you want
goto SentencesHi,

thanks a lot for the answer.

The MS-DOS viewer (ftp://garbo.uwasa.fi/pc/gifutil/lxpic71.zip) gives an error "unsupported videomode" (this solution would have been great).
Meanwhile I found on http://www.masterric.de/?weda=Download.htm&sub=menu-Download.txt&PHPSESSID=a6dc9f1321d923bdd207967ac997a2ce the file "Feuer- Effekt". However the pc answered "numeric co-processor required".

At LAST I tryed a *.bat-file with 'echo' and 'goto' (now with '@echo off' it's much more better;-)

What I realy want is a programm that types the LETTERS (on the cursor) like I would type it manually. With this solution I would be real pleased.

Greetings,
AlderoI am sure there are animated GIF viewers for DOS that will work on your PC. Just keep trying until you find one that works.

For the random text, do you just want letters that don't need to spell out words? How fast do you want it to go? It would be pretty easy to get random CHARACTERS to go flying across the screen, but slowing it down may be tricky.I'll keep on searching the right viewer (after this weekend ... the sun is shining and the weather is fine ;-)

The text-solution should funktion like I'm typing now my answer in this message box - letter for letter. I want to present an fastidiously, readable text - as part of an installation with video, pictures and other computers.

As far a computer does a minimum of 'autonomous' work, it will get asylum in my house.

Sunny greetings,
AlderoNow I've tasted a lot of DOS-viewers however no one of them does function. If something happend at all there came messages like this:

  • There is no VGA on your system.
  • Pictview requires at least 386 Prozessor
  • v pic: You need an EGA with 128K ore more video memory to run this program
Probably this Computer is not in the condition to act with graphic.

I'm still searching a programming that types readable Text letter for letter.
Do you have any old computer parts? If you do, you should try and upgrade that beast! if not, you might be able to find some really cheap on ebay, if you do want to go anything graphical.



Viper
If no graphic is possible on this computer I can do without.

I prefer the above specified Text-Animation and am still searching for a solution (maybe in Basic?).
6411.

Solve : Close notepad.exe - taskkil??

Answer»

Does anybody knows the command to close notepad in windows xp. On the site from microsoft they reccomand taskkil (http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true) but if I use that, I get an error of unknown command or something. Can anybody give me the right code or EXPLAIN how it really works, because I don't understand a lot of microsofts explenationWin2000 had a Kill command. Taskkill shipped with WinXp Pro and Win2003. It did not ship with WinXP Home which may explain why you get an error of unknown command or something.

You can download the program from Taskkill

The usual way to run it is:

taskkill /IM programname

although there are filter options and options to run against remote machines.

Good LUCK. 8-)

Of course there is ALWAYS the possibility that you do have the command but it doesn't live on the system path.
do you mean notepad.exe the spyware, or what?Notepad is part of Windows. Check it out. How come u don't know that??what he is means is virus/trojans with the name notepad.exe.ok, he probably does not know what hes talking about. hes my friend.Quote

Win2000 had a Kill command. Taskkill shipped with WinXp Pro and Win2003. It did not ship with WinXP Home which may explain why you get an error of unknown command or something.

You can download the program from Taskkill

The usual way to run it is:

taskkill /im programname

although there are filter options and options to run against remote machines.

Good luck. 8-)
Of course there is always the possibility that you do have the command but it doesn't live on the system path.

OK, that explained why it was in the list and why it didn't work on my computer. You're totally right! Now, I liked to work on both computers so how should I do that. Something like this?

Code: [Select]if %os%=="windows xp progrofessional" goto prof
if %os%=="windows xp home" goto home
:prof
taskkill /im notepad
:home
kill /im notepadQuote
what he is means is virus/trojans with the name notepad.exe.


*censored*, don't be difficult... I just want to learn the command, so it doesn't mather wich program I close. If it would be a virus this command wouldn't be able to close it anyway... Notepad is a simple text editor that I use to type my batfiles in...Quote
Quote
what he is means is virus/trojans with the name notepad.exe.


*censored*, don't be difficult... I just want to learn the command, so it doesn't mather wich program I close. If it would be a virus this command wouldn't be able to close it anyway... Notepad is a simple text editor that I use to type my batfiles in...


:-? i was referring to dimitri...not youLike I said Kill shipped with Win2000 not WinXP Home. Either download Taskkill to your Home machine or use tskill which apparently shipped with both Home and Pro versions of XP. You can get DETAILS by typing tskill /? at a command prompt.

Afterthought: You cannot use the %os% variable to distinguish between the Home and Pro versions of XP. In both cases Windows_NT is returned.

8-)
6412.

Solve : Batch Challenge ??

Answer»

Hi everyone,

I love creating Batch File in Ms dos LANGUAGE but today i am in FRONT of a big problem.

Here is a list of files :
01135755.582 07/20/2006
01135842.326 06/20/2006
01135927.656 05/20/2006
01136187.328 02/20/2006
.....

I have plenty of this and everyday the SOFTWARE is creating new ones.

I try do make a batch which main GOAL is to take the most recent files and to copy it in a specified folder.

AS i am returning all ms ds command, i don't manage to make it.

Can you help me ?

Regards ,
OK I find out myself :

Code: [Select]@echo off
set repun="C:\RELCPT\RELCPT\"
set repdeux="C:\RELCPT\"
set nomdest="Le_plus_recent.txt"

set /a count=0

if exist "%repun%*.*" for /f "delims=" %%a in ('dir /od /b "%repun%*.*"') do (
set variable=%%a
set /a count+=1
)

echo les fichier le plus recent EST %variable%
echo il y a %count% fichiers dans ce repertoire
if %count% GEQ 2 copy "%repun%%variable%" %repdeux%%nomdest%

6413.

Solve : Re: Deleting posts?

Answer»

I say it depends on the TOPIC. . .Yeah, and sometimes I like going through all the new ones and seeing if I can answer them; there are so many that It takes me forever!more votes please!!!!Technically post arent deleted because PEOPLE can use for refrence. HOWEVER many people are to lazy to use the search button to look for answers to there questions FIRST. Im sure some are diffrent and many are the same. They do get deleted eventually if no one looks at them i dunno how long they stay though. Besides each post is only a few KB.

6414.

Solve : Minimise a batch window?

Answer»

I'm running a batch file from a Novell login script and I would like the dos window to be minimised when the batch file runs. I cannot do this by using the/min command so I need some WAY of minimising the window from within the batch file itself. The batch file is as follows:

@ECHO off

C:
COPY z:\outgoing\fi_nt86.exe c:\AVUPDATE
COPY z:\outgoing\ii_nt86.exe c:\AVUPDATE
COPY z:\outgoing\Siglist.txt c:\AVUPDATE

net use \\192.9.200.203\IPC$ "win2000"

wscript.exe "o:copytemp.vbs"

wscript.exe "o:UserFileBackup.vbs"

wscript.exe "o:proxyswitch.vbs"

exit

I would really appreciate it if someone has the answer to my problem.Quote

I need some way of minimising the window from within the batch file itself

I'm not aware of any mechanism to do that. Why can't you use START /min batchname.bat?

8-)I'm invoking the batch file from a Novell login script using the '@' command and /min doesn't work with this.

Unless I'm WRONG. I have tried it a few times though.You may be SOL on this. I did find the include command, however it offers no parameters for minimizing the window. Neither do # and @.

8-)Don't know if this will work or not, but anything is worth a try. See if you can force the .bat file to open minimized from its properties dialog.I can't see any option for this in the property dialogue.

There must be a way.....Must be XP! Another way MS chose to screw us. A work around to this is possible if you have access to a W98 machine. Copy a .pif file from W98 onto the XP machine, then modify it to POINT to the proper program. This will give you the same properties control that W98 has.I think Sidewinder has the right idea.

Instead of calling your login script like this:
Code: [Select]@login.bat
Call it with the start command like this:
Code: [Select]start /min login.batI would obviously use the /min to minimise a batch file window normally. But as I'm invoking the batch file from a Novell login script using the '@' command i'm unable to do this.

Thats why I asked if there was any other way. I tried the .pif file thing but Novell doesn't let me invoke the shortcut which would open minimised. Just one other point as well.....The reason i'm using the '@' command is because the batch file will run in the background to speed up the login process.
6415.

Solve : Basic batch file question?

Answer»

I'd like to time responses from my various mail servers. (I need to demonstrate performance problems to ISP.) Pseudocode would be

get time
telnet domain1 25
quit
get time
display interval
repeat for domain2

Apparently, telnet is waiting on keyboard.

1. How do I redirect input for telnet to batch FILE instead of keyboard?

2. Does anyone know where sample date arithmetic code to show interval exists?

(I've been looking and not finding answers to both questions.)

Thanks in advance for the help,

PKFirst create a file that has the same commands that you would use in your telnet session. For example, create a file called telnet.txt with:
Code: [Select]helo
test.com
quit
Then create a batch file similar to:
Code: [Select]@echo off
for %%a in (domain1.com domain2.com) do (
echo Initializing connection to %%a at %time%
telnet %%a 25 <telnet.txt >NUL
echo Connection to %%a established at %time%
echo.
)
echo Finished.
Replace your domains with "domain1.com" and "domain2.com" above.Gary, thanks so much. I learned a ton with that attempt.

I cannot get telnet to process in same order as when I do commands manually. When I do it via keyboard, telnets waits for initialization of smtp server, then reads keyboard input.

When I do via batch file, telnet seems to crater before it even TRIES to initialize connection on port 25.

Thanks again,

PKAn alternative using python smtp module.
Code: [Select]import smtplib,time
starttime = time.time()
print "Start time : %s " % (starttime)
smtp = smtplib.SMTP("mailserver")
try:
smtp.ehlo("mailserver")
EXCEPT smtplib.SMTPHeloError:
print "HELO error from Smtpserver"
else:
stoptime = time.time()
print "Stop time: %s" %(stoptime)
print "Time difference: %s seconds" %((stoptime - starttime))
GhostDog and Gary... thanks for the help.

The python solution was over my head...

I was able to demonstrate the problem to my ISP in a way that they see the problem. (We'll see if they can fix it?)

Thanks again for the help,

PK

6416.

Solve : Get folder Size??

Answer»

Hello, I've read your forums a bit recently and they've been quite helpful with some problems, however I still have a few.

I'm trying to find out the size of a folder using MSDOS, and also how to subtract two numbers. (Possibly a daft question, but I cant do it)


If it helps to know why I want to know, its because I've written a batch script to backup a server daily, and I want to check if the folder will fit onto the drive before I delete the old backup and replace it, only to find it gets a disk full error part way through.

All i plan on doing is getting the remaining SPACE (which I already have done), add thesize of the backup I'm deleting, to find the total space I'll have available. Then get the size of the new data, and subtract the new data from the space available, and if it's under 10gig email a warning, and 0 or less to email saying it won't manage and so hasn't backed up the files. (I've got the emailing sorted)

Thanks There's probably an easier way, but in a DIR command, you can get the total size of the directory in bytes...in the resource kit, there's a tool called diruse.exe...also usefulThe DIRUSE tool suggested by Ghostdog is the easiest way, and it is a great tool. You could get the total space used with the DIR command, but assuming there are sub directories that need to be calculated, you will probably need to use the DIR /-C command in a FOR /F loop and add the totals up.

If DIRUSE won't work for you then let us know and we will help you with a script that will add all the subdirectories together for you.

To subtract two numbers, try this:
Code: [SELECT]@echo off
set Num1=1234
set Num2=200

set /a Result=%Num1% - %Num2%
echo %Num1% - %Num2% = %Result%DIRUSE worked great thanks. I GUESSED i was doing something WRONG with the subtraction, I'd just tried to echo the actual calculation rather than saving the result and echoing that.
No wonder it didn't work

Thanks for your help

6417.

Solve : shortest command to find if a directory exists?

Answer»

I would like to do this so that I can

if exists Dir then echo don't do anything
if not exists dir mkdir c:\thenewdirectory

-----------------------
My current solution is the following.Any SUGGESTION for something shorter?

dir c:\thenewdirectory\ /s >> c:\patches.txt

if exists c:\patches.txt echo don't do anything
if not exists c:\patches.txt mkdir c:\thenewdirectory

This is the shortest solution I can think of based on your example:
Code: [Select]if not exist c:\thenewdirectory md c:\thenewdirectory
But you COULD ALWAYS just use the MD command which will create the directory UNLESS it already exists like this:
Code: [Select]md c:\thenewdirectory>NUL

6418.

Solve : at and errorlevel?

Answer»

Hello,

I am checking the scheduled tasks at the PCs in our Network.

Problem is that "at" always gives out errorlevel 0 if there is a scheduled task or not.
(So I get a long list to read...)
I tried a workaround with:
at \\%PC% |findstr /B /V /C:"-"
But didn`t get it really to work.

This is my (yet) working Code without the errorlevel workaround:
:MAIN
REM main procedure
rem -counts the pc numbers
rem - SUB pings the pcs and checks the "errorlevel"
rem -SUB1 if the pc is running at COMMAND
rem (and my little problem)

CLS
For /L %%A in (%VON%,1,%BIS%) do call :SUB %%A
goto :EOF

:SUB %%A
set PC=HA%1
for /f %%I in ('Ping -n 1 %PC% ^| find /c "Antwort"') do call :SUB1 %%I
goto :EOF

:SUB1 %%I
if {%1} GTR {0} (
echo.
echo %PC%
at \\%PC%
)

goto :EOF


many thanks in ADVANCE for any help
uliWhat version of Windows are you running? Try the SCHTASKS command INSTEAD of AT. I'm not sure if it RETURNS an errorlevel or not, but if it doesn't you can search on the output it gives for errors.I am running NT4 Sp6a with NT Ressource - kit and the Gnu Unix tools.

(The schtasks command is not availaible on my system.)

I tried to use the output from "at". It becomes just a bit difficult to make another For loop in the x'nd sub-prozedure.

uli
you wanted only to check whether there are configured jobs at the remote?
Code: [Select]set error=There are no entries in the list
for /F "tokens=1* delims= " %%i in ('at \\PC') do (
set errorstring=%%i %%j
if not %errorstring%==%error% echo There are some jobs configured
)

have not tested the IF statement.
We can just check the return string returned by "at". I find when there are no configured jobs, "at" returns "There are no entries in the list", so i guess you can manipulate this..

6419.

Solve : Are you board try this!?

Answer»

Very simple.
.
..
...
....
.....
......
.......
........
.........
..........
...........
............
.............
..............
...............
................
.................
.................
................
...............
..............
.............
............
...........
..........
.........
........
.......
......
.....
....
...
..
DAKOTA........ Your so far off the mark , I don't believe it. I think you had better revisit PROBLEM solving 101.........
Your method doesnt seem to cut it.

LOL....... and just for the record....... the term "board" presented in your original post header ....... isn't the correct usage of that word........ The word that you meant to use ........should have been "bored" as in you have nothing to do and you are bored.
The term board , could be used like this for example ........you are as thick as a board.


dl65 Ouch! Not bored anymoreMy ice cream has bones it in.What do you have? CHUNKY Cod?2 ? ?

patio. 8-)[size=24] YES![/size]

And Patio wins the PRIZE!WATS the prize?Quote

Your so far off the mark , I don't believe it....

By the way Sidewinder, this is incorrect use of the word your! The word you should have used is [highlight]you're[/highlight]Man this is funny every one is flaming, lol.It's the one of the not so many hot topics too!Well now it's very hot topic!!
6420.

Solve : help plz dos - batch?

Answer»

I allways look through help files first but i dont even know where to start on this... what i would like to know is how to execute one of two commands once a BATCH file is ececuted...

example

press any key to run command or

press another key to run other command

thanks for any helprem Choice between 2 commands.
%comspec% /c choice /c:ab For command1 hit a for commmand2 hit b
if errorlevel 2 goto :COMMAND1
if errorlevel 1 goto :COMMAND2


:COMMAND1

echo first command

:COMMAND2

echo second command

hope it helps
uli




ok for some reason this DIDNT work for me just kept running wild i couldnt hardly stop it maybe i did somethig wrong SRY im sllooow at this
fat_basterd21

What operating SYSTEM do you use? In WinXP you can build a simple menu like described here:
http://www.dostips.com/DtTipsMenu.php

Hope this helps. Quote

rem Choice between 2 commands.
%comspec% /c choice /c:ab For command1 hit a for commmand2 hit b
if errorlevel 2 goto :COMMAND1
if errorlevel 1 goto :COMMAND2

if i.m not mistaken..

goto COMMAND1
goto COMMAND2

dont have to put : over thereAnybody can help me...?

how to copy the folder from the CD into desktop after run the batch file..?how to do it...?Quote
Quote
rem Choice between 2 commands.
%comspec% /c choice /c:ab For command1 hit a for commmand2 hit b
if errorlevel 2 goto :COMMAND1
if errorlevel 1 goto :COMMAND2

if i.m not mistaken..

goto COMMAND1
goto COMMAND2

dont have to put : over there


You are right. Sorry for the mistake.
Thanx Everyone for you help i will look over the sites when i get a chance. I think this batch menu will be good enough...
6421.

Solve : formatting xp pro?

Answer»

Having a few probs here.
bought a 2nd hand comp with a fake copy of xp pro on it, it wouldnt let me do anything on it so i tryed to over write with xp home it only gave me a 2nd op system on it not deleting pro ...my file system is ntfs so crating a dos bootdisk is not POS, im looking to format the full hdd but all the usual ways arent working could anyone give me a few ideas. more information is here if needed (had CMOS password prob aswell but got through that, can i do anything from here,cmos i mean?) All i want to to is format the full hdd so i can get xp home as the only op system on it.If you boot with the CDROM and delete the existing partiion and then install, or at least format the existing partition it can proceed as normal.wanna go in to little more detail? deleted the partition as i installed home but told that would run with 2 op systems on same part.. did i want to continue?.... where have i gone wrong
Quote

wanna go in to little more detail? deleted the partition as i installed home but told that would run with 2 op systems on same part.. did i want to continue?.... where have i gone wrong

You deleted the only partition? Then you just have to go ahead with the install and let it create and format a new partition and install. Everything should be removed this way - the fake XP, your problems, etc.

Can you not proceed past this point? What about some SPECIFIC info from you about this?FDISK IT!!! I ASSUME you do not want any data that is currently on the drive? If you boot to your "real" Windows XP CD, the Windows Setup program should run automatically. Press Enter at the first screen to install, then Continue on the current partition (I don't think FDISK or removing the partition is necessary). Then it should give you an option as to what you want to do with the partition, with the default choice being to leave it alone. Change it to "Format NTFS" (either quick or full should be fine). That will make it erase everything that is currently on the drive, and install a single clean copy of Windows XP. Just follow the prompts from there.pirate software is bad NEWS. my friend deadhead reckon use it a lot but he shouldnt. i tell him not to no more."format c :"

without the quotes and replace the letter to whatever is assigned to it.
6422.

Solve : help with net user (username has?

Answer»

ok, i need to check a few things on an acount on my computer, and the USERNAME of the person has an

ampersand (&) and when i type their username (craig & jenna) it doesnt take it

i have tried replacing the ampersand with ^& and $A , i dont know what to do

please help,

thank you in advance,

Devin

sorry, i FORGOT to mention that i am USING net user
the comand net user isnt working with the user name (craing & jenna)
i have to use net user, sorry for the confusiondetails, please? specs for the PC? when did this problem start? did it ever work properly?os: xp

i dont know know when the problem started i have never tried to use net user on this user beforeQuote

[highlight]details, please? specs for the PC?[/highlight] when did this problem start? did it ever work properly?
NVM, i just put craig & jenny in quotes

net user "craig & jenny" randompassword

thanks for trying, sorry i was so difficult
6423.

Solve : Protected Directories????

Answer»

hi! i have a boot failure PROBLEM and i'm TRYING to access winnt files which is stored in drive C. using msdos, i've noticed that the winnt directory is displayed like this...

WINNT `

the command I used was cd\winnt

but i encountered an invalid syntax. there's is also a ` symbol, and i'm not sure if this is a part of the syntax.

i've also tried the command cd\winnt `

and i encountered an error that the ` exceeds the parameter. i can't access all the directories which have ` symbol.

can anyone tell me what the correct syntax is? thanx!!! You could TRY using:

cd "\WINNT `"

I'd be more curious about where these ` came from. :-?ok i'll try it tmrw. i also don't know where the ` came from. most of the directories have ` in it, and i'm having trouble accessing the files that is contained in those directories. THANKS sidewinder! the syntax is correct! thanks a lot!!!

6424.

Solve : start windows from DOS?

Answer»

We have lost the ability to boot to windows due to a virus. We can bring up a DOS window but cant remember how to start windows from there. We use XP home. :-?Do you have a real Windows CD to do a repair install?

http://www.microsoft.com/windowsxp/using/helpandsupport/learnmore/tips/doug92.mspx

How did this happen? What preceeded this? Those issues will need to be addressed as well.If your Windows installation is not corrupt type the following at the C: prompt:

CD\Windows and hit Enter...

Then type WIN and hit Enter.

patio. 8-)Thanks to all for the informaton. It seems that my husband downloaded something that then allowed lots of pop ups. In an attempt to FIX the problem the system locked up and WOULD not boot. I have spent 3 hours today on the phone with tech support and the explorer file is corrupt.
We are running XP home that was an upgrade from ME so I dont have a complete version to reinstall. This is a Gateway 933Mhz with 512 RAM. I think we will have to reformat the hard drive and attempt to start over. I will be calling Gateway tech support on my NEXT day off.
Thanks again to you alll!!
dianneDid you get a real Windows CD with the Gateway? If you have that AND the copy of XP that was put on there, that will be all you need. The XP needs to have not been installed on ANOTHER machine, obviously.I got repair disks with Gateway. It came with ME installed and I purchased the XP upgrade. I would imagine I will have to go to Gateway for help.Good luck and let us know how this PROCEEDS.

6425.

Solve : mac add in pure dos?

Answer»

I WONDER IF ANY ONE CAN HELP… AT THE MOMENT I AM USING GHOST SERVER TO INSTALL 3 DIFFEENT TPYES OF LAPTOP.. ORIGINALLY W MADE A LIST OF THE SERIAL NUMBERS OF EACH LAPTOP AND THEN LINKED EACH SERIAL NUMBER TO ONE OF THE THREE TYPES OF LAPTOP SO GHOST WOULD NO WHICH IMAGE TO SEND TO INDIVDUAL MACINES.. THIS WENT FINE UNTIL WE HAD A REPARED LAPTOP IN WHICH HAD THE SERIA LNUMBER BLANKED OUT IN DOS……………. NOW THIS IS WERE I AM STUCK WE WON’T TO BE ABLE TO CPATURE THE MAC ADRESS IN PURE DOS BUT NOT SURE HOW TO DO THIS DOES ANY ONE KNOW THE SINTAX TO OBTIAN THE MAC ADD IN PURE DOS… @echo off
for /f "tokens=12 delims= " %%a in ('ipconfig /all ^| find /i "physical address"') do set mac=%%a
echo %mac%
pause

that will get the mac on the computer you run it on but if you need to get the mac for a remote computer I have a script for that to just tell me if YO want it. Quote

Quote
@echo off
for /f "tokens=12 delims= " %%a in ('ipconfig /all ^| find /i "physical address"') do set mac=%%a
echo %mac%
pause



For /f is not working in pure dos. (Until M$-Dos 7.1. - I don`t know the new Free Dos etc.)

To get the Mac Adress from a remote computer you can use the getmac COMMAND from the RESSOURCE kit.

uli
6426.

Solve : laser printer setup?

Answer»

:-? :-? :-?
Help
:-? :-? :-?

Trying to help a friend who needs a LPT printer, I have found him a Samsung Laser printer but am having problems getting it to print.

He runs a video hire business that is run by a DOS program.

Ive tried to print the autoexec.bat to the LPT PORT but nothing happens (type autoexec.bat>lpt1)

? is it possable to print to any printer with a parallel port from DOS ?

? Do i have to setup the port ?

? If so How ??

REGARDS Dave
You need to have printer that can use the DOS output from that program. A parallel port is not proof POSITIVE that you can. You can redirect output to an LPT port from a command line, but that is NOT the same thing as using the DOS printer driver in that program, no doubt. What MODEL Samsung is this? We can find out soon enough.Quote

You need to have printer that can use the DOS output from that program. A parallel port is not proof positive that you can. You can redirect output to an LPT port from a command line, but that is NOT the same thing as using the DOS printer driver in that program, no doubt. What model Samsung is this? We can find out soon enough.


i have the choice of two printers the first choice would be a Samsung ML-4500, the second at a push would be HP laserjet 5m

Regards DaveIt appears the Samsung is hopeless for your purpose as mentioned above:

http://erms.samsungusa.com/customer/sea/jsp/faqs/faqs_view.jsp?PG_ID=1&AT_ID=6116&PROD_SUB_ID=29&PROD_ID=29

An HP seems more suited to the TASK if using a parallel port cable.



6427.

Solve : How to Read File using VBScript?

Answer»

I'm new to VBScript. I've found a lot of DOCUMENTATION, but can't seem to accomplish my first task.

I simply want to Read each line of a text file and be able to do something with that line.

My code is attached.

I seemed to try a gazillion things that don't work.
When I try execute OpenAsTextStream, I get an Invalid Call or Arguement message.

The rest of the code is just a guess at what I need to do next.

[size=14]Thanx in advance for your help![/size][/color]
Code: [Select]ReadAll
msgbox "Done!"

sub ReadAll()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TriStateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
dim fso
dim s
dim f
dim ts
set fso = createobject("Scripting.FileSystemObject")
set f=fso.GetFile("H:\AppDevCtr\DistAppl\DataFile.Txt")
set ts=f.OpenAsTextStream(ForReadng, TriStateUseDefault)

'------------------------------------------------------------------------
'--- Iterate through the entire file
'------------------------------------------------------------------------
'
' This is where I wing it because I really have no idea of what to do!
'
'------------------------------------------------------------------------
Do While not f.eof and not f.bof
s = ts.ReadLine
msgbox s, vbOkOnly, "This is a line of text!"
' Do I have to do anything here to go to the next line
loop
end subI made a few changes but you can SEE the general idea.

Code: [Select] Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TriStateUseDefault = -2, TristateTrue = -1, TristateFalse = 0

set fso = createobject("Scripting.FileSystemObject")
set ts=fso.OpenTextFile("H:\AppDevCtr\DistAppl\DataFile.Txt", ForReading)

'------------------------------------------------------------------------
'--- Iterate through the entire file
'------------------------------------------------------------------------
'
' This is where I wing it because I really have no idea of what to do!
'
'------------------------------------------------------------------------
Do While not ts.AtEndOfStream
s = ts.ReadLine()
msgbox s, vbOkOnly, "This is a line of text!"
Loop
ts.Close

Hope this helps. 8-)

Note: you really don't need all those CONSTs but no harm, no foul. There is a compiled help file for VBScript and JScript. Try searching your machine for Script56.CHM.Oh my, Sidewinder! You've been a tremendous help all weekend. One last question, and I'm done (for today anyway!)

The last thing I need to do is use the values I got from my external file and placed in SArray - and use them to do an XCOPY.
(I know FSO has a file copying FEATURE, but I'm in a rush and I need to use some of XCOPYs parameters - or learn how to code for them tonite - and I just don't have time.)
What do I have to do to execute the XCOPY command?

[size=12]Thanx [/size]- [size=14]AGAIN[/size]


Code: [Select]ReadAll
MsgBox "done"


Sub ReadAll
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TriStateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim SArray
set fso = createobject("Scripting.FileSystemObject")
set ts=fso.OpenTextFile("H:\AppDevCtr\DistAppl\DataFile.Txt", ForReading)

'------------------------------------------------------------------------
'--- Iterate through the entire file
'------------------------------------------------------------------------
Do While not ts.AtEndOfStream
s = ts.ReadLine()
SArray = Split(S, " ", 2, vbTextCompare)

msgbox trim(sarray(0)) & " - " & trim(sarray(1)), vbOkOnly, "XCOPY first file to second file"
'----------------------------------------------------------------------
' I need XCOPY to be executed here using the SArray Parameters
'----------------------------------------------------------------------
'xcopy SArray(0) SArray(1)
Loop
End subYou can create the Shell object and then use the Run method.

Code: [Select]ReadAll
MsgBox "done"


Sub ReadAll
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TriStateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim SArray
set fso = createobject("Scripting.FileSystemObject")
set ts=fso.OpenTextFile("H:\AppDevCtr\DistAppl\DataFile.Txt", ForReading)
Set WshShell = CreateObject("WScript.Shell")

'------------------------------------------------------------------------
'--- Iterate through the entire file
'------------------------------------------------------------------------
Do While not ts.AtEndOfStream
s = ts.ReadLine()
SArray = Split(S, " ", , vbTextCompare)

msgbox trim(sarray(0)) & " - " & trim(sarray(1)), vbOkOnly, "XCOPY first file to second file"
'----------------------------------------------------------------------
' I need XCOPY to be executed here using the SArray Parameters
'----------------------------------------------------------------------
cmd = "XCopy " & SArray(0) & " " & SArray(1)
WshShell.Run cmd,,True
Loop
ts.Close
End sub

If you need switches for the XCOPY, add them as literals when building the cmd statement. The True on the Run statement will wait for each XCOPY to complete before the loop continues. This is important as each XCOPY is started as a new process.

Note: I removed the "2" from the Split statement. Better to let the interpreter decide how many substrings are returned.

Good luck. 8-)You're a gentleman and a scholar! I really appreciate the help - especially on a weekend!

[size=14]Thank you[/size] and [size=12][size=14]Good Night[/size][/size]And just when I thought I was done - I have to ask my very first question all over again - but for VBScript - not .BAT

How do I stop XCOPY from asking me if the destination is a File or a Directory.
In the .BAT file, I echoed an F in front of the XCOPY command. In VBScript, that does not seem to work.

[size=14]Thanx again!!!![/size]

Code: [Select]Readall
MsgBox "done"


Sub ReadAll
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TriStateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim SArray

set fso = createobject("Scripting.FileSystemObject")
set ts=fso.OpenTextFile("H:\AppDevCtr\DistAppl\DataFile.Txt", ForReading)
Set WshShell = CreateObject("WScript.Shell")

'------------------------------------------------------------------------
'--- Iterate through the entire file
'------------------------------------------------------------------------
Do While not ts.AtEndOfStream
s = ts.ReadLine()
SArray = Split(S, " ", 2, vbTextCompare)

'----------------------------------------------------------------------
' I need to programatically answer F to the XCOPY prompt
'----------------------------------------------------------------------
cmd = "XCopy " & Trim(SArray(0)) & " " & Trim(SArray(1)) & "/y /q "
' cmd = "echo f | XCopy " & Trim(SArray(0)) & " " & Trim(SArray(1)) & "/y /q /k /d"
MsgBox cmd,,"cmd"
WshShell.Run cmd,,True
Loop
End subUsing the command shell from a VBScript seems to be defeating the whole purpose, especially when the FileSystemObject has so much functionality. But hey! it's your script

Code: [Select]Readall
MsgBox "done"


Sub ReadAll
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TriStateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim SArray

set fso = createobject("Scripting.FileSystemObject")
set ts=fso.OpenTextFile("H:\AppDevCtr\DistAppl\DataFile.Txt", ForReading)
Set WshShell = CreateObject("WScript.Shell")

'------------------------------------------------------------------------
'--- Iterate through the entire file
'------------------------------------------------------------------------
Do While not ts.AtEndOfStream
s = ts.ReadLine()
SArray = Split(S, " ", 2, vbTextCompare)

'----------------------------------------------------------------------
' I need to programatically answer F to the XCOPY prompt
'----------------------------------------------------------------------
cmd = WshShell.ExpandEnvironmentStrings("%comspec%") & " /c echo f | XCopy " & Trim(SArray(0)) & " " & Trim(SArray(1)) & " /y /q /k /d"
MsgBox cmd,,"cmd"
WshShell.Run cmd,,True
Loop
End sub

Note 1: I took the liberty of adding a leading space before the /y switch.

Note 2: Keep in mind that creating objects within a subroutine limits their scope.

Question: I thought the XCOPY /d switch was for date selection. Am I wrong?

8-)They don't call me NEWBIE for nothing.

My objective is to copy a list of files (or directory) from one location to another - with one two nuances

    [*]First - only copy files which are newer in the source directory than the correstponding file in the destination directory. This is accomplished by using the /d parameter without a date.[/list]
      [*]Second - only copy files which currently exist in the destination directory. This is accomplished by the /u parameter. [/list]
      If you could show me how to accomplish this using VBScript - I would be absolutely ESTATIC. This is a learning experience for me - and you've shown me a lot.
      I'm a creature of habit and I'm familiar with XCOPY. But -I'd much rather make the MOVE to FSO as it is more appropriate in this application.

      I have not been able to find or download script56.chm - probably because I am working on a Remote Desktop Connection. I'm gonna try later on another computer. Maybe then, I won't have to bug you with so many quesetions.

      Thanx!


      You not bugging us. We're more than happy to help.

      This may need some fine tuning as I don't have a clear picture what's in Datafile.txt

      Code: [Select] Const ForReading = 1

      Set WshShell = CreateObject("WScript.Shell")
      Set fso = CreateObject("Scripting.FileSystemObject")
      Set ts=fso.OpenTextFile("H:\AppDevCtr\DistAppl\DataFile.Txt", ForReading)

      Do While not ts.AtEndOfStream
      s = ts.ReadLine()
      SArray = Split(S, " ", 2, vbTextCompare)
      Set filein = fso.GetFile(Trim(SArray(0)))
      Set fileout = fso.GetFile(Trim(SArray(1)))

      If fso.FileExists(fileout.ParentFolder & "\" & filein.Name) Then 'source in dest?
      If filein.DateCreated > fileout.DateCreated Then 'source newer than dest?
      fso.CopyFile filein, fileout, True
      End If
      End If
      Loop
      ts.Close
      MsgBox "Done"

      The script was checked for syntax errors not for logic errors. 8-)Fine tuning - No way! It worked like a charm as soon as I corrected my data file.

      In the code you created for me you have the following line:
      Code: [Select]Set fileout = fso.GetFile(Trim(SArray(1)))How would I set Fileout to the desktop or a folder on the desktop?

      Thanx!The DESKTOP is one of many Special Folders in Windows. They're pretty much all handled with some boilerplate code.

      Code: [Select]Const ForReading = 1
      Const DESKTOP = &H10&

      Set WshShell = CreateObject("WScript.Shell")

      Set objShell = CreateObject("Shell.Application")
      Set objFolder = objShell.Namespace(DESKTOP)
      Set objFolderItem = objFolder.Self

      Set fso = CreateObject("Scripting.FileSystemObject")
      Set ts=fso.OpenTextFile("H:\AppDevCtr\DistAppl\DataFile.Txt", ForReading)

      Do While not ts.AtEndOfStream
      s = ts.ReadLine()
      SArray = Split(S, " ", 2, vbTextCompare)
      Set filein = fso.GetFile(Trim(SArray(0)))
      fileout = objFolderItem.Path 'concatenate additonal folders if needed

      If fso.FileExists(fileout.ParentFolder & "\" & filein.Name) Then 'source in dest?
      If filein.DateCreated > fileout.DateCreated Then 'source newer than dest?
      fso.CopyFile filein, fileout, True
      End If
      End If
      Loop
      ts.Close
      MsgBox "Done"

      It should be no problem to concatenate any additional folders to the desktop path.

      Good luck. 8-)
      6428.

      Solve : help me for bootable diskette??

      Answer»

      any body here please i need a bootable disk for diskette?
      with a format file.

      i've got a brand new computer and no software at all? why do my cd-rom cant detect. 0S FAILURE.. please HELP it was my FIRST time.

      Try http://www.bootdisk.com/thank's i've seen it and it's a big help thank's again.Did that SOLVE it? Give us the details, please.

      6429.

      Solve : sleep command?

      Answer»

      Hey guys

      I have the following code
      Code: [Select]:Loop
      ECHO MODE ON
      ping 127.0.0.1 >> test.txt
      findstr "AVERAGE = 0ms" test.txt
      echo %ERRORLEVEL% >> test.txt

      IF %errorlevel% == 0 GOTO END

      :HELLO
      START test1.txt

      :End
      sleep 3000;
      GOTO LOOP
      The problem is when it gets to the sleep command it says it is not reconized as an internal or external command. Any ideas why?

      Thanks for any help,
      JohnThe sleep command is from the ressource kit.
      Do you have it on your machine?

      uliHi Uli.

      I'm not sure, is there anyway to CHECK?

      If I don't, where do I get the RESOURCE kit?

      Thanksyou can get it here Code: [Select]http://www.dynawell.com/support/ResKit/download/wntsleep.aspQuote

      Hi Uli.

      I'm not sure, is there anyway to check?

      dir /s sleep.exe
      If it isn`t found, you don't have the command on your machine.

      uli
      6430.

      Solve : Export registry values in REMOTE server into?

      Answer»

      Hi Hi.

      Via a batch file in my own server,I want to check if a remote server has the IIS registry KEY and export the registry contents to a file.

      I can run the follow script successfully in the remote server itself(i.e. server123) .but when the call comes from my own server it just doesn't work.
      Any IDEAS?

      start \\server123\c$\windows\regedit.exe /e "\\server123\c$\customchecks\iis.txt" "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp"

      Batch files are not designed to run on remote machines. Any of the Windows scripting languages can create a Controller object which can create a remote process with the execute METHOD. You may also find PsTools helpful. I'm pretty SURE the computers in question must be members of a domain. Workgroup networks need not apply.

      8-)What version of Windows is "your own" server running? If it is Windows 2003 (or Windows XP), try this:
      Code: [Select]reg /query "\\server123\hklm\SOFTWARE\Microsoft\InetStp"

      6431.

      Solve : Reading in ping output using batch file?

      Answer»

      Hey guys,

      I'm trying to write a batch file that pings an address and if the average round trip is > 0ms then run a text file.

      The only prob i have is i don't know how to read int he output from the ping command.
      Code: [Select]: Loop
      Sleep 3 h
      ping 127.0.0.1
      // If the average round trip is > 0ms start OverTime.txt
      :End
      Thanks for any help,
      John

      one way is to output to a temporary file USING >>
      then open that file, search for the time and do your other processes...Hey Ghostdog,

      what command should i USE to search the text file?

      Like if i output the results of the ping to "test.txt" how do i search through that for the time?

      Thanks,
      Johncheck out findstr /?
      eg for my case i have these in a file.

      Pinging 127.0.0.1 with 32 BYTES of data:

      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

      Ping statistics for 127.0.0.1:
      Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
      Approximate round trip times in milli-seconds:
      Minimum = 0ms, Maximum = 0ms, Average = 0ms

      Say i wish to find time<1ms, so

      Code: [Select]C:\>findstr "time<1ms" file.txt
      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
      Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

      C:\>echo %errorlevel%
      0

      C:\>findstr "time<10ms" file.txt

      C:\>echo %errorlevel%
      1

      If you prefer to ITERATE each line through the file, use the for loop. Check out for /?

      well, may not be the best way to do what you want, but this wat i could think of now...
      maybe some other gurus can help you..Thanks a lot ghostdog, appreciate it

      6432.

      Solve : Scheduling tasks?

      Answer»

      Hello,

      I have written a batch FILE that starts a .exe program that I have written in Visual Basic. When I run the batch file, it works PERFECTLY. But when I schedule the batch program with the DOS command "at", it is added to the scheduling task, but it never activates the .exe program. I FIRST had the batch file in the "H:\" directory (that is, just under a drive) and then it actually worked (it was scheduled at a specific time and then it run my .exe program perfectly). But as soon as I moved the batch file, and the corresponding .exe file that it starts, to a subfolder under "H:\" (the path is now "H:\Projekt 1\") and scheduled the batch file, it didn't start the .exe program. When I run the batch file manually (without scheduling) it manages to start the .exe file, but when I add it as a task, it doesn't work. Why is it so that as soon the batch file is under a subfolder, it doesn't work to schedule it?
      Very grateful for help!maybe you can try renaming your folder not to include SPACE...i don't know if its the cause, but you can always give it a try...Thx, I'll try that...I have a batch script (*.bat file) which I have scheduled to run from the windows scheduler. This is supposed to pick a file from the G:\ drive of the pc and place it in the C:\ drive. but when run from Schduler it does not recognise the file name or location . The script works when run from the dos prompt. The run as user ID used on both occasion has adminstrator rights .
      Can anyone help please?check schedular log files and see if any messages. also can put some debugging into your batchPost the contents of the batch file.

      Or check the file: C:\Windows\Schedlgu.txt

      6433.

      Solve : ms- dos download?

      Answer»
      does any body know where i can DOWNLOAD ms- dos version 2.0
      thanks!!! No MICROSOFT PRODUCT is available for FREE download, EXCEPT the rarity through their site.
      6434.

      Solve : .bat file that prompts for info?

      Answer»

      Hello,

      I have a user that loves to play games and watch movies during working hours (as we all do), I often use pskill.exe and pslist.exe from sysinternals (fun little apps that lists & kills processes remotely on client machines) to get the job done, but I am trying to automate it a bit more (getting lazy) by setting up two .bat files (one if possible) that will:

      a.) Launch PSLIST in a DOS window with programs variables set while keeping the DOS window open.
      b.) Launch PSKILL in a seperate DOS window with a PROMPT for the next command in the comand line.

      What I have done thus far...which works for my purposes.
      a.) I setup a shortcut with the target of: C:\WINDOWS\system32\cmd.exe /K C:\whodunnit.bat to keep the DOS window open. The 1st .bat (whodunnit.bat) file goes like this:

      Code: [Select]c:
      @ ECHO OFF
      title OPERATION KILLJOY!
      START "KILLJOY" c:\whodunnit2.bat /MAX
      pslist -t \\COMPUTERNAME -u COMPUTERNAME\administrator -p LOCALPASSWORD
      b.) This is where I'm stuck, is there a command that allows DOS to prompt you for the next command/INPUT, such as entering a computer NAME or typing in a non-static number (process thread) with the ability to press ENTER to initialize it??? I was even thinking of creating a MENU if that would seem feasible enough. What I have so far on c:\whodunnit2.bat:

      Code: [Select]c:
      @ ECHO OFF
      pskill -t \\COMPUTERNAME -u COMPUTERNAME\administrator -p LOCALPASSWORD 1028
      The 1028 in the command would be the non-static thread number that would change dynamically, it could also be replaced by the .exe name of the process. Any ideas out there? Or...I could try to setup TASKLIST & TASKKILL for the same results off a .bat file.In a perfect world the poster would tell us what OS is being used instead of us trying to guess with hints scatttered in the post.

      Try using set /p var=prompt

      prompt can be any literal string. You can then use %var% in your code.

      8-)If I understand your goal, I think you are looking for something like:

      Code: [Select]@ ECHO OFF
      title OPERATION KILLJOY!
      :PSList
      pslist -t \\COMPUTERNAME -u COMPUTERNAME\administrator -p LOCALPASSWORD
      echo.
      set /p pid=Enter the PID to kill or [Enter] to quit:
      if {%pid%}=={} GOTO :EOF
      pskill -t \\COMPUTERNAME -u COMPUTERNAME\administrator -p LOCALPASSWORD %pid%
      goto :PSListQuote

      In a perfect world the poster would tell us what OS is being used instead of us trying to guess with hints scatttered in the post.

      Try using set /p var=prompt

      prompt can be any literal string. You can then use %var% in your code.

      8-)

      Please forgive my insolence, for as many people as I help on a day-to-day basis, not including the plethora of years working in I.T., it did not once even cross my mind to communicate the OS I was working with. Our client machines & my own are WinXP Pro-SP2, we like to keep things pretty standard here. Again, my apologies and thank you much for responding to my post.

      Quote
      If I understand your goal, I think you are looking for something like:

      Code: [Select]@ ECHO OFF
      title OPERATION KILLJOY!
      :PSList
      pslist -t \\COMPUTERNAME -u COMPUTERNAME\administrator -p LOCALPASSWORD
      echo.
      set /p pid=Enter the PID to kill or [Enter] to quit:
      if {%pid%}=={} goto :EOF
      pskill -t \\COMPUTERNAME -u COMPUTERNAME\administrator -p LOCALPASSWORD %pid%
      goto :PSList

      You sir...ARE A GENIUS! You ROCK!
      That is my own way of saying thank you. It becomes very evident that I really need to learn more about the different functions of variables and use it more DAILY. Again, thank you...I have certainly come to the right place and I hope to be able to add my own instruction helping others likewise.

      Cheers!
      6435.

      Solve : Copying files from multiple directories into a sin?

      Answer»

      Hello All;

      I am trying to create a batch FILE that will copy files from multiple directories into a single directory using wildcard. Example: I have a directory structure of c:\root\1111, c:\root\2222, c:\root\3333. I would like to copy c:\root\1111\*.txt, c:\root\2222\*.txt, c:\root\3333\*.txt to c:\newdir, and the next TIME I run it I may have a c:\root\4444, so I need to wild card the directory names as well. Of course the problem is if I use /S and xcopy I get the directory structure recreated, and if I don't I can't TRAVERSE the other directories.

      Copy c:\root\*\*.txt c:\newdir is what I want but don't have.

      I HOPE this is understanable and thaks in advance for any insight.If I understand this correctly, you want to traverse the directory structure on the input side, but on the output side all the files end up in the same directory. This may help:

      Code: [Select]@echo off
      for /f "tokens=* delims=" %%x in ('dir /a:-d /s /b c:\root\*\*.txt') do (
      copy "%%x" c:\newdir
      )

      Good luck.

      6436.

      Solve : Reading from a data file in a batch file?

      Answer»

      Hi DOS People!

      I am trying to learn to use batch files.
      For starters - I would like to read a read a data file and just echo EVERY line back.

      I found the following syntax in a help file somewhere, but it doesn't do anything.
      The command seems to be ignored. I verified the filename and there are 5 lines of data.

      Any help would be appreciated.

      This is what I've tried so far!!! Thanx in advance!!!!!!!!
      =============================================
      Code: [Select]@echo on
      :: Learning how to read in batch
      for /F %i in (H:\AppDevCtr\DistAppl\DataFile.txt) do @echo %i
      echo done
      pause
      exit:
      When the FOR statement is used in a batch file, you need to double up on the % signs:

      Code: [Select]@echo off
      :: Learning how to read in batch
      for /F "tokens=1*" %%i in (H:\AppDevCtr\DistAppl\DataFile.txt) do echo %%i
      echo done
      pause

      I would be very hesitant about using scripts from the web unless you're very sure they won't damage your machine.

      8-)
      OBVIOUSLY a good DAY! Your solution worked like a charm.

      Would you be so kind as to give me a run down or different variable types? I didn't know there was such a thing as %%.

      Also, you could you direct me towards some good documentation on using batch files. I am a Microsoft Access programmer by profession. I used to use REXX to do batch type stuff when I was working in other environments. I know they have REXX for PCs but I'm trying to work with what is readily available (and free) first - so I'm using .bat.

      Finally, I just thought I'd let you know that I used the info you gave me to give me the ability to use XCOPY to copy a LIST of files specified in another file. Sounds like a little thing, but it will help me a bunch and give me something to expand on.

      Thanx a meg

      Code: [Select]@echo off
      :: ----------------------------------------------------------------------------------------------------
      :: I cannot FIND a way to XCOPY specifying the destination filename w/o being prompted
      :: " Is destination a file or directory.
      :: For now, I will just keep the file named the same thing and copy it to
      :: a different directgory. This is a limitation I need to overcome.
      :: ----------------------------------------------------------------------------------------------------


      for /F "tokens=1,2*" %%i in (H:\AppDevCtr\DistAppl\DataFile.txt) do xcopy %%i %%j /y /q /k /d /u

      echo You are done! ------------ but we have to get rid of that nagging file or directory message
      echo @errorlevel

      pause
      exit:
      You didn't mention which you wanted, the D or the F. Make changes accordingly:

      Code: [Select]@echo off
      :: ----------------------------------------------------------------------------------------------------
      :: I cannot find a way to XCOPY specifying the destination filename w/o being prompted
      :: " Is destination a file or directory.
      :: For now, I will just keep the file named the same thing and copy it to
      :: a different directgory. This is a limitation I need to overcome.
      :: ----------------------------------------------------------------------------------------------------


      for /F "tokens=1,2*" %%i in (H:\AppDevCtr\DistAppl\DataFile.txt) do echo [highlight]d[/highlight] | xcopy %%i %%j /y /q /k /d /u

      echo You are done! ------------ but we have to get rid of that nagging file or directory message
      echo @errorlevel

      pause

      I keep removing the exit: it has no meaning as written; use either :exit or just the word exit.

      For batch help either Allenware or Rob Vanderwoude can be very helpful.

      You already have VBScript and JScript installed (you have Windows, yes?) and they offer much more functionality than batch code.

      REXX is now available free for PC's so you could leverage your knowledge and forget the learning curve. I learned REXX on an IBM VM/CMS machine and still use it on this PC. Great language and easier to learn and use than batch.

      8-)What a coincidence. I also learned REXX and EXECIO on VM/CMS. I then used it on MVS/TSO.

      I will certainly see if I can get a free copy of PC Rexx - Could you tell me where to go for a free copy of Rexx?
      What text editor do you use with REXX? Do you know if there is ONE that allows file comparisons?

      Practically speaking, it sounds like VBScript or JScript may be that replacement for BATCH files since it is already a part of Windows XP. I use Windows XP and if I do work on someone elses computer, I would have to install REXX to use it. Are there any significant PROs/CONs of VBScript vs. JScript. I already know VBA for Access so I'm thinking VBScript might be the way to go.

      Thanx a gazillioin![size=14][/size] I appreciate the help!

      AngeloIBM Object Rexx was recently released to open source: Object REXX . The IDE was not. You can run your Classic Rexx scripts under the Object Rexx interpreter.

      Personally I use Texturizer as my editor although I had to write my own syntax highlighting file for the REXX language. I also use SPF/PC ($) which apparently has not been updated since WinNT and could not find a live link. There is a free editor modeled after XEDIT called THE.

      Many editors SUPPORT macros which is a great way to extend their functionality (ex. file comparisons). IBM is great for that as the macro language is REXX.

      The easiest thing would be to leverage your knowledge of VBA and use VBScript. For whatever reason, most of the examples on the Script Center site use VBScript and not JScript.

      Regards. 8-)

      6437.

      Solve : can we edit filename.ROM??

      Answer»

      sorry...
      i've search around but i can't find.

      my only question... can we edit filename.rom.
      for an example,
      move file1.rom file2.romEdit and move are two different things. Try again and explain exactly what you are trying to do.hi,
      there are different contents saved in filename1.rom filename2.rom and empty.rom..
      what i want to do is that COPY the the filename1.rom into empty.rom.. and then copy filename2.rom into filename1.rom..
      logically, i can even view things inside the .ROM how can i copy things like that.

      please help me..
      thanksCode: [Select]copy filename1.rom empty.rom /y
      copy filename2.rom filename1.rom /yThanks GuruGary...

      so, i believed.. your answer is Yes, we can edit the .ROM FILE..
      When you ask "can we edit filename.rom", if you MEAN "can we rename filename.rom" or "can we edit the NAME of filename.rom" the answer is yes. If you want to edit the contents of the file itself, it could be done with the debug COMMAND, but you need to know what you are doing.thanks GuruGary..

      6438.

      Solve : Nightly Backup Batch File?

      Answer»

      Hi,

      I am trying to create a batch file to do the following:

      1) Create a directory with today's date as the name, eg C:\backup\2006-07-26\

      2) Copy files from a list of directories into the new directory (ideally, the list of directories will be held in a file)

      3) ZIP the new directory into 2006-07-26.ZIP

      4) Transfer the file to an FTP site.

      I'd REALLY appreciate your help in building this batch file. Even if you can only supply ONE part of it, it'd be a great help - perhaps someone else will supply another part.

      Once it's done, I'll post the completed batch here for anyone else to use.

      Thanks in advance for your help!


      Mr_T
      So far, I've worked out how to create the directory with today's date:

      @ECHO OFF
      CLS
      ECHO ==================================================
      ECHO NIGHTLY BACKUP ROUTINE v1.0
      ECHO ==================================================
      ECHO.
      ECHO 1) Creating temp directory with today's date
      SET DATEDIRNAME = %DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%
      MKDIR %DATE:~6,4%-%DATE:~3,2%-%DATE:~0,2%
      ECHO DONE!
      ECHO.
      ECHO 2) Copying files for backup into temp directory
      Let's say the directory list is stored in directories.txt then use this:

      for /f "TOKENS=*" %%a in (directories.txt) do xcopy "%%a" "%DATEDIRNAME%" /s /y

      Hope this helps.

      6439.

      Solve : Run 2 Executables Simultaneously from Batch?

      Answer»

      Greetings!

      I am Overclocking my Opteron 165 and need to RUN two INSTANCES of Prime95 (one for each core) in order to test for stability.

      Usually, I click two separate shortcuts, but today I am trying to WRITE a BATCH program to launch both instances simultaneously.

      I've TRIED many different things, but what is happening is that the shortcut is launching the first command, but will not launch the second until AFTER the first one is closed. Which defeats the purpose of having both of them run at the same time.

      Is there a command-line parameter I need to know about?

      Thanks in advance, any help appreciated,

      JimmyCode: [Select]@echo off
      start prime95
      start prime95

      I don't know how to specify which core to run on, but using the start command will initiate two instances of your program without waiting for one to end.

      8-)

      Note: Depending how your system is organized, you may have to specify a path to prime95Thanks!

      Quote

      @echo off
      start C:\DownLoad\1Prime95\PRIME95.EXE
      start C:\DownLoad\2Prime95\PRIME95.EXE

      I haven't tried it yet, but this is the text of it.

      I'll come back & complain if it doesn't...



      Thanks,

      JimmyWorked immediately. Thanks you very much.




      Jimmy
      6440.

      Solve : New - Need some help finding error in a file.?

      Answer»

      Hi All -

      I'm on Windows 2000 and I have a Interbase database with a file (the data) that seems to have a corrupted line. I would like to view this file in Dos and see if I can FIND the error. I TRIED to view it and I'm getting the error "out of far Memory". So, I wanted to see if I could extend the memory, but I don't really know how to do this. The file is 861,384 KB.

      I tried to view the autoexec.bat file (I think I can extend the memory there), but I don't remember how to just view it.

      I am not a tech - I know ENOUGH just to be dangerous, so please give me basic instructions. I just need to see this gdb file, once I do, I'll know what to do.

      Please don't tell me to call a tech - they want me to restore from an old backup. I want to give this a try before I have to rebuild the last 10 days of this database. I've made a copy of the gdb file, so it's okay if I SCREW that up.

      Any help would be GREATLY appreciated!

      Thanks!

      Jill :-)most probably, you would not be able to see the data. It should be "garbage". you should USE Interbase itself to see gdb files, but since it's corrupted, you should get recovery tools that are meant to recover gdb files instead of trying to "open and see" the file directly..
      Your file is almost 1 GB. How will you check this file by yourself?

      I'm sorry that you don't have a more recent backup. I don't know if "edit" will let you view that gdb file. You need a hex viewer to be able to read "no matter what".

      6441.

      Solve : Ridiculous CD command question?

      Answer»

      I've done a search and I cant find the answer to this seemingly simple question:

      How do you access a directory in DOS, when the directory name has a "Space" in it, or a "-" or any other random assortment of SYMBOL?

      I had to change the name of one directory via WINDOWS specifically because it had SPACES in it, and typing in CD and then the name with spaces included yielded an "Invalid Directory" message. Now I am trying to open a directory known as "J-Dizzle", and I cannot rename it because "access is denied" when I try!

      What the heck do I type in Dos to access that directory?? It is driving me absolutely off the deep end.

      Help would be greatly appreciated. :-?Quote

      I've done a search and I cant find the answer to this seemingly simple question:

      How do you access a directory in Dos, when the directory name has a "Space" in it, or a "-" or any other random assortment of symbol?

      you can put double quotes...eg cd "c:\A directory with space"
      6442.

      Solve : Batch file to reformat all documents in a director?

      Answer»

      I NEED a batch file that will allow me to reformat all Word documents in a folder. Specifically I need to change the margins and font. Can anyone help me with this? I would very much appreciate it!CindyM, you need a program (VBS or something else) to do the change. The batch file is your last problem.
      And... I don't know to do that program. I know it's relatively easy to create a "macro" in Word, but I don't know to automatically apply to all the documents in a folder. In fact, I know a way, to open EVERY document and launch the macro. But automatically... I don't know. This problem is not a DOS problem (I know you want a BAT file, but not the batch file is the answer to your problem... Or at LEAST, not yet). It's an office problem, and you may ask help from programmers also.Viking is right. You could either use a VBA macro which would run inside Word or you can use a script which runs OUTSIDE of Word. The sample code is a script solution:

      Code: [Select]Set fso = CreateObject("Scripting.FileSystemObject")
      Set f = fso.GetFolder("c:\documents") ' change as necessary
      Set FC = f.Files

      For Each fs In fc
      If fs.Type = "Microsoft Word Document" Then
      Set objWord = CreateObject("Word.Application")
      With objWord
      .Documents.Open """" & fs & """"
      .Selection.WholeStory
      .Selection.Font.Name = "Brush Script MT"
      .Selection.Font.Size = 36
      .ActiveDocument.PageSetup.TopMargin = 1.5
      .ActiveDocument.PageSetup.BottomMargin = 1.5
      ' .Visible = True
      .ActiveDocument.Save
      End With
      Set objWord = Nothing
      End If
      Next

      You will need to change the directory and if you want to watch the script run, remove the single quote from the visible=true line. You will probably also want to change the values for the font name, size and the margins.

      After saving the script with a vbs extension you can run from the command prompt as cscript scriptname.vbs.

      Hope this helps. 8-)

      6443.

      Solve : Installing Multiple Programs Using Logon Script?

      Answer»

      hi i'm trying to install multiple programs using a logon SCRIPT and it isn't working, its only INSTALLING the first one, here is the program:-


      ------------------------------------------------------------------------------------------------------------------------------------------------------

      Color 1F

      cls

      @ECHO WINDOWS Update Script By Richard


      @ECHO OFF
      :Start

      Start

      "\\uk-000-fp-003\services_shared\ITSupportTeam\Techbook\2.Installs\Windows Update\WindowsXP-KB917953-x86-ENU.exe"
      "\\uk-000-fp-003\services_shared\ITSupportTeam\Techbook\2.Installs\Windows Update\WindowsXP-KB917344-x86-ENU.exe"



      :END

      Exit

      SHUTDOWN -L

      ------------------------------------------------------------------------------------------------------------------------------------------------------


      It only seem to install one program, can someone help me install both of them

      Thanks

      RIchard DaleAre you sure the other program is in PROPER place, with the proper security options? Maybe the account used for windows update does not have the minimum security requirements to read/execute those files.thanks for help sorted it now


      RIch

      6444.

      Solve : XCOPY - How to avoid the "FILE or Directory" messa?

      Answer»

      I've been USING XCOPY forever and never figured out how to avoid the nasty message:
      Does C:\NewPlace\Data.txt specify a file name or a directory name on the target (F = File, D = Directory)

      Is there a way of saying up FRONT that it is a file - so if SOMEONE other than me is running the batch file they don't get prompted with what they consider a meaningless question. I LOOKED at all the XCOPY OPTIONS and didn't see anything that would help.

      I am running XCOPY from the following .BAT file.

      Thanx in advance!
      Angelo

      Code: [Select]@echo off

      for /F "tokens=1,2*" %%i in (H:\AppDevCtr\DistAppl\DataFile.txt) do xcopy %%i %%j /y /q /k

      echo You are done! ------------ but we have to get rid of that nagging file or directory message

      pause
      exit:
      This was answered in your other post. Please don't double post as it confuses the natives.

      6445.

      Solve : Character limit on variables within bat files?

      Answer»

      I want to know if there is a way to limit the number of characters on an input variable within a .bat file. Using the %1 command to read in a variable, I want to limit this variable to 8 characters.
      example: test.bat is the name of the bat file and within the bat file there is the following command:
      SET name=%1

      c:\>test 123456789

      I would like name to be equal to 12345678 RATHER than 123456789.

      Any help is appreciated, thanks.This may be helpful:

      CODE: [Select]set name=%1
      set name=%name:~0,8%

      8-)ok, this has nothing to do with your question, so please FORGIVE me.

      I have gone brain dead today. I was sent a word file that is password protected. I know I can remove the password protect from the word file but I am having a brain burp and can't for the life of me remember how. I saved it to a floppy file. I need to remove the password protect to use it as a WORKING copy for a report I am processing. Please help me and forgive the intrusion.

      6446.

      Solve : how to pause batch file for time limit then resume?

      Answer»

      the subject pritty much explains it. i just need to know how to pause a batch file after a cammand and then resume on its own after a given amount of time.Quote

      the subject pritty much explains it

      Not really, as there are different techniques on different OSes and you failed to mention yours. For Win9x (INCL. ME) you can use the choice command with the /t switch (default value after nn second; max 99)

      CHOICE is not available on shipped copies of NT machines, so you can use PING (ex. ping -n 21 should be close to 20 seconds).

      8-)

      Note: PING is the better of the two as it does not tie up the CPU with wasted cycles.





      for win 98 (ver 4.10.2222) and below
      choice /ty,10 /c:yn Do you want to reboot now? %1

      this will wait 10 seconds or else system will choose yes and reboot...

      i HOPE i can help you..MY opologies I was under the impression batch was all the same as dos. Shows what I know... I use windows Xp home and professional... I was actually wanting more than 99 SEC but i will try this... thank everyone that posts... This Site Made me start using Forums...Because ITs Sooo Good
      6447.

      Solve : File Name Script Help?

      Answer»

      Can someone please help me.

      I cannot WRITE code in MS-DOS and I need a script that will change all filenames within a folder and all subdirectories.

      I need all MP3 file names in My Music and in subdirectories to be swapped around and keep the Dash in the middle, for example;

      Blood On The Dancefloor - Michael Jackson
      to become
      Michael Jackson - Blood On The Dancefloor

      I have tried bulk filename changers and they only use file tags and swap them round if you specify the names of each file.

      Please help!

      Regards

      Darren HoskerQuote

      Can someone please help me.

      I cannot write code in MS-DOS

      So learn how to.

      use for loop with tokens,delimiters = '-'.
      eg for "tokens= delims=-" %%a do (
      set swapped=%%b - %%a
      )

      SOMETHING like that.....
      For help, you can TYPE for /? and see how it worksThis would be a pretty advanced batch file. Here are some questions to see if we can make it easier:
      Could any of the filenames have more than one '-' dash?
      Could any of the filenames have more than one '.' period (any besides the .mp3)?
      Could any of the filenames have more than one space before or after the '-' dash?
      Could any of the filenames have no space before or after the dash?Hi Thanks for the reply.

      In answer to the questions;

      Could any of the filenames have more than one '-' dash? - Yes
      Could any of the filenames have more than one '.' period (any besides the .mp3)? - No
      Could any of the filenames have more than one space before or after the '-' dash? - Yes
      Could any of the filenames have no space before or after the dash? - Yes

      Although the answer to most of these is yes, I understand the complexity of the Batch file if you were to consider these. This would not really be important as it would just be the odd file out of 6,000 FILES, I could MANUALLY sort these its just the majority.

      Cheers,

      Darren
      6448.

      Solve : can we find a file inside one directory and copy??

      Answer»

      can we FIND a file inside one directory which contains many FILES and COPY the file into another file?

      i'm running Windows 98 (4.10.2222)...

      thanks in advanceset source=Name and place of the file you search
      set TARGET=target folder

      for %%a in (dir /b %source%) do xcopy %%a %target%

      hope it helps
      uli
      it's working MAN...

      thanks..

      6449.

      Solve : Encrypting files?

      Answer»

      I was tring to ENCRYPT some FILES on my computer through DOS using the cipher command and when I did it it showed all the files it was tring to encrypt but as it was doing it all the files said ACCESS denied. Can someone tell me how to fix this?And your OPERATING system is :-? Which program created the files and what are their attributes :-?

      Windows XP.
      Just some powerpoint files, and a cupple word files....
      That good?Attributes are sett as what?

      6450.

      Solve : significance??

      Answer»

      Why can't some people write significant subjects?

      It is timewasting to check all postings if you know something to this problem or not.

      I have a question
      Please help
      problem...

      Is it so complicated?
      Sorry but it bores me.

      uliapparently, they have forgotten to read the "Please read me first" threadThanks. I am particularly fond of that ONE. It seems that titles like "a simple question" or "dos (win98)" or "BATCH files in XP?" attract a far over average number of readers.

      If some inexperienced wants to reach many readers then it seems tempting to formulate an ambiguous title.
      Of course I agree that it's a waist of time, but teaching the new users appears to be a lost battle.

      I suggest that a Forum Moderator should be allowed to change a title as they know best how to categorize the content. Up front it's sometimes hard to know what a topic develops into. Updating the title in order to provide a good summary of the real content as it develops may be useful.

      On my wish list is an indicator that shows whether a topic has been satisfyingly answered.
      uli_glueck.....

      Good idea ...... Now if we COULD get the people whose issues are resolved to let us know ...it would be very EASY for any of the mods to add a final entry ....for example ....... Issue resolved , topic closed and then lock it .

      Thats easy to do .

      dl65 Quote

      I suggest that a Forum Moderator should be allowed to change a title as they know best how to categorize the content. Up front it's sometimes hard to know what a topic develops into. Updating the title in order to provide a good summary of the real content as it develops may be useful.

      There would be too many titled "Worthless Drivel" or "I Shouldn't Be Allowed To Use A Computer" or "Darwin Was Wrong".
      is there anywhere in the forum (maybe i have missed it) that there is a collection of the commonly asked questions and their solutions, eg how to create timers where you could use ping,sleep, etc , or how to copy files with time/date requirements...etc? something like a DOS faq??
      It might be good to have one if not, so that forummers with such problems can go there to look first before asking for help...and it saves time from answering to the same type of questions again and again...
      just a thought The FAQ SOLUTION Database has a LOT of pertinent info. It is the last section on the main forum page.

      I wish people would start there as I frequently have to refer them to existing info, rather than making my fingers bloody reinventing the wheel. Oh, no! My DOS FAQ thread got bumped into the invisible zone! Save them Dilbert. Lock them up on your hard drive!!!It gets better: One or more of the threads in the "invisible zone" have been hit with the Ex Member bug that were in My Favorites. The only way to get my Favorites to work is to delete the offending thread. Unfortunately, I can't see the *censored* thread to remove it. All the ones I've seen are fine (except QA0035... AGAIN...)