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.

1601.

Solve : flashing text at command prompt?

Answer»

When using Windows XP (not when I use 98SE or ME), the text on the screen will FLASH when I am using the command prompt. It FLASHES about 2 - 3 times a second.

It does not flash when I first call the command prompt
What makes it flash ?
If at a 'normal' prompt I use
      A The edit Command
      B call or execute a  batch file
      C Execute a QBASIC program
 when the program returns to the prompt after program execution in A B or C –
        all text on the screen is flashing
If I execute a command such as ‘dir’ during the flashing
      All text flashes
By ‘exit’ and returning to windows then accessing the command prompt again
      All is well until
      A  B  or C  above

Can you help ?
Thanks
[email protected]
Do you have anything suspicious in your Startup folder?

Has this always happened, if not what changed immediately before it started to happen?

Malware scan?

djplasticusa,

When an old dos style *.com is executing then the command window will switch back to 80x25 characters and the scroll-bars will disappear which makes the window flicker.
Same would happen when you START a batch file that is then starting an old style *.com.

Could this be the reason? :-/
The answer to my question – why the screen blinks after executing an MS DOS program  -

Windows XP does not 'like' the full screen mode when ‘doing’ MS DOS or QBASIC – Why – I don’t know

Solution - In any event – by   alt+Enter if blinking should occur – the full screen becomes a window and the blinking goes away – BINGO

DJC

1602.

Solve : DOS encryption batch HELP PLZ! :-??

Answer»

Hi, i'm wondering how i can pause my batch job to add a folder path for this COMMAND

Code: [Select]cacls "%userprofile%\desktop\test" /d

administrators
i want to be able to make a batch file that will ask me which folder path i would like to ENCRYPT. Can you help me?

 :-?Look at the /P option of SET
GrahamYes, with set /p.

Something like this:
Code: [Select]echo off
setlocal
set /p folder=Enter the directory name:
cacls "%folder%" /d administratorsthx guys, i'll try that when i get home. Any other ideas? i've found this method of encryption especcially useful on XP home as it doesn't have the "use simple file sharing" BOX in folder options. Good for hiding stuff i dont want boss/parents to see Quote

Yes, with set /p.

I have WindowsNT. Neither CMD nor COMMAND has a parameter "/p".

It doesn't cause any error, but is simply ignored.

It doesn't pause for user input.

If I run this BAT file: z.bat

echo off
set folder=testit
setlocal
set /p folder=Enter the directory name:
echo The folder is "%folder%"

then I get this result:

C:\use\qbasic>z
The folder is "testit"
C:\use\qbasic>

Mac


Sorry ... I don't have Windows NT to go back and test, but I believe you.  I know that set /p is supported in Windows 2000, XP and 2003.Ok i dont know if that works coz my internet at home has messed up, need to reconfigure router. Metronet bein annoyin. I'll try it when I get home and post my results. I'm hoping it all works but if it doesn't i'll post errors. THX for the help guy.ya thx guys, thts working fine. is there anyway i could get it to browse in DOS for the directory.

thxYou wouldn't be able to browse interactively to select a directory (WITHOUT an external program) if that is what you are asking.  You could list the directories and  then prompt to enter one with something like this:

Code: [Select]echo off
setlocal
echo Directories in the root of C:
dir C:\ /b
set /p folder=Enter the directory name:
cacls "%folder%" /d administrators
1603.

Solve : Test a Folder not file?

Answer»

Hi

I Need test a Folders, for install a Software. in a batch file

I need compare in Windows, the languaje Spanish or English

Spanish your folder is c:\Archivos de programa\Program_Software
English your folder is  c:\PROGRAM files\Program_Software

In Windows, If I Write Star => Run => %ProgramFiles%,  Windows redirect Whith compare Idioms. and Windows DISPLAY Program Files, but in DOS is wrong directory o not found
in dos is c:\Archiv~1 or c:\progra~1

I have been doing is

If exist c:\archiv~1 goto
Install  Software in
c:\archiv~1\  (c:\Archivos de Programa\)
Program Software.
~
~
~
Else
Install Software in
c:\Progra~1 (c:\Program files)
~
~
~
end

here is the trouble, in dos unkonown the command ELSE and END :-?

 

HELP PLease


 If exist c:\archiv~1 (Install  whatever
         ) else (
                   do something else
)

should work at cmd
hope it helps
uliYou can have multiple lines in your if between the ().  One important thing to remember is that the ELSE has to be on the same line is the PREVIOUS close parenthesis.

So, to expand on the reply by uli_glueck:
CODE: [Select]If exist c:\archiv~1 (
   c:\archiv~1\setup.exe /params
   c:\cleanup.bat
   c:\whatever
) else (
   echo C:\Archivos de Programa does not exist
   echo No need to install software
)
ok, Works !

Yeaahh !!!


I Write the Incorrect paramets  

Thanks

Very Thanks!

1604.

Solve : Loop counter - of sorts...?

Answer»

Once upon a time I knew how to do this...  hope someone here still remembers.

In a batch loop, put a period on the screen and add another after it on the same line every time a loop is executed.  (good for letting people know the *censored* thing is still running...)

I'm USING 98SE DOS - ver 4.1

... my failing memory!   :-/I don't think there is a way to do that ... at least with the native Win98SE commands.  The only native commands that I can think of that will write characters to the screen all force a CRLF at the end of the output, which would prevent the characters from going across the screen.

As I was typing I came up with a couple of ideas, but I doubt they will work.  Let me try a few things, and I'll post back if I come up with anything.I couldn't come up with anything easy, especially in Win98 DOS prompt.  How are you executing your loops (what is the code)?  Maybe I can still come up with something that will work once I see what you are doing.Tx Gary...

I gave it up - had to move on.  I just put an echo statement in prompting the user
to wait until the window closed.  I could write a BASIC program and get the job done,
but I won't do that unless I have trouble with the office help...

 You could have put this in the loop:
cls
print time /t

That would give the user a warm and fuzzy.

Mac
SatTracker,

Instead of putting dots on the screen you can change the window title with the TITLE command.

It has the advantage that even if the window is minimized, the user could still see the title changing in the task bar.  That way you can output the percentage of progress or just a rotating string.

I.e.:
[edit]echo off
set rotate=Running---
for /l %%a in (1,1,100) do (
    call:bannerRotate rotate
    call TITLE Application is %%rotate%%
)
TITLE Application finished
pause
goto:eof


:bannerRotate varref -- rotates TEXT in varref ONE STEP and updates title
... here goes the rotate function from http://www.dostips.com/DtCodeCmdLib.php#bannerRotate
EXIT /b %ERRORLEVEL%[/edit]

Within the loop the window title will change:

Application is Running---
Application is unning---R
Application is nning---Ru
Application is ning---Run
Application is ing---Runn
Application is g---Runnin
Application is ---Running
Application is --Running-
Application is -Running--
Application is Running---

Try it out, it's fun  If I run
echo.off
it prints the word "off"
I have to use
echo off

DosItHelp: SatTracksr states that he is using the DOS that comes with Win98 SE, which I don't think supports some of the commands in your code.

1605.

Solve : CF card with DOS?

Answer»

We have a piece of equipment at work that has a Sharp 486 laptop in a docking station.  This is the only computer that will work on the machine.  The equipment still works fine, we have 3 more of these laptops in case it dies.  The SOFTWARE for the machine is DOS based.  We keep using this because a new machine with windows cost about 20,000.00 and this still does a good job.  
 
The problem is the data on this machine backs up to a FD.  We can put about 10 files on a disk and have close to 4000 files backed up.  I would like to but a CF CARD adapter in it.  This would allow me to transfer over the disk to the CF card and use the CF card in the future for the back ups.  I have a SanDisk CF PC card adapter at home.

How would I set this up so DOS would use this as a drive in my program when I back up files.  Where would I find a DOS driver that I can put on an FD to load.  

Any help would be greatly apprecitated.  I am tired of all the floppies in the desk.  

BobYou might be able to get a driver CF from Sandisk. Another alternative would be to get a zip drive. A parallel port zip 100 will work with a 486 and DOS 6.0 or higher.I tried the zip drive but it would not work.  Was told that since the laptop was in a docking station it some how screwed up the zip drives ability to work.  The program that runs the piece of equipment will not start up unless it is in the docking station and can read the equipment.   I could not find a driver on SanDisk.  I am more than willing to get one from another company if it would work better.

I presume you have two drives: A and C. You have two questions

1) How can I modify a system to backup to a drive other than A?

2) How can I establish another drive?

In other words you would like to purchase or connect some DEVICE and CALL it your E-drive.

You would then like to have your backups go to E rather than A.

Well, with regard to 1, I am surprised if you have a program that is HARD coded to use A. It may be you can find a BAT file with
Backup A
which you can change to
Backup E
(assuming you solved problem 2)

If it is hard coded, let me know and I will try to remember how I once dropped my A-drive and redefined some other device to be A.

Mac
I do not know if it is hard coded.  I just need to know how to make a cf card  a drive under CMOS.  I assume once this is done it will be useable under the program.   I have over 400 FDs to deal with and growing every week.  If you have an idea on how to do this I would like to hear it.  Hopefully this is a basic fix.  

thanksIt doesn't have much (if anything) to do with the CMOS.  Your main issue is that you need real-mode DOS drivers for your SanDisk CF PC-Card.  If you can't find drivers, then maybe drivers for a similar product will work (maybe Lexar or another company has a DOS driver for their CF card reader?).  Once you have the driver, you need the syntax to load it, which will probably be in the CONFIG.SYS file.  And you may need a PC Card Services driver from Sharp loaded before you can load your CF driver.

1606.

Solve : Having One Heck Of a time with a boot disk?

Answer»

Here are the steps I took and then will explain what I'm getting now.

I was wiping out a hard drive due to it being virus ridden and re-install Windows 98 on the SYSTEM and used a Win98 Boot Disk to do an FDisk.
That went fine. Rebooted system. Took forever to get back to a Command Prompt. Tried to do FDisk again to make sure that I did it properly but ever since all I get is this error "Incorrect MS-DOS version" I have tried other boot disks and keep getting the same error.  [smiley=thumbdown.gif]

I'm at my wits end   trying to figure out why or how to fix this problem. Currently the system will not read the CD-ROM. If I set the BIOS to read the CD-ROM 1st it goes directly and says "No Operating System Installed".

Any and all help would be greatly appreciated to fix this problem. Quote

I was wiping out a hard drive due to it being virus ridden
Your boot disk probably got infected.
Go to bootdisk.com and download a new w98 bootdisk. Write protect the disk before inserting into the screwed machine. Rerun fdisk, then run format/s. If you booted with cdrom support, insert the cd and continue with the installation.That's the problem.. I've tried several different Win98 Start up disks to do the fdisk and it won't let me and with the WIN98 boot disk that I got from bootdisk.com it says this program cannot be run in DOS mode.It sounds like the machine is still trying to boot into windows. Have you set the boot order in bios?Yes. I have the boot order as

1. floppy
2. cd rom
3. hard drive
4. network

but it's not currently nor will it be connected to a networkAre you sure the floppy drive is working properly? Have you tried booting directly from the cd?It's not recognizing the CD-ROM yet and I've replaced the floppy drive. I can see what is on the floppy disks with no problem but it won't do anything...Everytime I try to FDisk it says "Incorrect MS-DOS version".At the A:> prompt, type sys c:. This should copy the system files from the floppy to the HD. If successful, they should now both have the same DOS version. Try fdisk again. Be sure to set an active DOS partition.I tried that just now with the Win98 Boot Disk and I get "Bad command or FILE name". I tried it with the start up disk and got the same thing.  
Dang!

Anyway, you problem know this but "Incorrect MS-DOS version" means the fdisk you are trying to run is not the same as is supposed to be run given the version of DOS you are on.

If you boot from floppy and fdisk does not work, your floppy has the WRONG version of fdisk. You have to get a boot floppy from a better source.

If you boot from floppy and it works fine and you do whatever and then remove the floppy and boot Windows, you will not be able to use fdisk from your floppy. Windows DOS is not the same as floppy DOS. If your Windows DOS does not have the command fdisk, you are out of luck. Maybe it has been renamed or some other program does that FUNCTION. In general, I doubt Windows DOS will allow an fdisk type operation. You need to get out of DOS and use Windows utilities.

Mac
When you booted it should have loaded a ram disk and shown the letter for it. See if sys.com is loaded to the ram disk. If so, run the command from there instead of a:>.I Thank everyone for all of your help. I have no windows operating system on it now. It allowed me to do fdisk once and then from then on nothing. not able to do anything but read the floppy disks and not all the programs will work in dos either and I'm totally unable to copy them to the hard drive to do it from there either as well as no cd rom support. I don't know what more to do, I'm totally at a loss of trying to figure this out.  I've used a Win95 Start UP Disk and a Win98 Start Up Disk and neither one of them work and I've even gotten several VERSIONS of them from different locations as well and I'm still befuddled.

Anyway thank you all for your help. I'll try to figure something out.If the FDisk went properly you now have to format it before Win will recognise it.
Re-boot to the floppy and type format C: /u and hit Enter. Quote
I Thank everyone for all of your help. I have no windows operating system on it now. It allowed me to do fdisk once and then from then on nothing. not able to do anything but read the floppy disks and not all the programs will work in dos either and I'm totally unable to copy them to the hard drive to do it from there either as well as no cd rom support. I don't know what more to do, I'm totally at a loss of trying to figure this out.  I've used a Win95 Start UP Disk and a Win98 Start Up Disk and neither one of them work and I've [highlight]even gotten several versions of them from different locations as well[/highlight] and I'm still befuddled.

I suspect we have made this a LOT more difficult than it needs to be.

1) Boot with the boot disk. Use FDISK to remove all of the partition(s), then remake partiition(s). To simplify things just have one primary partition. When asked about large drive support choose yes.

2) Reboot and type in fdisk/mbr from the A:> prompt and press enter.

3) Then type in format c:/u/s and press enter.

If you are doing ANYTHING else, you are doing it wrong. If you have no hardware problems, this fixes it. Period.  

I would love to FDisk the system again but you see that is the problem, it is not allowing me to FDisk. It's not allowing me to boot from a boot disk. I've already removed the original operating system and now I'm unable to do anything. This normally isn't that difficult for me to do but for some reason this is not allowing me to do anything. I can't fdisk, I can't format, i can't copy absolutely nothing... I have trouble getting to the A:\ prompt but I can get there. The floppy drive is brand new and works fine. I'm able to see all of the information on each and every disk. It isn't recongnizing the C:\ drive. I can get to a C:\ prompt on it but if I do a dir to see what is on it... it says disk error.
1607.

Solve : Send Mail with attachement?

Answer»

Hello,

I would like to know how to send emails with an attachement, the only problem is that I need to FIRST zip the file and add a password then send the zip files one by one to a same email ADRESS, all the files (non zipped) are in the folder c:\send

Thanks

Almn

P.S: It doesn't need to be in DOS but I think that there is a way to do this in DOS.

Just a question: Why don't you zip the entire folder c:\mail and send that one zip file. The receiver can unzip and have all your files.

Mac
Isn't there a limit in size of what you can zip ?
Well anyways, the sender prefers many smaller emails  
Which can be understood  

Thanks

Almn Quote

Isn't there a limit in size of what you can zip ?
Well anyways, the sender prefers many smaller emails  
Which can be understood  

Thanks

Almn

No max I know about. TRY zipping the folder to see EXACTLY how big it is after zip.

If some reasonable size, UPLOAD to some temporary site and send your buddy the URL.

I agree with him. I hate to get HUGE emails. They lock up the mail for ages in dialup. However I can cope with a URL that I can launch after I finish everything else and want to go to lunch.

Mac
which temporary site ??

Thanks

AlmnTry dropload.com

 

Mac
1608.

Solve : How to create a txt file from a BATCH FILE?

Answer»

Hi All

I need a batch to create a .txt file daily. I tried COPY CON abc.txt, but prompt keeps waiting to write & exit mannually. I want that abc.txt should be create & saved automaticly. thanks!

Regards
AadiCan you please be more specific as to what exactly you're trying to do?You can do something like this:
Code: [Select]echo This is some sample TEXT>abc.txtThere needs to be a space before and after the >.

Also, it's better to use >> than >, because > erases the file and re-generates a new one with the same name and only that line's CONTENT. >> appends the file. Quote

There needs to be a space before and after the >.

Here is a session on WindowsNT
Code: [Select]Microsoft(R) Windows NT(TM)
(C) Copyright 1985-1996 Microsoft Corp.

C:\use\qbasic>echo abc > z.txt

C:\use\qbasic>echo def>>z.txt

C:\use\qbasic>echo ghi >>z.txt

C:\use\qbasic>echo jkl>> z.txt

C:\use\qbasic>echo mno        >>      z.txt

C:\use\qbasic>

Here is the contents of z.txt after I substituted # for space:
abc#
def
ghi#
jkl
mno########

Mac

Oh... maybe not. But it's still easier to read IMO. Quote
maybe not

Maybe??

Anyway, the point to note is that any spaces before the redirection symbol will be written to the file.

"Maybe" this is not important. But it's nice to be aware of.

Mac



"Maybe" I can be wrong. Let's not turn this into a flame war.Sometimes there does need to be a space between the redirection symbol and the file, like if you are REDIRECTING a number, or the last part of the string is a number.  Even though the only streams defined are 1> (STDOUT) and 2> (STDERR), I BELIEVE the other NUMBERS are reserved.

For example, the following would probably not work:
echo 1 2 3>>z.txt
echo 4 5 6>> z.txt
echo The answer is 0>>z.txt
Agreed. Also if you only want to trap errors

copy a.dat b.dat 2>log.dat
will work

copy a.dat b.dat2>log.dat
won't.

Mac
1609.

Solve : echo odd characters?

Answer»

Hi all,

Is there a way to echo the following characters to a text file?

Ìý"

Standard echo Ìý">>txt.txt COMES up with a blank text.

TIAI think the problem is the quotation marks in the line.  There are a few ways around this.  I think this should work:
Code: [Select]>>txt.txt echo Ìý"That worked. Thank you! I wasn't aware the text target could be placed at the FRONT end.

I did TRY it normally without the quotes, and it still didn't echo, so I assume it is the characters themselves.

Out of CURIOSITY, what other methods did you have in mind?You could also use the DOS DEBUG command to specify the hex values of the characters and save it to a file called txt.txt

1610.

Solve : Get selected text from a file?

Answer»

I would like to get a specific line into a text file to USE it like a configuration file, but how do i get these chars and i save them in a var?  I want something like that, it's a ini file, but it could be a txt file.  It could be the whole txt file, cause i've got only 1 stuff to save, like this :

Config.ini{

MyData

}

//My data is text that the user can modify using notapad or edit function, but i just would like to be able to load it and put it in a var such as %Data%.

//I know that my label names aren't clear, but they are using a easy hierarchy cause it's a menu system
like :
[a]
 [aa]
  [aaa]
  [aab]
 [ab]
 [ac]
  [aca]
  [acb]


MyBat.bat{
[...]
REM This is options menu...
:ab
cls
echo =====
echo Config menu
echo =====
echo.
1) Edit Config.ini
2) Replace Config.ini by default configuration
3) Back
choice /n/c:123 Selection?:
if errorlevel == 1 edit Config.ini
if errorlevel == 2 echo MyData>Config.ini
if errorlevel == 3 goto a
[...]
REM A function where i actually need to configuaration...
:ac
echo =====
echo Reinitialize
echo =====
echo.
echo 1) Reinitialize the selected drive
echo 2) Back
choice /n/c:12 Selection?:
if errorlevel == 1 format a: /v:%Data%/s
if errorlevel == 2 goto a
[...]
}

//I know that it's a unuseful thing, but i also want to make a larger configuration (If i could ... ).
As i said before, i would like to be able to have only 1 file for all config, but if i need to use 100 hundred files with one thing in each, i will do it.

Thank you for the one that will help me ...
Look at AviT's query below entitled "Copy a row from file to file"

It that's what you mean, you can see the only answers we know.

Mac
That's something like this, but could you explain your script...  If i've that much difficult, it's that i am more a DHTML, JS, HTML, CSS, PHP and high degree script used to work with.  Batch is so... Basic i have diffucult to work with command that aren't flexibles like c++ cause i worked on c++ before now i am c# but it was more powerful now, i would just know Qbasic is included directly in the MS-DOS shell, or it is a external application, cause i'm doing a "program" that will work on a low resources computer such as Win 98 and maybe at the boot setup...  I have the room of a disket.  1.44 Mo and almost all is used for MS-DOS, so if it's not included or compatible with Win98.

The fact, is i need to store the value in a var instead of appending it to another text file, append i know how to do is just to read a specific line and to store it in a var to be used.

config.bas
{
Config.bas
CONST File1 = "z1.txt"' This is the file w/many lines
CONST File2 = "z2.txt"' This is the file you want to add one to.
OPEN File1 FOR INPUT AS #1
LINE INPUT #1, l$
CLOSE
OPEN File2 FOR APPEND AS #2
PRINT #2, l$
CLOSE
SYSTEM
}


//This code is COPYING a line from file 1 that is stored in l$ and pasted into file 2, right?  So could i get the %l and use it with ms-dos, or do something like in php:
(Attachment)

I hope you can understand

Thank you so much or help!Try this and tell me what happens - at the DOS prompt, enter "QBasic"

You should see a Welcome-to-QBasic message.
Ignore the stupid, useless "Survival Guide". Instead, press ESC

You should see a blank blue SCREEN. You can learn instructions by using HELP/Index

Anyway, at the blank screen, enter
PRINT "Hello" and click on Run/Start.

You did it! You just wrote and tested your first QBasic program.

Now after PRINT "Hello", enter SYSTEM. Your program:

PRINT "Hello"
SYSTEM

You could run it again, but it would just do the same thing. SYSTEM doesn't do anything except flag the end of your program, which is useful in batch applications.

Now do File/Save
In the File Name box, enter a name for your program, such as "MyFirst"
Now do File/Exit

OK, last test. At the DOS prompt, enter
QBasic /run MyFirst

Did it print "Hello" as expected?

MacAyay, yo tengo un problema!

Is QBasic available on a Win9x?  Because, in the DOS windows, i do this:

C:\WINDOWS>QBasic //I press enter
Commande ou non de fichier incorrect //That means something like this : Command or file name (incorrect or unknown)

So is it because Win98 se doesn't contain QBasic, or it's cause i misspelled it?
If it's not included, could you give me the files for it in a zip...  Because i would like to get them...  Elsewhere i will need to download a c++ compiler because i lost my hard drive.Go to the QBasic Forum Community home page
http://www.network54.com/Index/10167

Click on "Links and Downloads"

Click on QBasic 1.0

There is a nice QBasic How-To on that page, too.

Mac
Ok, i will download it (i just don't do it now cause i'm making à c# application for someone) but, you still hasn't explained your script...  I need to FINISH my c# application during this week-end so... i would like you to explain me or do the QBasic script for me please.  Thank you very much i would be losing time in a c++ application without you! Quote

Ayay, yo tengo un problema!

Is QBasic available on a Win9x?  Because, in the DOS windows, i do this:

C:\WINDOWS>QBasic //I press enter
Commande ou non de fichier incorrect //That means something like this : Command or file name (incorrect or unknown)

So is it because Win98 se doesn't contain QBasic, or it's cause i misspelled it?
If it's not included, could you give me the files for it in a zip...  Because i would like to get them...  Elsewhere i will need to download a c++ compiler because i lost my hard drive.

Qbasic can be found in Win95 at \OTHER\OLDMSDOS and for Win98 at \TOOLS\OLDMSDOS
For later versions of Windows, you can use vbscript/wsh ....
sorry i don't understand what u r trying to do, so couldn't help much.



Okay, okay, but where does i find Quote
Qbasic can be found in Win95 at \OTHER\OLDMSDOS and for Win98 at \TOOLS\OLDMSDOS
 because when i type QBasic at DOS prompt, it just says that it's an unknown command... Quote
Okay, okay, but where does i find Quote
Qbasic can be found in Win95 at \OTHER\OLDMSDOS and for Win98 at \TOOLS\OLDMSDOS
 because when i type QBasic at DOS prompt, it just says that it's an unknown command...
Its from the CD..Okay!!! Thank you, i'm gonna look...Your stuffs aren't doing exactly what i wish (in qbasic) cause i want to get the data with ms-dos, not append in a log i can do it in dos!!!
1611.

Solve : send email??

Answer»

When I create batch file and he create new file ">file.txt" can auto this file file.txt send his contents  to my email and how?

I don't have very good English, sorry for mistakes  
? Quote

?

I presume that means you wonder why nobody has responded.

The reason is that nobody know how to do that. In fact, I believe there is no way, using just DOS.

Well, no way if you are using Outlook Express. Maybe if you are using some other way to send MAIL, that program has a way to accept mail parameters such as To/Title/Text/Attachments.

Good luck. Just check every day or two. If nobody ever tells you how, it is because nobody knows. It is not because we overlooked your question. It has been seen. No need to respond "?" again.

Mac

There is a free program called BLAT that I have USED for this task.  You can also USE Windows CDO to send an email from a command prompt (using cscript).

So I would suggest looking at BLAT, or if you want something using only native Windows commands, then post back and I can give you a sample SCRIPT using CDO and SCSRIPT BUILT into Windows.
1612.

Solve : Find Next?

Answer»

Hello,

I would like look for  string in all the files on my computer. So I came up with the FOLLOWING sequence or order of how the batch should work but I don't know how to write the code.

find FIRST file
set "path\name of the file" as variable
look for string
go on with the next file

Also if possible I would like to exclude all the files with the extension *.TMP

Thanks

Almn

do this : findstr /?

Yes I have tried that but it seems that its only  to look for the screen . I just would like the command line that sets the first file in the computer as a vairable,for example "file".

Thanks Anyways

AlmnSorry, al968. It is impossible to figure out what you want to accomplish.

find first file
set "path\name of the file" as variable
look for string
go on with the next file

What do you mean "as variable". As what variable? Should variable names be generated?

"find first file" Do you mean find the first file that contains the string or the first file on your HARD drive.

Never mind how to solve the problem. Let us know what you want as an end result when the search is complete.

======Example

I would like a BAT file that will produce a text file containing the path/filename of all files on my computer containing a given string.

If I run MyBAT "apple banana" myfile.txt

Then at the end of the run, myfile.txt will contain
c:\abc\def.doc
c:\ghi\jkl\mno.txt
....

where those files contain the exact text "apple banana"

=========

Is that what you want, or what?

Mac
First of All thank You for your answer  
By first file I mean First file on the hard drive.
What I would like to do is for every file on the computer to be set as a variable then to check if the string is present in that file, and if it is echo the neame of the file otherwise repeat the first steps with the next file.

Thanks

Almn
Quote

Yes I have tried that but it seems that its only  to look for the screen . I just would like the command line that sets the first file in the computer as a vairable,for example "file".

Thanks Anyways

Almn
you can follow the examples here http://www.ss64.com/nt/findstr.htmlHere is a simple solution for a case insensitive search from the current directory that does not SKIP the .tmp files:
Code: [Select]echo off
set /p string=Please enter string to search:
findstr /s /m /i /c:"%string%" * 2>NUL
If you want to skip .tmp files, you COULD use a FOR loop with /R.  This should be enough to get started.
1613.

Solve : verify file lenght into batch file?

Answer»

i NEED to verify if one FILE have dimension of 3056 byte before PROCESS it

if dimensio of file are different i need to stop process

thanks

ps. it's my first post so ... Hi All  in your batch, something like

if %~z1==3056 GoTo OK
Echo Error
GoTo :EOF
:OK
:: continue

%1 is the first param supplied to the batch and the ~z modifier returns the filesize in bytes

Grahamfor /F %%A in ("tps.bi_") do If %%~z1==3056 GoTo OK
Echo Error File Dimension
exit

:OK
...
...

file name are tps.bi_

this not work or i MAKE some wrong
for /F %%A in ("tps.bi_") do If %%~zA==3056 GoTo OK
Echo Error File Dimension
exit
 
K
...
...

this should work -- but why use a loop if there is only a single file ?
GrahamIf file.bin %~z1==3056 GoTo OK

echo Error File Dimension

goto warn

:OK
...
...

it's not work (i have try loop from one example)it's OK:

Quote

for /F %%A in ("tps.bi_") do If %%~zA==3056 GoTo OK

cls
color 0c
echo.
echo Error File LENGHT NOT 3056 byte
echo.
echo Errore Dimensione File diversa da 3056 byte
echo.
echo.
echo.
echo correct file size of tps.bi_
echo.
echo.
echo.
echo.
echo.
echo.
pause
exit

:OK
If tps.bi_ %%~zA==3056 GoTo OK


it's ok olso ...

i make some mistake  :-/

thanks
1614.

Solve : Batch File for Mass Network Software Deployment?

Answer»

I need to create a batch file to run only once a COMPUTER joins a network domain. I need the batch file to install a program; let's call the program software.exe . This software will be on a shared folder on a server on the domain; let's say the network share is \\network server\shared folder\software folder\software.exe
I need this batch file to run once as soon as any computer joins the domain. It is my idea of mass network deployment of a software on a domain since the manufacturer has not BUILT this feature into the application. I LOOK forward to a great solution soon.
Thanx.How about calling this from your login.bat file:

CODE: [Select]echo off
if exist "C:\Documents and Settins\SoftwareInstalled.txt" goto :EOF
"\\network server\shared folder\software folder\software.exe"
echo \\network server\shared folder\software folder\software.exe has been installed >"C:\Documents and Settins\SoftwareInstalled.txt"
It will check for the SoftwareInstalled.txt file, and if it does not exist, then install the software and create the SoftwareInstalled file.  If it does exist, then the software must already be installed, so quit.

It seems like the "right" way to do this is make software.exe a required software in your domain OU ... but this should work for what you asked.You'll want to check whether the particular installation program allows for unattended installation.  You've probably thought of that...

1615.

Solve : What Comes Up When Run Is Typed. .Exe or .Com. Why?

Answer»

Hi. Just improving my somewhat limited knowledge. What Comes Up When Run Is Typed at the DOS prompt. Run.Exe or Run.Com.  And why. Appreciate an answer as I am undertaking a course to IMPROVE my cyber IQ.

Fanks

Zipcool To make sure I understand, you are asking which file would be run if you type RUN and you have both a RUN.EXE and a RUN.COM file in the same directory?

If that is the question, then the answer depends on your version of Windows (or DOS).  For Windows XP / 2003, the .EXE file would take precedence.  For real-mode DOS or Win 9x, and I think 2000, the .COM file would take precedence.Thanks for replying Gary. I'm not assuming there is either a RUN.EXE and a RUN.COM file in the same directory?

I just wanted to know which file would run if I type Run at the DOS command prompt. Would it be the run.exe or run.com?

For real-mode DOS or Win 9x, and I think 2000, the .COM file would take precedence. Why?

Fanks :-?

ZipcoolSo you are asking which types of files can be run?  That also depends on the operating system.  With Windows XP, the default file types that can be run without specifying the extension would be .COM, .EXE, .BAT, .CMD, .VBS, .VBE, .JS, .JSE, .WSF, .WSH. So you could have any of the following:
RUN.COM
RUN.EXE
RUN.BAT
RUN.CMD
RUN.VBS
RUN.VBE
RUN.JS
RUN.JSE
RUN.WSF
RUN.WSH

You can look at your PATHEXT ENVIRONMENT VARIABLE to verify this on your system.
Code: [Select]echo %pathext% Quote

For real-mode DOS or Win 9x, and I think 2000, the .COM file would take precedence. Why?

Oh, and to answer your other question about precedence ... I think the answer is just because that Bill Gates (Microsoft) decided it should be that way.

http://support.microsoft.com/kb/35284 Quote
What Comes Up When Run Is Typed. .Exe or .Com. Why
Zipcool

As pointed out, the order of precidence is established by
Code: [Select]echo %pathext%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

Why did they choose this particular order rather than another? I don't know if they documented that debate.

I do know that some programs, like BASICA had both a COM and EXE. If you typed BASICA, the COM would get control and then call the EXE. If you removed the COM, then the EXE worked fine anyway. I never understood what the DEAL was.

But the point is that EXE files tend never to call COM because anything you could do in a COM could easily be added to the EXE. But not vv.

Mac

Thankyou both. . com it is. It was a question in an IT test that I had to send in to be marked.

Fanks.

Zipcool
1616.

Solve : batch file beginner..please help?

Answer»

Hi, I have to create a batch FILE that does several things:

run an visual studio 2005 application (.sln)
the application itself takes 3 parameter

i. the folder where the input files are (C:\Development\DSGI\X3)
ii. the extension of the input files (csv)
iii. the extension for the output files (txt)

After RUNNING the app, the batch file has to copy all the output files to
C:\Development\DSGI\X3\Out
This folder is already there.
and deleting the output files from
C:\Development\DSGI\X3

I havnt got clue how to do this...any IDEAS....thanks in advancewhat have you done so FAR?You should first ENSURE that there are no TXT files that you want to remain in the source directory. Then run the application. Then simply do

move C:\Development\DSGI\X3\*.txt C:\Development\DSGI\X3\Out\

Mac
well I havnt got a clue, but this is what I've come up with:

start X3.sln %C:\Development\DSGI\X3 %csv %txt
move C:\Development\DSGI\X3\*.txt C:\Development\DSGI\X3\Out\
Delete C:\Development\DSG1\X3\*.txt

would this work? please advive any modifications



1617.

Solve : Batch file error message/user inputs?

Answer»

The batch file below receives a file which is type at DOS prompt, e.g.,  example.bat  .
What I would like to do is to print out an error message on the screen e.g., MUST ENTER NAME OF FILE.  Then I would send the user back to the beginning if the user FORGETS to enter file name.

dir ..\test\%1.cob
dir ..\copy\%1.cob
choice /c:yn continue
if errorlevel = 2 goto :finish
if errorlevel = 1 goto :continue
:continue
echo on
copy \test\%1.cob \copy\test /y
:finish

Tnks in anticipationWhen is this due to be handed in ?

It sounds like homework to me .... if not, this page has your answer
http://www.csulb.edu/~murdock/if.html

GrahamIf the batch file requires a file name as a parameter, and the user doesn't specify the parameter, then the only way have them go back and provide the parameter is to have them re-run the batch file.  Depending on the command processor, you COULD prompt for the parameter, also.

I think you want something like this:
Code: [Select]echo off
if not {%1}=={} goto arg1OK
echo MUST ENTER NAME OF FILE
goto :finish
:arg1OK
dir ..\test\%1.cob
dir ..\copy\%1.cob
choice /c:yn continue
if errorlevel = 2 goto :finish
if errorlevel = 1 goto :continue
:continue
echo on
copy \test\%1.cob \copy\test /y
:finish
Or to prompt (in command prompt under Windows 2000 / XP / 2003):
Code: [Select]echo off
if {%1}=={} (SET /p FILENAME=Please enter name of file:
) else set filename=%1
dir ..\test\%filename%.cob
dir ..\copy\%filename%.cob
choice /c:yn continue
if errorlevel = 2 goto :finish
if errorlevel = 1 goto :continue
:continue
echo on
copy \test\%filename%.cob \copy\test /y
:finish Thank you... I used your first example and it worked.    

1618.

Solve : DIR compression?

Answer»

I have written a batch script to backup my usb drive and i am now wanting to know if there is a way that i can get it to compress that backup folder throught the command line.
This is the backup part of the script

Code: [Select]ECHO.
echo ---------------------------------
echo Removable Device Automatic Backup
echo ---------------------------------
echo Backing Up Data
DATE /t>>backup_log.txt
time /t>>backup_log.txt
xcopy "*" "c:\removablebackup\" /e /y /r /h /c
echo End Back Up>>backup_log.txt
echo ------------------------------------------------------>>backup_log.txt
move "backup_log.txt" "log files/"
echo Backup Complete!
pause
exit
Can ANYONE help.

Thank you for your help!!You want to compress as in the Windows NTFS compression?  Or something LIKE ZIP compression?  ASSUMING you want NTFS compression, you could do something like:

ECHO.
echo ---------------------------------
echo Removable Device Automatic Backup
echo ---------------------------------
echo Backing Up Data
echo Backing Up Data on %date% at %time% >>backup_log.txt
xcopy "*" "c:\removablebackup\" /e /y /r /h /c
echo Backup Complete, now compressing
compact /c /s:"c:\removablebackup\"
echo End Back Up at %time%>>backup_log.txt
echo ------------------------------------------------------>>backup_log.txt
move "backup_log.txt" "log files/"
pausesomething like a Zip compression would suit better for what i am wanting to do.Then that will depend on the program you use to zip up your backup.  In fact if that is what you want to do, then it MAKES more sense to skip the copy, and just go straight to the compression.  Assuming you are using the registered version of WinZip (with the command line extensions) you can do something like:

Code: [Select]ECHO.
echo ---------------------------------
echo Removable Device Automatic Backup
echo ---------------------------------
echo Backing Up Data
echo Backing Up Data on %date% at %time% >>backup_log.txt
wzzip -rp c:\removablebackup\backup.zip *
echo End Back Up at %time%>>backup_log.txt
echo ------------------------------------------------------>>backup_log.txt
move "backup_log.txt" "log files/"
pause
The 1 line that does the backup is the:
wzzip -rp c:\removablebackup\backup.zip *

That line can be replaced with whatever program you want to use for your compression.  If you use TAR, it would be
tar -czvpf c:\removablebackup\backup.tgz *

There are dozens of other programs to do the compression, but the syntax for each will be specific to that program.

1619.

Solve : how to capture the echo display and put it in file?

Answer» HI..
im tryin to capture the echo display file like .. "The comman completed succesfully", etc.
and put in the text. using the  ">" operator. i want to create a log file. this will enable me
to check if there is an failed or succes on my list of command... can anybody help me.

thanks.. and more power.You want something such as :

echo Commands succesful>Myfile.txt

If it's that... you can also do something like this :

%Directory%="C:\MyFolder\Myfile.txt"
echo text...>%Directory%

Or you can just don't use a var... Quote
hi..
I'm trying to capture the echo display file like .. "The comman completed succesfully", etc.
and put in the text. using the  ">" operator.

Uh, what is the PROBLEM?

Have you tried this and it failed? Only thing I can think of is that your problem is that you keep getting a one-line log. To overcome that, use ">>" instead of ">".

Mac

Quote
hi..
im tryin to capture the echo display file like .. "The comman completed succesfully", etc.
and put in the text. using the  ">" operator. i want to create a log file. this will enable me
to check if there is an failed or succes on my list of command... can anybody help me.

thanks.. and more power.

actually i have no problem using that ">" and ">>" operator providing im going to
type the text...
i have a batch file and echo on on the top of it.. next of it was a series of command
like copy, net use.. etc.. after which each command it will echo WHETHER it is
successful or not. that what im trying to capture. and save it just like a log file.
thus it will enable me to check what happen to my command..

thanks.. again..You claim you know enough to code this
Code: [Select]echo off
echo Just some test data>zTest1.txt
REM That is just to have a demo file
date /t>>Log.txt
time /t>>Log.txt
copy zTest1.txt zTest2.txt>>Log.txt
copy zTest2.txt+zTest2.txt zTest1.txt>>Log.txt
type zTest1.txt
erase zTest*.txt>>Log.txt

Yet it is still something you don't want. Why??

I'm going to guess that you want the echoed commands to applear in the log. OK, code this
Code: [Select]echo on
echo Just some test data>zTest1.txt
REM That is just to have a demo file
date /t
time /t
copy zTest1.txt zTest2.txt
copy zTest2.txt+zTest2.txt zTest1.txt
type zTest1.txt
erase zTest*.tx

Here, commands without the will go into a log if you envoke the BAT file like this
z>Log.txt
(where z.bat is the file)

Or if you don't want to remember that and you don't want two files, use this

Code: [Select]echo on
echo Just some test data>zTest1.txt
REM That is just to have a demo file
if x%1==xDoLog goto OK
%0 DOLOG>Log.txt
:OK
date /t
time /t
copy zTest1.txt zTest2.txt
copy zTest2.txt+zTest2.txt zTest1.txt
type zTest1.txt
erase zTest*.txt

Mac
I should add that if you also want to trap error messages, add "2>&1". Here is an example with errors.

Mac

if not x%1==xDoLog %0 DoLog>Log.txt 2>&1
date /t
time /t
copy zTest1.txt zTest2.txt
erase zTest2.txt
Quote
I should add that if you also want to trap error messages, add "2>&1". Here is an example with errors.

Mac

if not x%1==xDoLog %0 DoLog>Log.txt 2>&1
date /t
time /t
copy zTest1.txt zTest2.txt
erase zTest2.txt


mac
thank you very much to your reply i really appreciate it.
i attached screen capture to show you what i really want
is it really possible..  thanks you again..
Quote
thank you very much to your reply i really appreciate it.
i attached screen capture to show you what i really want
is it really possible..  thanks you again..

just do this :

net use d: \\help\share >> test123.txt  2>&1
that was working perfectly thanks a lot....
1620.

Solve : Determine when file is added to folder...?

Answer»

Is there a way I can be alerted by the O/S as to when a NEW file is saved to a folder?  I GUESS I am looking for some sort of monitoring functionality.

Thanks! Quote

Is there a way I can be alerted by the O/S as to when a new file is saved to a folder?  I guess I am looking for some sort of monitoring functionality.

Thanks!

Assuming XP, very simple one.

Code: [Select]D:\test>DIR /A-D /B > file1.txt
D:\test>dir /A-D /B > file2.txt
D:\test>fc file1.txt file2.txt
Comparing FILES file1.txt and FILE2.TXT
***** file1.txt
***** FILE2.TXT
sdfsdfgsfds
sdfsdfdsf
*****

1621.

Solve : Create a batch job which launches winmsd?

Answer»

Hello,
Can someone please help me with the syntax on creating a batch job which launches "winmsd" and then exports the data to a text file in a specific location?  winmsd is a Windows utility which provides system information about your computer (HW, SW, components etc).

When launched from the command line a System Information screen opens up and from there you can select File...EXPORT... and save as a text file.  

Thanks in advance.


Check the ressourcekit for a equivalent commandline tool. I am sure there is one.

uliAre you referring to the Windows resourcekit?
If so this was of no use.
Any other suggestions. Quote

Hello,
batch job which launches "winmsd" and then exports the data to a text file in a specific location?
Well, that was interesting.

Nudged by your question, I ran
winmsg /?
and saw some options.

I tried
winmsd xxxxxxxxxxxxx /s /F

where xxxxxxxxxxxxx is the name of my computer.

I got a REPORT in xxxxxxxxxxxxx.txt

I guess that is what you want.

To put into c:\abc\def.txt, you could put this in your batch file

winmsd xxxxxxxxxxxxx /s /f
copy xxxxxxxxxxxxx.txt c:\abc\def.txt
erase xxxxxxxxxxxxx.txt

In other words, it doesn't appear that the name of the output file is a user-supplied parameter.

Mac
How did you get this to automatically save (or even open) as a text file?
When I run the exact same command:   winmsd xxxxxxxxxxxxx /s /f , it just opens up the System Information screen.  to get into text I still must select File...Export and then choose a destination.

Thanks
TrevorWhat version of Windows are you running?  In Windows XP, WINMSD has been replaced with MSINFO32.  So you can run:
Code: [Select]start msinfo32 /report C:\HardwareReport.txtOf course, you can REPLACE "C:\HardwareReport.txt" with the actual file you want the report in.  It may take a minute or 2 to create the report, so be patient waiting for the report file to show up
Thanks All for your help, I have this working now.

Trevor Quote
Thanks All for your help, I have this working now.

Trevor

WAIT! Wait! Come back!!

How did you get it working???

Mac

1622.

Solve : Batch File Using Computer Time Stamp?

Answer»

I have a BATCH file that runs a program and I need it to select the systems date, so I do not have to put the date in everytime.

I want it to look at the systems CLOCK and then run, it will be grabing data and placing the data in a log file but it needs to USE the CURRENT date.  So If I run it on 10-06-06 it will know the data it grabs is associated with that date.  Like wise if it is run on 10-07-06 then it will associate it with the 7TH and so on.

Thank you in advance.date /t >>log.txt

1623.

Solve : i need fast help?

Answer»

i have a LAN computers in my school and the computer class is boring so i WANTED to ask you
what FUNNY and fun stuff commands there are beside net stat and shutdown?
can i open hes explorer and stuff
what fun commands can u recommendShow me a scanned image of a report card showing at least 95% in all classes, proving that you can sfford to slack academically, and I'll SHOW you all sorts of fun commands. Not until then, though. ill show ya lol but tell me how couse i didnt really understand.. wow should i do it?You sound like the kind of prick who keeps everyone else from doing their work.

no.. i let evry ONE work.. i want that
1. for knolege
2. for the houres that they lett you "play" with the computer
3. to do that to my brother in LAN Sign on for grammar and spelling next semester...Put a boot disk in your computer and type

format c:/u/s

and press ENter. THat will CREATE a LOT of fun!

1624.

Solve : trace an IP address?

Answer»

hi ! all
           how to trace an IP address of the computer with location ,usuing an e-MAIL ID .can any one helpIf it is an email that you have received, expand the header and see where it originated from. Of course, if it was a SPAM zombie it won't held much.okay lemme TELL u the situation.....my yahoo mail id has been hacked....all my details have been changed ...is there any way i can retrive my mail id again( tried with custmer care many a time's but no USE).This is the "Microsoft DOS" forum. You might have better success on some other forum where people who don't know DOS but instead know other stuff hang out.

Mac

1625.

Solve : How to close Dos command window?

Answer»

Is there an easy way to close a Dos Command window from a batchfile?  I made some SMALL batch files to run mspaint.exe, notepad.exe, calc.exe, etc from the Windows Start-Run command LINE.  

EXAMPLE:

c:\winnt\system32\calc.exe

The problem is the Dos Command windows stays open.  I want it to close as soon as the executable launches.  Is there a way to close the Dos Command window and keep the executable running?start c:\winnt\system32\calc.exe
exit

 That doesn't work.  The window is still open.What OS are you running? I'm using Windows XP and it works great.

Here is an article from MS$ about that: http://support.microsoft.com/kb/126410/EN-US/

When you don't use 'start' the window won't close until it's finished.


RegardsSay your BAT file is DoStuff.bat
At the START/RUN line, you enter DoStuff
DoStuff.bat, as suggested, is this:
| start calc
| exit

But the DOS window stays open. (Amazing. Doesn't happen on WindowsNT)

I assume DoStuff.bat is in your path. In other words, it is in a DIRECTORY that is accessable via START/Run.

What does it say at the top of the DOS window? On my system, it says
| Microsoft(R) Windows NT(TM)
| (C) Copyright 1985-1996 Microsoft Corp.

Maybe we can find the PIF file that you are using. If so, we will go to Properties/Program and ensure the box "Close on Exit" is checked.

Mac
I'm using Windows 2000.  The top of the batch file says the batch file name.  There is no .pif file CREATED when I create the batch file.

I missed adding the "start" before hand, now it works.  Thanks.Timrod - good man! Properly closed this thread.

thalisien - LOL - I got credit for your START idea.

Mac

1626.

Solve : Stack an user entry into a var.?

Answer»

I would like to know how to stack a user entry into a var.  Something like a choice, but that you put the "answer" of the choice directly into a var instead of USING errorlevels, because i have something like 36 possibilities and that's a lot of if errorlevel == 1 ... .  Thank you very much for help.  Or, if you have a fastest way than errorlevel == ... It would be greatly appreciated.How about explaining your application. Perhaps by posting a BAT file with magical, imaginary commands that would meet your need.

Off hand, I can't think of any way to get variables into a BAT file after it has started.

Mac
Ok, my code is long and in french (Comments) , but it looks like thats :

[...]
echo 1) Cancel
echo NB : Enter the letter of the drive you want to see
choice /n/c:1abcdefghijklmnopqrstuvwxyz Letter?
 if errorlevel == 1 dir Z:\
 [...] (All errorlevel)
 if errorlevel == 27 goto ad
REM ad is the label of the menu just before this one ...
[...]

The fact is that i would like to get the answer of the choice or if you have a code to get an entry... in a var o i could write something like :
dir %Drive%:\
My code isn't that exactly but it's HARD to explain but the better example is that...
Thank you very much...OK, I think I understand. Try running the following and see if it works.

Mac

echo off
:GetIt
echo ..............
echo Enter the letter of the drive you want to see
echo (else enter "1" to cancel)
choice /n/c:1abcdefghijklmnopqrstuvwxyz Drive:
if errorlevel 1 set Drive=1
if errorlevel 2 set Drive=A
if errorlevel 3 set Drive=B
if errorlevel 4 set Drive=C
if errorlevel 5 set Drive=D
if errorlevel 6 set Drive=E
if errorlevel 7 set Drive=F
if errorlevel 8 set Drive=G
if errorlevel 9 set Drive=H
if errorlevel 10 set Drive=I
if errorlevel 11 set Drive=J
if errorlevel 12 set Drive=K
if errorlevel 13 set Drive=L
if errorlevel 14 set Drive=M
if errorlevel 15 set Drive=N
if errorlevel 16 set Drive=O
if errorlevel 17 set Drive=P
if errorlevel 18 set Drive=Q
if errorlevel 19 set Drive=R
if errorlevel 20 set Drive=S
if errorlevel 21 set Drive=T
if errorlevel 22 set Drive=U
if errorlevel 23 set Drive=V
if errorlevel 24 set Drive=W
if errorlevel 25 set Drive=X
if errorlevel 26 set Drive=Y
if errorlevel 27 set Drive=Z
if %Drive%==1 goto Adios
if not exist %Drive%:\*.* (
echo No such drive on this computer
goto GetIt
)
dir %Drive%:\
goto GetIt
:Adios
Ok, thank you for the code, it is a little bit looking like my old one, excetion that it's more optimized...
Oh, and the if not exists %Drive%:\*.* is a good idea...  Thanks another time.What is more correct in French,

"Vous êtes bienvenu"

"DE rien"

"service"

Mac
1. Most polite (Almost unused) : BIEN à vous
2. Polite : Vous êtes LE bienvenu
3. Normal (Mostly used) : De rien
4. Normal (Less used) : Ça n'est rien...

You can use all of these ones, but the 2 first are more appropriated with elderly people or with people that you doesn't wanna know personnaly (Or if you want to be very polite)
Elsewhere, you should use 2, 3 or 4 because they are more flexible so they are kind of "joker" because you are not too polite and not not enough...  They are other but less used or polite ...

1627.

Solve : Problem with pipes?

Answer»

Hello together

I'm trying to write a batch script that helps me analyzing the IIS log file from yesterday with LogParser.

My first problem was to get the date of yesterday in format yymmdd, but I've wrote a simple C# program 'yesterday.exe' to get it.

My next problem is a bit more complicated for me and after checking websites for 2HOURS I try it here:
I have a batch file for the LogParser that looks like this
run.bat
--8<-----------------------------------------------------------------
echo off
Logparser "SELECT date, TIME, c-ip, cs-username, cs-method, sc-status, cs-uri-query INTO extract_%1.txt FROM 'X:\SMTP Log\SMTPSVC1\ex%1.log' WHERE sc-status >= 400 AND cs-method = 'RCPT'" -i:IISW3C -RTP:-1
-->8-----------------------------------------------------------------

When I run it with 'run.bat 061003' it works fine. But I want to run it automaticly and I thought about using the following COMMAND to do that: 'yesterday.exe | run.bat'

This should paste the output of yesterday.exe ("061003") to run.bat from my understanding. But this is not working.

Does anyone has an idea why or another solution for my task?

Thanks and regards
thalAlas no, you cannot pipe a value in as a parameter, use this

yesterday.exe | Set /P yday=
run.bat %yday%

As a matter of interest, why didnt you use LogParser to create yesterday ?

GrahamThanks for your answer, but it's not working. When I echo that variable yday it's EMPTY. But yesterday.exe is ok.

D:\>yesterday.exe
061004

I did not thought about using LogParser for that. I will have a look at it today.

Thanks
thalThank you very much. It took some time to find out how I can do that with LogParser, but now I have a batch file, creating another batch file with LogParser. That new batch file can then do the work.

Again, thank you.

1628.

Solve : running batch files on other computers?

Answer»

All,

I have created a batch FILE which runs a file on my computer. The batch is as follows

cd \PROG*\nov*
radntfyc.exe localhost radskman mname=ACCORD,dname=SOFTWARE,startdir=$MACHINE,uid=$MACHINE,handle_reboot=y,ask=n,ulogon=n,ind=y,cat=prompt,context=m



I am trying to work out how to change this so it will run on another PC. All the pc's have a unique computer name and the share name is c$.

Can i just change the batch file to change the startdir or uid to the computer i wantWell, you would have to explain a LOT more for me to understand your problem.

But to answer what I think is your basic question,

%computername%
That variable, used in your BAT file, will supply the computer name of whoever runs it.

Mac
I would like to put in my btach file the computer name of another pc. So when i run the file it will run on there pc instead of mine. therefore doing this remotleyDifferent possibilities:
psexec (3rdparty from sysinternals pstools) to execute the batch on the remote pc.
at or soon to execute it. (set a scheduled job).
sftp. (this has to be installed on the remote PCS first.)
rcmd from the [RK] I don't have experience with it. It is described in Tim Hill NT Shellscripting book.

Some Commands have remote functionality itself.
So it depends what your batchfile shall do.

Just read out a list of pcnames with a for loop and it goes...

hope it helps
uliOK. So what you really want is a way to start a program running on another person's computer.

Good luck with that!! I have only seen that done with expensive tools installed on all computers and left running all day.

There is no way you can run something on another computer EXCEPT that computer already has something running that is polling the network and waiting for a signal to run.

Sorry.

MacWhere is the problem  to do this with "at" as a scheduled  task? (It is free and on the system.)
You can set the task for remote pcs from yours.

uli Quote

Where is the problem  to do this with "at" as a scheduled task?

Hi, uli,

I hope the OP wasn't discouraged by my post. You are right. AT is already available.

HELP AT run from the DOS prompt gives specs.

Good catch. I used it for years as a DBA responsible for 15 servers. I could run stuff from my office if all the times were more-or-less synchronized. If they weren't, it was possible to schedule a task for a time that had elapsed. I used http://www.thinkman.com/dimension4/ to ensure times were consistent.

Mac
1629.

Solve : Copy a row from file to file?

Answer»

I NEED to copy only one row from a text file to another.
for example, the first text file CALLED "1' contains:
A=1
B=2
C=3

the second text file called "2' contains:
D=4

I need to add the "D=4" to the file called "1" so after the change it will looks like this:
A=1
B=2
C=3
D=4

ThanksHello again,
Please help me with my problem.

I have 2 text files with bunch of parameters and I want to copy only 1 parameter from one text file to the second using a batch file.
Can it be done? if yes, how? what is the code I need to use?

To be more specific, The main file is INI file contain about 400 parameters and the second file will contain only new parameters that I want automatically updated the main file.

Someone? Thanks in advance for your help
Avi
Hi AviT,

have you tried:

copy 1.txt+2.txt 1.txt

which should append content of file 2.txt to 1.txt .

cheers,
jamaThank you very much JAMA,
This is what I need!

Now I get hungry   , Is there an option to import only one line (from INI file that contain lots of parameters) and import this line to a different INI (Which also contain lots of parameters)

Thanks again.
AviHi again Avit,

oops, you asked for a batch.
Edit a batch MERGE.BAT containing only this one line:

copy %1+%2 %1

and call it with (assuming that the filenames are "1" and "2"):

merge 1 2        

Hope this helps,
jamaHi again Avit,

oops, you asked for a batch.
Edit a batch MERGE.BAT containing only this one line:

copy %1+%2 %1

and call it with (assuming that the filenames are "1" and "2"):

merge 1 2        

Hope this helps,
jamaThanks Jama,
Your help is great !

Did you know if it possible to import only one line from INI file that contain lots of parameters and import only this line to a different INI file (Which also contain lots of parameters).

Thanks again
AviThat's a lot harder! Since I'm no real batch expert and if you really want to do this with a batch, I recommend to download  
Timo Salmi's TSBAT.ZIP (google for it). It contains a large collection of batch TRICKS together with readable Howto-descriptions.
Sorry that I can't solve this with a snap of my fingers.

Cheers,
jama Quote

That's a lot harder!

I agree. I have QBasic on my computer, so the following works

1) Create a QBasic program (I NAMED mine z.bas)
Code: [Select]CONST File1 = "z1.txt"' This is the file w/many lines
CONST File2 = "z2.txt"' This is the file you want to add one to.
OPEN File1 FOR INPUT AS #1
LINE INPUT #1, l$
CLOSE
OPEN File2 FOR APPEND AS #2
PRINT #2, l$
CLOSE
SYSTEM
Call it in a batch file like this
qbasic /run z

Mac

1630.

Solve : Move syntax help (batch file)?

Answer»

hi i'm creating a batch file where i wanted to move all html FILES into another folder and then delete it, however i'm having problem with the move syntax. please tell me how to fix it. below is the code, thanks

echo off
Move /y C:\Program Files\2BrightSparks\SyncBack\*.html C:\delete
del /Q c:\delete\*.* Move "C:\Program Files\2BrightSparks\SyncBack\*.html"  "C:\delete"

should work.
I don't know the /y switch.

Why do you move the files before you delete them?

HOPE it helps
uliwell when i use your method, it give me path not found.....

anyway, the reason that i move the file before i delete it, is because its a safe guard, the same folder contain the html files contain the some exe and sys file and those can not be delete.

i'm not confided in my bath file so thats why i have those file move, before i delete it.

anyway, i found out that there is a space in Program Files, so i PUT Program%20Files instead, it still give me invalid syntax, if i remove the space, it give me path not found.When moving files, they must be moved to an existing directory. I would use a name other than delete, perhaps something like deltemp.

md deltemp
move \ c:\deltemp
cd\deltemp
del *.*

If you leave the md command in the batch file, you should also remove the temporary directory by inserting rd deltemp as the last line. By doing this, each time you run the batch file the temorary directory will recreated, the files moved and deleted, and the temporary directory removed.If you wish to err on the side of caution:

md c:\deltemp
move
If exist c:\deltemp\ del c:\deltemp\
rd c:\deltemp

If the directory is not empty you will get an error message stating so; OTHERWISE, the directory will be removed. Quote

hi i'm creating a batch file where i wanted to move all html files into another folder and then delete it, however i'm having problem with the move syntax. please tell me how to fix it. below is the code, thanks

echo off
Move /y C:\Program Files\2BrightSparks\SyncBack\*.html C:\delete
del /Q c:\delete\*.*

first, create c:\delete with
md c:\delete
then write
move "C:\Program Files\2BrightSparks\SyncBack\*.html" c:\delete
that is, with the " signs
and afaik this should be it  guys i already try

Move /y "C:\Program Files\2BrightSparks\SyncBack\*.html" "C:\delete"

and

Move /y "C:\Program Files\2BrightSparks\SyncBack\*.html" C:\delete

none of them works, and i already have a folder name delete in my C drive.For what do you need the /y switch?

uliThe /Y switch silences the prompt from displaying "Moving XYZ.ABC" on the screen, thus making the file run more clearly. However, this is a disaster in testing mode.

Try the command without the /Y switch. Then check the C:\delete directory to ensure that the file is there. Report back on what happens, along with any error messages.

Tip #1 of batch files: Make it work, then worry about hiding the behind-the-scenes details. well ...

when i use these [Move "C:\Program%20Files\2BrightSparks\SyncBack\*.html" C:\delete] syntax it give me the error [The system cannot find the path specified.]

when i use these [Move "C:\Program%20Files\2BrightSparks\SyncBack\*.html" "C:\delete"] syntax it give me the error [THe system cannot find the path specified]

when i use these [Move C:\Program%20Files\2BrightSparks\SyncBack\*.html C:\delete] syntax it give me the error [Invalid Syntax]"C:\Program Files\2BrightSparks\SyncBack\*.html"
Why are you inserting %20? Your browser will understand that. Dos will think its part of the directory name. If it doesn't work as typed above, try changing to the CONTAINING directory before invoking the move command. Quote
"C:\Program Files\2BrightSparks\SyncBack\*.html"
Why are you inserting %20? Your browser will understand that. Dos will think its part of the directory name. If it doesn't work as typed above, try changing to the containing directory before invoking the move command.

yes, what has the %20 (space) syntax to do with that ?
Imho you just go

move "C:\Program Files\2BrightSparks\SyncBack\*.html" c:\delete

since no quote marks are necessary around delete
and if the delete dir exists,
either your path isn't quite right, or
there really are no html files in C:\Program Files\2BrightSparks\SyncBack\
to move yet
1631.

Solve : Comparing files between 2 drives?

Answer»

Hi all,

I ran a search and did not find what I'm looking for.

I need to check two different drives to COMPARE the files.

Basically, I have been doing some back-ups and need to know which files, if any, have not copied over.

Is there a batch FILE that can be created that will check Drive #1 for files as compared to Drive #2.

If so, I would like an output file that would show these files that are not on Drive #2.

I am running Windows Server 2003.
I also have xxcopy.

Any help would be greatly appreciated.

Thanks in advance.lksi_ken,

Try:

[edit]XCOPY source destination /U /L[/edit]
/L - Displays files that would be copied without performing the copy.
/D - Copies only those files that don't exist or whose source time is newer than the destination time.

For more details about xcopy RUN xcopy /? from the command LINE or look here:
http://www.dostips.com/DosCommandRef.htm#XCOPY

DOS IT HELP?   D'oh.

thank you!!

1632.

Solve : About batch files?

Answer»

Hi,

     How can a batch file be automatically called? I have wriiten a batch file to set the system date to JAN 1 2006 and once in 10 seconds this batch file should be called and EXECUTED.
     In scheduled tasks in windows, the minmum time for which we can schedule is a day. but this is once in 10 seconds. Please LET me know if it is possible and how to do that, if possible?I can't think of a way, but try explaining exactly WHY you want to do that. Maybe there is another approach. For example "I need the date to always be January 1" or "I plan to change the date during the day, but want it reset to January 1 because....".

In other WORDS, why does 10 seconds get into the act and why is a BAT file required?

Mac

1633.

Solve : Save in a file the screen?

Answer»

I need save in a file the commands shown in the screen.  i want to save the tree of folders that is shown when i use the COMMAND tree/f .  How? if it is possible.tree /f >stuff.txt

I'm sorry stuff.txt will not be so pretty, but the basic idea is there. Maybe you can PASTE it into some editor and MAKE global changes of the characters that represent VERTICAL and horizontal lines.

Mac
Thank you very much Mac!

1634.

Solve : internet with bat?

Answer»

Hi!!!!
I use a XP HOME EDITION on a PIV.I use a wireless connection for internet connections.
Can i make my internet connection come online with a .bat file when i boot my laptop?
thanks.Sure, just do this:

Open Notepad and type..

iexplore.exe

...& save it as a BATCH file, not a text file, then just drop it in your Startup folder.

Or you can copy / paste the Iexplorer.exe icon in the same place and not have to use a batchfile.

Alan <><  

Hi Alan.  Thanks and sorry,i´m from portugal and my english is not very good , maybe   i did not make the right question.
the thing is if i boot with IE it will prompt me for internet connection. and i want to avoid the prompt for connection.when i boot my pc it should open IE with the connection done.
let´s say i am away from home and make pc wake on ring the computer boots and connect´s it self do internet so i can remote acess my destop.
thank you
Do you have dial-up, ADSL or cable?ADSL with pcmia connection satelite.
The password and username is suplied by isp.If you buy an ADSL router you're always dialed-in with ADSL? Correct me if I'm wrong..yeswouldn't that be easier?

I don't think you can get a batch file to use the 'connect' button for your dial-up service..thank´s for your help.
For dial-up there is an auto-dialer called Dunce, but as RAPTOR stated this doesn't apply to ADSL...

patio.   8-)

1635.

Solve : deltree don't work!?

Answer»

PLEASE HELP ME!

deltree and other commands don't work.  Is it for cause of my vertion?  can I download other vertion without DAMAGE other things?

I have Windows XPWindows 2000 and Windows XP don't have the DELTREE command.
RD or RMDIR will do what you want.
what "other commands" won't work?Win98se doesn't accept 'tree' as a command.

Also, at college I have a DOS CLASS, and commands that worked perfectly OK ONE week do not work the next week!

On the exact same computer, so the same OS, same log-in.

Somebody is messing with the 'holograms' again. Some drunken maniac nedscum that uses 'alien technology' to try to 'take over the world' - yawn what a bore.

Quit messing around with the planets biorhythms, mk-ultra psychos. You'll all be wiped out by the S.S. anyway. Quote

Win98se doesn't accept 'tree' as a command.

Also, at college I have a DOS class, and commands that worked perfectly ok one week do not work the next week!

On the exact same computer, so the same OS, same log-in.

Somebody is messing with the 'holograms' again. Some drunken maniac nedscum that uses 'alien technology' to try to 'take over the world' - yawn what a bore.

Quit messing around with the planets biorhythms, mk-ultra psychos. You'll all be wiped out by the S.S. anyway.


HuH ? ? ? Quote
Quote
Win98se doesn't accept 'tree' as a command.

Also, at college I have a DOS class, and commands that worked perfectly ok one week do not work the next week!

On the exact same computer, so the same OS, same log-in.

Somebody is messing with the 'holograms' again. Some drunken maniac nedscum that uses 'alien technology' to try to 'take over the world' - yawn what a bore.

Quit messing around with the planets biorhythms, mk-ultra psychos. You'll all be wiped out by the S.S. anyway.


HuH ? ? ?


Clara, you mind explaining that?Well, it was odd but i come back to my problem.

Then how i delete a folder with files inside?
1636.

Solve : Colors in command prompt window?

Answer»

I am running a DOS program which changes some of the basic 16 screen colors by CALLING int 10H ax=1010h to set the DAC registers for VGA.
The program works well under pure DOS and in a COMMAND prompt window under W95/W98SE.
Under W2000/WinXP it only changes the colors when run in FULLSCREEN (Alt-return). When returning from fullscreen to windowed command prompt the changed colors are not TRANSFERRED to the window.
How can I make the command window under W2000/WinXP honor the VGA DAC-registers set by my program?

Thanks for any hint.

jama

1637.

Solve : How do a file.dat??

Answer»

I have to do a FILE dat.

i know that a file .dat is a file of dates but i don't kinow how do this file and What is the DIFFERENCE with a file .txt?.dat is short for data.Yes, how i do a file with this extension? :-?ECHO YourContentHere &GT;> MyFile.datThank you!Anytime.

1638.

Solve : auto restart PC when idle?

Answer»

Hi,

I'm pretty new in this website but it help me alot about creating simple batch files for my work. I also thank you for creating this website, this has been my favorite resouce site for tips and tricks with Windows.

I WOULD like to know if it is possible to create a batch file that would restart the computer AUTOMATICALLY when idle instead of triggering the screen saver.

I'm trying to create and mix and match commands. I already know about the shutdown /r xx command however, I would like to be when an interaction is made, the COUNTER would restart.

I hope this would be possible.

Thanks in advance

  ECHO  You need Windows XP or else have a Resource Kit installed. Then you can put SHUTDOWN into a script.

To call it is another matter. I don't think there is any way to associate a BAT file or program with the screen saver.

That means there would be no way for your computer to say "I have been idle for x minutes, therefore run program X".

But I've been wrong before. Maybe you can rename the screen saver program, if you could find it, and substitute your shutdown. But I tend to think there is no such program and instead the OS simply runs screen-save pictures.

MacThanks for your prompt response. I appreciate it.

So, I need to install a Resource Kit to be able to do this? Hmmm... That's a good suggestion! Also, thank you for giving me an IDEA to MAKE a screen saver file that would call a shutdown command.

BTW, the PCs that I'm working on are al XPs and 2000s.

  ECHO

1639.

Solve : Open Folder From Command Prompt?

Answer»

I would LIKE to include a line in my batch file that opens a window of a specific directory.  I know that in XP, you can use:

Code: [Select]start c:\FolderName
When I run this in 2000, it just goes to the folder within DOS. What code can I run to open the directory in a window?!try this:
explorer c:\FolderName
Also, just a point: To CHANGE directories in DOS, try the "CD" command instead. ("CD" is short for "ChDir".)

Code: [Select]CD windows Quote

Also, just a point: To change directories in DOS, try the "CD" command instead. ("CD" is short for "ChDir".)

Code: [Select]CD windows

I am having trouble FIGURING out why you posted this info. I don't see ChDir or CD anywhere in this thread. The subject is START.

By the way, START works in WindowsNT. So does Explorer. That was a GOOD suggestion. It will be interesting to see if it helps. It may be that his system cannot do START or Explorer.

Mac



I posted the info for this reason:

Quote
When I run this in 2000, it just goes to the folder within DOS.

I wanted to point out that there was an easier method of accomplishing the same effect. In retrospect, I probably didn't need to post that info. But it "seemed like a good idea at the time". :-/Actually, the Explorer method did exactly what I needed, since I wanted to open a window and not the diectory in DOS!
1640.

Solve : Permissions to folder?

Answer»

Can you please tell me how to set the persmission as everyone to a folder using command line. I want to run a batch FILE and ASSIGN this permission in order to LOG the file.

Thanks,
Ksk.I don't know if i am correct but I think that is not possible! Quote

Can you please tell me how to set the persmission as everyone to a folder using command line. I want to run a batch file and assign this permission in order to log the file.

I can't figure out what you are talking about.

Via Windows, you set shared permission to a folder. Now your bat file produces new files within that folder. Then everyone can access it.

Having a lot of trouble with "in order to log the file". What file? What does logging a file have to do with permissions?

What? Do you create a new folder every day?

Please explain in a LOT more detail exactly what your problem is. There may be a solution.

To your general question, as ALREADY responded to by Julius Caesar, there is no DOS command to set Windows SHARE attributes. DOS was invented and completed before Windows was invented.

Mac

First of all which OS?

In (NT, W2k,XP) cmd  CACLS is your command to set permissions.

hope it helps
uli Quote
CACLS is your command to set permissions.

Good info. I forgot that. Although I still wonder why it has to be dynamic. I would guess you just create a master folder and set permissions manually and forget about it.

Mac

1641.

Solve : Autoexec and Config.sys?

Answer»

First off, I'll give you a little background on what I am trying to accomplish.  I am making a USB Flash Drive bootable and loading it with DOS drivers for all the network cards on our network.  The purpose of this being, of course, to run Ghost.  

At first this wasn't a problem.  I made the thing bootable and it ran Ghost just fine, but it turns out I need it to do two different types of configuration.  One for mapping a network drive and another for multicasting.  They require different drivers and different files to be loaded.  The solution I thought was simple, create a startup menu in Config.sys to allow the user (usually me) to select which network adapter should be used.  Then pull that selection into Autoexec.bat to run the correct series of commands.

Now onto the real problem.  I have two if statements in Autoexec that don't seem to be running correctly and I'm not sure why.  I think all of my syntax is correct but I cannot be certain.  Here is the text from both config.sys and autoexec.bat:

CONFIG.SYS
------------------------------------------------

[menu]
submenu=MAP, Map Novell network drive
submenu=MULTI, Multi-cast session

[MAP]
menuitem=B57MAP, Broadcom NetXtreme Gigabit Ethernet
submenu=menu, Return to the Main Menu

[MULTI]
menuitem=B57, Broadcom NetXtreme Gigabit Ethernet
menuitem=E1000, Intel Pro/1000
submenu=menu, Return to the Main Menu


[B57]
DEVICE=\B57\protman.dos /I:\B57
DEVICE=\B57\dis_pkt.dos
DEVICE=\B57\B57.dos

[E1000]
DEVICE=\E1000\protman.dos /I:\E1000
DEVICE=\E1000\dis_pkt.dos
DEVICE=\E1000\E1000.dos

[B57MAP]

[COMMON]
LASTDRIVE = Z

-------------------------------------------
AUTOEXEC.BAT
-------------------------------------------
echo off
SET TZ=GHO+05:00
prompt $p$g
MOUSE.COM


if "%config%" == "MAP" goto MAPBOOT
if "%config%" == "MULTI" goto MULTIBOOT

goto END

:MAPBOOT
LSL.COM
E100BODI.COM
IPXODI.COM
VLM.EXE
f:
LOGIN ICAST
MAP I:=\\vantage2\imagecast\ghost\images\
i:
i:\ghost\ghost
goto END


:MULTIBOOT
\net\netbind.com
cd \ghost
echo Loading...
GHOST.EXE
goto END

:END
echo The End
--------------------------------------

One final note, my autoexec and config files are not finished as far as being able to access the right files.  The point is that autoexec for some reason does not follow the programming route as it should.  Any help in this matter would be greatly APPRECIATED.  THANKS.

Eric
Your operating system is :-?  

Can't be XP as that doesn't access Autoexec.bat or Config.sysI'm running Windows XP Professional but that doesn't matter.  I'm booting the USB Flash drive into DOS that I got from a Win98 boot disk.  I'm not sure what version of DOS it is.

On another note, I changed my Autoexec file a little BIT and got things to work, just not the WAY that I wanted.  Instead of this if statement:  if "%config%" == "MULTI" goto MULTIBOOT   I called the final selection after the submenu.  I.E. B57 with:   if "%config%" == "B57" goto MULTIBOOT.  I guess the config variable doesn't change to a submenu selection, only the final selection.  If anyone knows a way to make it so I don't have to type out an if statement for every final menu selection I would appreciate knowing it.  I'm going to have somewhere around 10 or so different network adapters listed in this config file but I only need the autoexec to do 1 of 2 things based upon the first menu selection.  Maybe there's a better way or coding the autoexec.   I don't know, but if you do I would appreciate it.  Thanks.

1642.

Solve : How Do I Create Bootable Moveable Drives?

Answer»

Installing WINDOWS on Flash USB and ZIP drives.

I have a need to create a portable Windows OS with a few associated FILES, however I find that bootable DOS FLOPPIES of any kind do not appear to recognize MOVEABLE Drives. Does anyone know how I can accomplish my goal?  :-?
Hi

try this:  http://h18000.www1.hp.com/support/files/serveroptions/us/download/23839.html


if not try the long way :
http://www.weethet.nl/english/hardware_bootfromusbstick.php


steve

1643.

Solve : DOS equivalent to UNIX "?

Answer»

Hello,

Quite new to using DOS (my first post). In a BAT file, I WANT to run a command (open paint.exe with a bitmap) and leave it open while I run ANOTHER command.

In UNIX, I would have done something LIKE:

"paint.exe xxx.bmp &
prog.exe"

Is there an DOS equivalent of the UNIX "&"? If not, Any ideas how I can do this?

Cheers,
Nickuse the command "start" befor each program you want to run.

start paint.exe xxx.bmp
start prog.exe

you can also have the batch file wait for the program to end befor going on to the next line, start minimized etc. go to a dos prompt and TYPE "start /?" to find out the syntax etc.Thanks! works fine.... 8-)

1644.

Solve : Batch File to compare dates?

Answer»

It is possible to create a batch file that copy the latest file from a particular folder? If yes pls tell me how... Im a newbie on this. tyIt's easier to let the machine do all the work. You can use the DIR command to sort a DIRECTORY listing in reverse date sequence (newest==>oldest), then process the FIRST file in the list.

You didn't give us much to GO on with concern to your OS, but this little snippet has been known to work on some machines.

Code: [Select]echo off
for /f "tokens=* delims=" %%i in ('dir /o:-d /a:-d /b [highlight]c:\folder[/highlight]') do (
      copy [highlight]c:\folder[/highlight]\%%i targetfolder
      goto skip
      )
:skip

Change c:\folder and targetfolder to match your own directory structure.

Happy Computing.  8-)Here's waht I did: But nothing happen :-?
My OS is 2000... The OLD folder is a dumping site of files (everday), what I need to do is to GET only the newest file. Thanks... pls help

echo off
for /f "tokens=* delims=" %%i in ('dir /o:-d /a:-d /b c:\OLD') do (
      copy c:\OLD\%%i c:\NEW
      goto skip
      )
:skipNothing happened? Absolutely nothing! No error messages, nada? zip?

Did you run the batch file from the command prompt or the Start==>Run box?

Did the OLD directory contains any files before you ran the code?

Did the NEW directory contain any files after you ran the code?

Your code ran fine on an XP machine. Try removing the echo off command and re-running the code. Any errors should be obvious.

 8-)now it worked!!  
thanks so much...

if it is not too much can i also ask if it is possible to compact DATABASE (.mdb) using batch file? and how?

1645.

Solve : ms-dos basic help?

Answer»

I am trying to instal an old game called betrayal at krondor.  To install this game I must USE the command prompt on my windows xp.  

I start up the prompt and it GIVES me C:\Documents and settings\uranova

I need to go to C:\ so that I can get to the folder \Dynamix\Krondor and type in some stuff that'll install the program properly...   Any IDEAS on what I am supose to do?You mean old BASICA or GWBASIC? Wow. Long TIME, no see.

To go to the root directory, type CD \

If you have problems with the program itself, come to the QBasic forum. We know BASICA (I think) LOL.

http://www.network54.com/Forum/13959

Mac

P.S. to go to \Dynamix\Krondor, just type
CD \Dynamix\Krondor

1646.

Solve : Command Line Paramters?

Answer»

I've got a generic bat file, sasmenow, with four command line parameters. It's got long path strings in it. The four command line paramters, which represent file names and or path-filenames, have some blanks in them. For EXAMPLE the first parameter is 'auth clms'. Is there an escape character that allows the parser to group 'auth clms' while keeping the blank?DOUBLE quotes are what you need:

sasmenow "parm 1" "parm 2" "parm 3" "parm 4"

Good luck. 8-)Sidewinder,

Thanks for the input. Let me back up and give a more complete picture. The generic sasmenow is invoked by a second bat file, say sas_applctn, which passes the four parameters off. The first parmeter is a path, the second a filename the third an output filename, etc.; each parm may contain embedded blanks. (I do this because the path names are really long.) Each of these is put together inside of sasmenow to arrive at a complete path-filename. What happens when I put these together with "" is such that inside double quotes don't disappear as they do in VB. For example %1 is 'c:\projects\er admits\', %2 is 'do eradmits.sas', etc. so that putting "" around %1 and %2 LEADS to "c:\projects\er admits\""do eradmits.sas" inside sasmenow which drives the interpeter SILLY. Is there no escape character for blanks or a way to mask blanks?

Tony Dee in Tulsa, OK Quote

Let me back up and give a more complete picture


Use the %~n format of the runtime parameter which will strip away the quotes but maintain the integrity of each parameter. Replace n with the ACTUAL number of the parameter. You may have to insert the leading and trailing double quotes back into the reconstructed string.

If you know VB, consider using VBScript for this. You might want to consider sending the parameters fully constructed from the calling program. There is a 255 character limit on runtime parameters; shouldn't be an issue. Or consider using the file shortname.

Happy Computing. 8-)Sidewinder, Dat worked great. Thanks.
1647.

Solve : Batch File text export?

Answer»

Hello folks,

This is a long one but HEY!!!

I have some file coming in everyday via FTP. I NEED to get them into SQL Server. However, to get SQL to pick up the files I need to create a list of them. This is because the file names change everyday.

So, I have my bat file that list files in the directory but I then need to export this list to a txt file and save it.

Can anyone help. I'm getting beyond my programming experience here and we have no cash to get someone in!!!!!!!!!!

Cheers
 8-) Quote

I have my bat file that list files in the directory but I then need to export this list to a txt file and save it.

You didn't show your instruction that lists files.

I PRESUME DIR *.xxx
where xxx is the suffix of files you are interested in.

OK, try this

DIR *.xxx /b &GT;MyDIR.txt

The "/b" is to get rid of extra stuff you don't need.

Mac
 
Thanks. That workd great.

Just got to do the sql BIT now.

Cheers Hey Mac,

Doh. When I import this to sql it seems I need to get the full directory listing ie...

G:\share\CRS\FTPDownloads\MyFilename.txt

The batch file I created is: dir G:\share\CRS\FTPDownloads/b>G:\share\CRS\CDSDataImport.txt
This just gives me MyFilename.txt

Do you know if this is possible to do?

CheersAdd the /s after the /b, this means - search subdirectories, but it will also give you the full path

DIR *.xxx /b /s >MyDIR.txt

If you do have subdirectories in this folder, then the files in there will be listed too.
Graham
Cheers Graham. You are a pro!!!!!!!!!!
1648.

Solve : Need User input to select file from other folder?

Answer» FORGIVE me for being such a noob but I was needing some help.

What I am trying to do is ask the USER to enter date mm,dd,y(100506) format.

Next with that information use the string VARIABLES ex. (100506) look into a directory let's say c:\temp and select files from this folder that have the same string ex.(1005) and COPY all text files to a directory of my choosing.


I have found some siliar instances on this board but not quite what I need, can someone help me or POINT me in the right direction, Thnaks cdrtx.Sorry my OS is XP.
1649.

Solve : dir command and size of directories not files?

Answer»

All, I am TRYING to use the DIR command to get a list of directories and the size of those directories but not list the FILES.  I am using the following command, which will get me the list of directories but not the size and file count.  I can get it to do list files and the totals.  But what I would like is just the directories and totals.  dir \\ad.sannet.gov\DFS\"WF Home"\of???arc /d/s >c:\reports\H\Archive.txt.  LET me know.  THANKS

1650.

Solve : getting to the proxy settings threw dos?

Answer»

i know this is dum but i need help geting to the proxy settings threw DOS. if i can get to them i can set up a proxy server at school and get past the sonic WALL. i think its somewhere in the ping COMMANDS but IM just getting started in dos.Pay a bit more attention during computer CLASS and you might figure out how-to someday.  i wish i had a computer class