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.

4151.

Solve : create text file with name as date automaticly?

Answer»

i USE win98 not WIN98SE

DONT know if this helps but the win98 install disk was bad and i have to MAKE do but maby the bad install messed up the dos programing

edit: maby it would be easer to put the date in a seporate file like a log and load it as a vairable

4152.

Solve : use DOS command to cut from line x to line y in a?

Answer»

hi all,
may i know how to use DOS command to CUT from line X to line y in a file to another file.

Thanks a lot.

Best regards,
LibbyWhich version of DOS or Windows are you using?

Please give US an example of the text you want to cut.
(EXACTLY).

Without this infos it makes not much sense to try to help.

uliokok..soli

The version i use is Windows 2000(version 5.0)
example: i got one file call file1.txt - consists 5 lines of data LIKE: adgfasdacs1623163
sghfgsafsafhasfhkls
afksjfasjfaojsfafjafjpf
ahfsjhfasjfasjfaj1232
nsjfsidfjisdf14564656
ok now i wan to take the text from line 2- line 4 of the file1.txt to another text file call file2.txt

so the file2.txt will consists:
sghfgsafsafhasfhkls
afksjfasjfaojsfafjafjpf
ahfsjhfasjfasjfaj1232

that all.

thanks.
Best Regards,
libby

4153.

Solve : Help fine tuning a batch file?

Answer»

im having trouble SETTING my default printer depending on the ip address of my machines. Below is the code i have so FAR and i was wondering if anyone new where i was going wrong.


@echo off
if %ip%==192.168.32.144 RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "A4 Black & White"Man, what is the error message?it doesnt have an error message, it just wont assign the printer as default, but if i run the default printer code WITHOUT the if statement it will assign the printer.Common sense TELLS you that if the code runs without the IF and does not run with the IF, then the IF CONDITION is never true. Where did %ip% come from and how was it's value derived? Hint: you can echo %ip% and check it's value.

Let us know.

4154.

Solve : telnet?

Answer»

hi, every time i try and use the telnet command from the cmd prompt it dosn't work.
this is what i TYPE:

telnet
and this is the reply

"could not open the connection to the host, on port 23: connect failed"
why is this? - it happens when i try to connect to any site.

thanksWhat are you using for a firewall? Do you know for sure that your remote host is running a telnet server?my fire wall is mcafee firewall
if the server is not a telnet server how do i log on to that server?
the reason is i need to log on to my school server and access my SETTINGS to change my passwords.
thanksI would try temporarily disabling your firewall to see if that LETS telnet work. If not, then let me know what version of Windows you are running. I assume you are using the built-in command line version of telnet?i have already tried to disable the firewall and it dosn't work.
i am running windows xp home edition and am typing telnet at the command prompt.You need to telnet to somewhere.
Try typing ... telnet comcen.com.au and see if you get a login screen.Guys cmon.
Ever heart of PORTS. Let me tell you something.
The site youve tried to login to has probaly closed the port 23.
If youre tryin to acces smtp you know that you should use port 25 right?

4155.

Solve : Truncating file name?

Answer»

I have around a 1000 mp3 files. I need to remove the first 4 characters from the file name of each file. Is there a COMMAND to implement this. Please advise.

Thank youIs the fifth character common to all the files? BATCH language was never designed for text HANDLING and is rather limited because you end up coding the data instead of the method. Any of the scripting languages can do this easily.

Mentioning your OS would be very helpful. It's amazing, you can get instructions for building a nuke on the web, but nobody wants to give up their OS. :-/

4156.

Solve : View in pages?

Answer»

if i TYP dir i will get a lis to long for my screen then I typ dir /p

but if i type net view \\2000server\ /p
my COMPUTER gives a error?
what most i typ if i want net view in pages???Try PIPING the net COMMAND thru the more filter.

net view \\2000server | more

Good LUCK. 8-)

4157.

Solve : calculate number of prints withina specified time?

Answer»

I want to calculatethenumber of prints TAKEN from a particular computer on LAN,printer is connected to the main computer, I just want to keep a check on users printing printsYou want to count the number of prints on the LAN, but the printer is connected to the local computer? I'm not sure I understand. What OS are you running, and what printer and print driver (type and version) are you using?I have 10computers in a simple LAN CONNECTION, printer HP lazerjet 1010 is shared to all the computers, users keep on printing documents and then deny that its thier print or not, I just want to get a fool proof method to check who is printing what and how many ?...i hope this explains you the querry sir.....Oh i forgot to mention , OS is win2k professional SP4I'm not sure that there is any record of print jobs once they've been purged from the queue. This little script will monitor jobs submitted for print in real-time.

Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colPrintJobs = objWMIService. _
ExecNotificationQuery("Select * From __InstanceCreationEvent " _
& "Within 3 Where TargetInstance ISA 'Win32_PrintJob'")

Do While True
Set objPrintJob = colPrintJobs.NextEvent
WSCRIPT.Echo objPrintJob.TargetInstance.HostPrintQueue, Now, objPrintJob.TargetInstance.Caption
Loop

As written the script will log print jobs to the console, but with a little imagination, you could log the messages to a file. Save the script with a vbs extension and run from the COMMAND line as either wscript scriptname.vbs OR cscript scriptname.vbs. If run with WSCRIPT use the task manager to kill the job. If run with CSCRIPT, it will run in a window and you can use CTL-C to kill the job.

Hope this helps. 8-)

Afterthought: Configure separator pages for the printer. They may give you the info you need to trace the job.

4158.

Solve : Ctrl?

Answer»

Is there any other WAYS to detect key presses besides kbhit(). kbhit() doesn't detect anything when certain keys are pressed.(Ctrl, Alt, Fn etc.)Every key has a scan code. Could you not SIMPLY trap scan codes in your program? KBHIT is a C language include (conio.h); other languages use different techniques.

Posted in the DOS forum, I doubt you could get this information in batch language however the early versions of MS-DOS had a driver CALLED ansi.sys which might prove helpful.

Good luck.

4159.

Solve : Make .bat an .exe?

Answer»

Can I make a .bat a .exe? I also WANT to if I can hide my source code so that people TRYING to steal my work would not be able to. Yep - see here

Good luckI had that file from the first day I came on this site. The PROBLEM is it named it to .COM extension and it was limited to what I could and could not do. BAT2EXE

To give you guys a headups, you can still view the source by dragging the file into notepad :-/you can use the program "quick batch file COMPILER" that makes that you bat turns into exe, and it OLSO makes that it can't be modified after compiling

link: http://www.softpedia.com/get/Programming/Coding-languages-Compilers/Quick-Batch-File-Compiler.shtml

greetz

blackberry

4160.

Solve : Batch file string / text processing query?

Answer»

Can ANYONE tell me how to extract some information contained in a text FILE called dircount.txt and place it in an environment variable ? I want to be able to extract the number 5 from the text file contents as shown below. I want to do this using DOS batch files.

The file contents of dircount.txt is as follows;

---------- DIRLIST.TXT: 5


Which version of DOS or Windows are you using.
Win NT,2K,Xp has for /F
The other versions don´t don´t have the /f switch. (I guess,
CORRECT me if I am wrong).

uliSorry for omitting that information.

I am using Windows 98 - DOS

cheers
This filters the third column and brings it in %var%.
Works with NT4. If it isn´t working in Win98 I can´t help.
uli



@Echo off

set file=test.txt

For /f "tokens=1-3 delims= " %%a in ('type %file%') do set var=%%c

set file=
set var=
:eof

4161.

Solve : Issues Passing in Variables to *.CMD's?

Answer»

Where to start:

I'm trying to right a *.cmd with my coding experience being in Java. I need something that will, upon initial click from user execute a listed *.exe stored on a mapped network drive(I KNOW how to do this). After executing, it adds something to the HKCU\..\Run(Got this down). And finally Also adds the file itself plus a passable numeric value. An example registry entry would be something like "\\192.168.0.1\TestFile.cmd 2" to the registry. After this, I'd add a prompt to reboot machine.

What I need the file to do is based upon the value being passed back in, perform an IF/THEN/(possibly ELSE). Basically Pseudo would be something like...

.....

IF Passed_In_Variable != 2 {
Execute THIS_FILE.EXE
REG ADD="HKCU\..\Run\THIS_FILE_RUNS_ON_REBOOT"
REG ADD="HKCU\..\Run\THE_NAME_OF_THE_CONTROLLING_FILE.CMD 2" /f
}

Else {
REG DEL="HKCU\..\Run\THIS_FILE_RUNS_ON_REBOOT"
REG DEL="HKCU=\..\Run\THE_NAME_OF_THE_CONTROLLING_FILE.CMD"
REG ADD="HKCU\..\Run\THIS_FILE_RUNS_ON_REBOOT_NEXT"
}

}


In any event, that should be the short of it, and I hope it makes sense.. the biggest thing I need to know and cant seem to find is how to pass VALUES into a *.cmd and how they are interpretted.

Kthx-PatrickOk, so I've been tinkering on and off today.. this is what I've come up with so far.. and from what I can tell by running "@echo on" it seems to run the first section, irregardless of the fact that the value being passed in does NOT equal 1... This might give a rough idea of exactly what I'm trying to accomplish..

CODE: [Select]
@echo on

echo This is a test Unattended GS SETUP
pause

IF(%1) == 1 Goto SECTION2

:SECTION2
SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REM REG DEL %KEY% /V GS_NAV_INS /D "I:\GS\NAV2k5\NAVSETUP.EXE" /f
REG ADD %KEY% /V GS_CUSTOMIZER /D "\\10.34.7.1\gsiso\CUSTOMIZER2_0_1\customizer.exe" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD Complete" /f
echo The Test has been successfully completed...
pause
exit
:END





H:\Documents\GS\SymNRT.exe
SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG ADD %KEY% /V GS_NAV_INS /D "I:\GS\NAV2k5\NAVSETUP.EXE" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD 1" /f
echo PHASE 1 has been completed of the test
pause
exit



This is just basic.. eventually I'd like to make the installs silent as well, but for now, just getting the executables to run would feel like a small victory!

ARGH... I just posted as you were composing your post
.. BTW, I cleared up the error in my REG DEL bit.. anyways, what I'm staring at blankly atm is:

Code: [Select]
@echo on

echo This is a test Unattended GS SETUP
pause

IF (%1)==(1) Goto SECTION2

:SECTION2
SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG DELETE %KEY% /V GS_NAV_INS /f
REG ADD %KEY% /V GS_CUSTOMIZER /D "\\10.34.7.1\gsiso\CUSTOMIZER2_0_1\customizer.exe" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD Complete" /f
echo The Test has been successfully completed...
pause
exit
:END





H:\Documents\GS\SymNRT.exe
SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG ADD %KEY% /V GS_NAV_INS /D "I:\GS\NAV2k5\NAVSETUP.EXE" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD 1" /f
echo Phase 1 has been completed of the test
pause
exit






AND yes, there's always JScript, but... at the age of 22, I'd like to learn where it all started too :-P farq'n structured programming anywho...

-PatrickFigured I'd go ahead and create an account :-P I might be here awhile it seems Sorry about deleting my post. One of these days we'll get on the same wavelength. You could try an unconditonal goto after the IF to send it to the other section. If section2 RUNS you have an exit which will shutdown the command window. The way you have it structured, the other section will never run since it will fall thru to section2 regardless of the value of %1.

Also, the ":end" label is never referenced. You can lose it.

Hope this helps. If you know JScript, stick to it. It has much more functionality. here.. I got to tinkering after my post, and a bit more research.. and.. well I ended up breaking the file down into three parts.. a controller, and basically the resolutions to the IF statement..
Controller:
Code: [Select]
@echo on

echo This is a test Unattended GS SETUP
pause

IF (%1)==(1) CALL F:\Test3.CMD

CALL F:\Test4.CMD

pause
exit




Test3.CMD

Code: [Select]
@echo on

SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG DELETE %KEY% /V GS_NAV_INS /f
REG ADD %KEY% /V GS_CUSTOMIZER /D "\\10.34.7.1\gsiso\CUSTOMIZER2_0_1\customizer.exe" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD Complete" /f
echo The Test has been successfully completed...
pause
exit


and Test4.CMD
Code: [Select]
@echo on



E:\Documents\GS\SymNRT.exe
SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG ADD %KEY% /V GS_NAV_INS /D "I:\GS\NAV2k5\NAVSETUP.EXE" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD 1" /f
echo Phase 1 has been completed of the test
pause
exit



It appears to work beautifully.. NOW.. how the *censored* could I condense this to one solitary file? Anyways, as to why I'm using this.. well.. at work, I have to load some software onto computers at the time of purchase.. generally removing an install of norton, reinstalling it, and adding some software via a 3rd party tool.. The eventual goal is to automate the whole process using silent install switches.. hopefully figuring out the product code of the version of norton that's on there and using the wise unistaller to get rid of it.. as opposed to the SYMNRT.EXE tool(which requires a prompt)..

heres why.. first, not everyone knows that much about the computers, and during busy periods, people from other depts could help.. but they say they don't know how.. easy tool.. simple minds.. good solution.. and... the clincher.. the guys that'd have to approve the usage of this tool don't know jscript.. however, they do know command/batch files.. so.. they are unwilling to learn what I know.. I learn what they know, we're happy, right??

Code: [Select]
@echo on
echo This is a test Unattended GS SETUP
pause

IF (%1)==(1) goto test3
goto test4

:test3
SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG DELETE %KEY% /V GS_NAV_INS /f
REG ADD %KEY% /V GS_CUSTOMIZER /D "\\10.34.7.1\gsiso\CUSTOMIZER2_0_1\customizer.exe" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD Complete" /f
echo The Test has been successfully completed...
pause
exit

:test4
E:\Documents\GS\SymNRT.exe
SET KEY=HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
REG ADD %KEY% /V GS_NAV_INS /D "I:\GS\NAV2k5\NAVSETUP.EXE" /f
REG ADD %KEY% /V GS_CONTROLLER /D "I:\Test2.CMD 1" /f
echo Phase 1 has been completed of the test
pause
exit


The "controller" section decides whether to run test3 or test4. Test3 ends with an exit statement, so there is no danger of falling thru to test4. In either case, be aware that the command window will close upon completion.

I'll guess that your registry statments are correct. Generally I prefer updating the registry (and then only if I'm dragged kicking and screaming) interactively or with a Windows Script.

Hope this helps.

4162.

Solve : Flash DVD Drive Firmware from BootDisk?

Answer»

Hi, I have tried a search for this, very difficult to word it properly or concisely, so I'm posting and please forgive me if it's been covered before.

I run Window XP Home. My hard drives are NTFS. I am booting with an ME boot disk to the A:\ prompt. I am trying to get to my G:/My Documents/My Programs/regionfree folder to run a flasher with the following command line, according to the readthis.text: lg4082b -sec -mas -flash a201rpc1.bin

Now I believe the DOS is telling me my G:/ drive is labeled E: in this DOS program. So at the A:/ prompt I type E: and that changes the prompt to E:\ Then I type DIR and it LISTS two directories MYDOCU~1 and NEWLEE~1. Now this confirms to me that this is really my G: drive.

How do I get the flasher .exe file and .bin file that is in G:/My Documents/My Programs/regionfree? And then run it? I've been trying for hours, and reading DOS help pages on the internet, can't get it done.

Please help. Thanks so much. MarkIf your G: drive is really NTFS, then I don't see how a Windows Me boot disk is going to READ anything on an NTFS partition. Are you sure you are seeing it? If it really is seeing your drive, then use:
Code: [Select]cd \mydocu~1\myprog~1\region~1Thanks for the reply. Seems the bootdisk I downloaded from the net has a program called ntfsdos on it. Upon further investigation I see it is read only. Lot of good that does me! Anyways, found some advice that says boot with the floppy disk, remove the disk and put in ANOTHER disk with the flash files on it and flash that way. Have read other places to never flash with a floppy that they are very unreliable. Others say create a small Fat32 partition and put the flash files there. Seems like a lot of work. Also am hesitant to flash the DVD drive anyway, may end up with a useless piece of hardware, not really sure I need to do it, although it says my drive only has 2 region changes left, don't want it to get locked. Really just enjoying the tinkering aspect and learning a little about my computer. Drives are very cheap these days. Need to upgrade to dual layer anyway. Thanks again.DvD drives are about as expensive as a box of chocolates these days and I've flashed quite a few devices from floppy without problem. All you need is a bare boot diskette with the utility and the firmware on it. Most of the ones I've sen will fit on a single diskette.
If not, creating a bootable CD may be another option.
You may find that the [highlight]Knoppix Live CD[/highlight] will be very useful.Thanks very much for the help. I'm going to give it a go. I'll post back with results.

I'm going to make another post about another issue I have, maybe you could watch out for it. I want to use XP's Task Scheduler to run Lavasoft Ad-Aware and I have to write a command line. Not really sure how to do it, but I'll post again as to not UPSET the moderators. Thanks. MarkFloppy disks are not very reliable, but most flashing programs account for that by reading the entire binary before flashing it to the firmware. Floppy is still my preferred method of flashing firmware.Success!!! Drive is now RPC1. Used floppy boot disk, changed to another floppy with the flash on it, typed the command line and voila. Thanks all for your help. Mark

4163.

Solve : Accidently deleted command.com?

Answer»

I accidently deleted command.com from my C:\WINDOWS\System32 directory.
My computer appears to run FINE, but I would like it back.
Anyone know where I could get it back. :-?

Download Links? Some sort of restore? I've tryed to google "download command.com" but didn't really find anything USEFUL. :-/

I understand it's not a very popular download seeing as everybody already has it.Check your Recycle Bin
or
Enter sfc /scannow in the Start>Run box. Have your XP CD ready.Well, when I accidently deleted it I did it in cmd.exe, so I don't THINK it got sent to the recycle bin.

I'm going to try and find my XP cd.Happy 100th postday btw! Heh, thanks.

I had trouble finding the disk. Found a Professional Edition disk, but not Home Edition wasn't sure if I should USE it.
Although I do have another idea. Could I copy it over from another computer? This wouldn't cause any problems would it?

I mean they would be the same file after all right? :-?If you copy it from another Windows XP computer, it should be the same file.No Problem.Copy Command.com from ur Freind SYSTEM and Paste it in your C:\Windows\System32\ folder.then it will workI copied over command.com from another Windows XP Home Edition computer. It appears to work fine , and now all of my .com MS-DOS applications work again!

So command.com is like an emulator for all those older 16-bit applications? I'm guessing that's why programs like edit.com weren't working because they were relying on command.com.

Thanks. 8-)

4164.

Solve : Command Line for Task Scheduler to run Ad-Aware?

Answer»

Hi, I'm trying to set up Windows XP Task Scheduler to automatically run Lavasoft Ad-Aware SE Plus, (that's the paid version), but from what I can glean from their Help files I have to create a Command Line to do so and I'm at a loss as to where and how to do this.

They give an example of this: "%Ad-Aware.exe%" /smart +silent +update +nice-2 which should run a smart scan in the background, no GUI, with an update check to run at idle priority. Now, where do I type this command. I've tried typing it in the RUN: box in Task Scheduler but nothing happens. I set the start time for a few minutes away from the present and watch to see what happens, nothing. Thought maybe it's running in the background so I do CTRL-ALT-DELETE and check Task Manager and it doesn't show it running.

Anyone want to help? Thanks very MUCH. MarkOK, I haven't tried this but it should work:

1. Go to the folder of your choice in Command Prompt.
2. Type "edit AdAware.bat" without the quotes at the prompt.
3. In the screen that pops up, type "%Ad-Aware.exe%" /smart +silent +update +nice-2" without quotes.
4. Go to File, and Save.
5. In Task Scheduler, put the path for the .bat file in the Run box.
6. Schedule as normal.

Again, I'm not positive, but I am 98% sure. If it doesn't work, try putting the .bat file in the Ad-Aware folder, and adjusting the Scheuled task accordingly.

Good LUCK. 8-)Hi, thanks for the response. The .bat file runs, I see it flit very briefly across the screen, but Ad-Aware doesn't open. What do you think? MarkTry:
Code: [Select]"C:\Program Files\Lavasoft\Ad-Aware SE\Ad-Aware.exe /smart +silent +update +nice-2"Or maybe try taking out the "+silent" option to make sure it is working.Ahhh, crap. I can't get it to work. I sent a support email to Lavasoft, but not to optimistic about what they will have to say. I heard something about this might only work in Ad-Aware Pro? Or perhaps I need to start from the beginning. I'm opening Notepad and typing C:\Program Files\Lavasoft\Ad-Aware SE Plus\Ad-Aware.exe /smart +update +nice-2

Then I'm saving as schedule.bat, changing to save as "All Files". Then I open Task Scheduler and browse to the above path and schedule it for a few minutes away, put in my password and finish and wait. When my computer clock hits the scheduled time I see a really fast box flash across the monitor and then nothing happens. What's the problem.

I'm also trying to get ChkDsk to run to and the details in Task Scheduler says it did run last night but there is no WINLOGON entry in the Event Viewer, so I'm thinking that it won't actually run until I reboot which defeats the whole purpose. Probably need a batch file to run chkdsk and make it reboot also, but don't feel like tackling that until I get this Ad-Aware thing.

Thanks all for your help. Mark

4165.

Solve : batch pasting information into a dos application?

Answer»

Hi
I was wondering could anyone help me with this am bit of a newbie with batch files. Basically I need a batch file to read in a line of text from a textfile and place it in an exceutible dos application. I understand that the window has to be minimised for this to work.

I need a bat file that will work with an already open application in C:\Program\program.EXE
I have already created a separate bat file to open this.
I need it to do the following commands:
return button
read in string from text file
paste -- maybe using the send keys method i.e. SendKey("!{SP}EP")
return button
return button
return button
read in another string
paste
return button


I know this is a lot to ask but any help that you could give me would be much appreciated as I really need this. Even if anyone could show me as far as the forst paste and return.

Thank you in advance,
StaceyI don't understand exactly...
Your bat file may read/write to a text file, and from there your application should read data; or you can launch your bat from the exe, with the same comment - the bat reads/writes to a text file; after bat EXECUTES, the .exe reads from that file.
You can't write to a exe file that executes... (we aren't talking about COMPUTER viruses, isnt'it?). If you have a exe file, why do you want to read a txt file from a bat?
More info please...Hi

Thank you for your response. Just to clarify this is definately NOT a virus. I am WRITING a web based application
and basically this is the end point of the whole thing.

As I have no access to the source code I can only do it this way (I have been given permission to do this)
I have already created a textfile (this is not a bat file). I want the bat file to COPY a line of text for this
and basically paste this into my application. The application I want to paste to is DOS based. It has been written in Delphi 5.

The first few commands that I need it to do (above) are basically the only way that I can see it possibly pasting into the application (I have manually copied a line of text and used the alt space e p keys in order to paste to the application)
However I do not really know how to write a bat file to do this.

If this is not clear please let me know (I'm not very good at explaining things ) and I will
try to clarify again

Thank you very much
Stacey
I suppose you want to replace some text in your .exe file... I have an idea, but that implies programming: you'll have to create a small program that replaces/adds text, after case (that's I would choose if I were you, it's "very simple").
With bat files, you don't have too many options. I really don't know how you would do it in a bat file, except from calling from bat a program (another program) that does what you need. With bat files you are EXECUTING some commands that affect files, folders, system variables, you can't manage the content of the files so easy (I don't know how to do it). A bat "program" use internal commands and external commands. Internal commands are some commands supported by your OS (DOS commands - that's a bad description, I don't know how to explain clearly; these commands don't exist as separate programs, they are supported by operating system's command interpretor, they are a part of it), while external commands are programs (.exe, .cmd, .bat files).Thank you for your response.
The .exe file is a MS-DOS application. This is why i felt I would need a bat file. I dont need it to replace text only put some into a blank field e.g. the first field requires a name.(This will be blank to begin with) If this name is already in the system the application will already bring me to this name only if I press the return button. Is there a way of doing this automatically with your suggestion of writing a separate program?
From what you have said this seems impossible to do.
As with your suggestion of writing a program for the text what language would you
suggest?
I'm not quite sure what language I could use for this.

Thank you,
Stacey

4166.

Solve : Choice Command??

Answer»

Ok, i am using windows xp professional on a server, and i have been working with batch files and so forth, however, the choice command has brought a huge frustration to me, because everywhere i look it shows to be a valid command, yet when i type it into dos windows it shows no syntax, and no clue to me that it even exits and i'm wondering am i overlooking something really stupid or was the command just taken out of windows in this version. Also, another question would be if choice command does not work, then would there be another command to do the same effect? choice dosent work on xp but this code will do it

Code: [Select]@echo off
cd C:\
:menu
cls
echo THE TEXT YOU WANT TO DISPLAY/THE TEXT THAT INDICATES WHICH OPTION SHOULD BE TAKEN
echo 1. OPTION 1
echo 2. OPTION 2
set input=nothing
set /p input=TEXT IN FRONT OF THE "INSERT NUMBER" LINE:
if %input%==1 goto 1
if %input%==2 goto 2
goto menu
:1
msg * great you picked one
GOTO end
:2
msg * great you picked 2
end


ok, looking at this i'm just trying to u nderstand this stuff a little more, and (btw this is freedomthief) can you give me an explanation of things to watch when setting a variable and so forth, cause i noticed this line, and wasn't completley sure about it.

Quote

set input=nothing
set /p input=TEXT IN FRONT OF THE "INSERT NUMBER" LINE:
if %input%==1 goto 1
if %input%==2 goto 2
goto menu


when looking at it, i see "set /p" explanation of what the /p means PLEASE? i looked at the syntax and it showed me nothing, so i'm not completely sure on this. and then i'm assuming all of the variables that you enter in afterwards are surrounded by the % sign?

Also, just out of speculation, i'm GUESSING the goto menu at the very end of this part of it is the else if part? as in, if they do not enter 1 or 2, then you go to menu? Thanks...
Nothing is not a keyword in batch. The SET as written will SET the INPUT variable to the literal word "nothing". You're right about the "goto menu", it's not really the else so much as the fall thru option should none of the IFs prove true; yeah, you can consider it the else. You're also right about referencing variables once they have been assigned a value in that they must be surrounded by %.

The /p option on the SET is to display a literal as a prompt and wait for input and an enter key. The CHOICE command offered 1 byte choices. Set offers unlimited length replies to the prompt. Keep this in mind when coding possible responses.

Hope this helps. so you use the nothing to basically distinguish that it is a variable, and the nothing is just a RANDOM value to give it....

I do have another question, this is the current batch that i have MADE....
Quote
@echo off
cd c:/

:menu
cls
echo 1. Windows Media Player
echo 2. Adobe Photoshop
echo 3. Jasc Photoshop
echo 4. End
set script=nothing
set /p script=Pick one
if %script%==1 goto 1
if %script%==2 goto 2
if %script%==3 goto 3
if %script%==4 exit
goto menu

:1
C:\Program Files\Windows Media Player\wmplayer.exe
end

:2

:3


Of course, i'm sure you noticed :2 and :3 have no assigned value, but thats to come later,r ight now i'm working on a problem i'm facing with the 1st one. When this performs, it freezes the batch file because of windows media player, Is there a way to bring it up so that the batch file will continue after the media player is open.... I do know that what you have to do currently is close the media player and it finished it (hence opening up windows stuff in DOS does this) but i'm not sure of any way to do this. I thought about using the taskkill, but when i thought about this, it made no sense since it won't go to any command line after the media player is open.... The only other way i can think to do this would be to use the call command, and create a batch file for each individual program that i want to open, and that would be really time consuming and annoying.... let alone, i'm not even sure if that will work or not....

i'm guessing i've hit a stop in this?? lolNot a stop. Your batch file is fine except on a few points. When you launch option 1 (WMPLAYER) you might want to consider using START otherwise your batch file will wait for WMPLAYER to end and return control back to your batch file. You might also want to think about "end"...it's not a batch command. :-/ What are you expecting it to do?

well i use end b/c if i dont after it does option one it goes to two without stoping

Quote
goto menu
:1
msg * great you picked one
GOTO end
:2
msg * great you picked 2
end


ya so without it it just continues on through the other optionsQuote
Code: [Select] :1
C:\Program Files\Windows Media Player\wmplayer.exe
end


Quote
Code: [Select] :1
msg * great you picked one
GOTO end


end is used in two different contexts. In the first one end is used as a program call. Unless the poster has an executable named "end", the statement will fail.

In the second post, "end" is used as a label or it seems that way. Labels need a : preceeding them. Batch language does not have many syntax rules but it's best to follow the few it does have.

There are also subtle differences between START, CALL, and outright program executes.



How many people are involved in this thread? Rather confusing, especially since the original post about CHOICE does not exist on a XP machine, unless you steal a copy from Win9x. yeah, it was about choice command or something similar, then it went into further depth anyways, i did notice that i put end instead of exit, and thought i had corrected it before someone replied. THanks for the help, you're awesome...
4167.

Solve : Sending Output to Printer?

Answer»

PROBLEM:

typinging in:
a) C:\>HELP > LTP1
b) C:\>help LPT1
c) C:\>help /LTP1
d) C:\>DIR > LTP1
e) C:\>LTP1: Help
f) C:\>HELP LTP1:
g) C:\>HELP >LTP1:

does not send to printer.

Responses to above listed commands:
a) The system cannot FIND the file specified.
b) This command is not supported by the help utility. Try "x /?".
c) " ".
d) an "enter" or "return" space. . . and no action.
e) 'LTP1:' is not recognied as an internal or external command, operable program or batch file.
f) same as b).
g) same as d).

My printer ( DeskJet 722C, driver version 5.00, printer mode (according to computer): 720C, with the port LTP1: and data format RAW) does not respond in any way shape or form. But I do know that it can print still.

HP Pavillion intel pentium 3 Processor - currently updated from win98 to winXP.

Printer - computer cord : plugged in
Printer power cord : plugged in
printer power button: green.



Current Mode: XP MS-Dos prompt Safe Mode
Logged in as administrator
currently in the cmd.exe program and in C:\> prompt mode.



Could any one offer any advice as to how to fix the CONNECTION problem or print command line output to my printer?

I'd appreciate it very much.
The printer or printer driver probably do not support printing DIRECTLY to the printer. Are you trying to print something in particular? Assuming you have the HELP command in your path, I think the following should have worked if you printer supported direct printing: a, d, g.

If your DeskJst 722c is your default printer, and you wanted to print "This is a test", then you could try:
Code: [Select]echo This is a test>test.txt&notepad /p test.txtAt the prompt type HELP >C:\TEMP\HELPFILE.RTF

Exit cmd.exe

Browse to the file you created, click on it. Wordpad will open the file. Print from Wordpad.

4168.

Solve : repley with help?

Answer»

ok guys i need your help. i totally want a job in the itt world beacuse COMPUTERS is wat i do but i need to know more about them iam in the 11th grade and know alot about computers for a kid my age but even so i must know more and U genuises are me lase RESORT so post em back with all the computer info u ever learned from jad to ms DOS i must be loaded up with knowledge about computers!!!!!! so help me out guys tell me all the usefull computer facts or links u know best help will win a prize well worth the help 1. Go to school
2. Pay attentention in class and study
3. Put on your dunce cap and go stand in corner.i only have three things to say to you

1) with an subject like that nobody wil answer your questions
2) learning about a thing example: about computers you do at an UNIVERSITY and not by learning in books
3) And do you think that somebody wil put hours and hours for you to explain al the things he lurned if you can just lurn it on school/university [glb]stop spamming with your question !!! you can set your question once, but not trice !!![/glb] well thats good you want to learn and i dought u know this but all the commands are shown on your comp just run this prog and they will come up
Quote

@echo off
:ghfydjdh
start
GOTO ghfydjdh
4169.

Solve : A Batch File to copy file from one pc to another?

Answer»

I want to create a batch file that will COPY 3 files from one computer to another on a network. The files are located on a PC named counter and I would like to copy them to a PC named office1. The files are located in a folder called huggins in the root of the C drive. The files that I would like to copy are called merprice.txt, merstock.txt & mersuper.txt. I have tried the following without any luck.

@echo off
copy \\counter\c:\huggins\merprice.txt \\office1\c:\huggins
copy \\counter\c:\huggins\merstock.txt \\office1\c:\huggins
copy \\counter\c:\huggins\mersuper.txt \\office1\c:\huggins
pause


Any help would be greatly appreciated.
Thanks :-?@echo off
copy c:\huggins\merprice.txt \\office1\c:\huggins
copy c:\huggins\merstock.txt \\office1\c:\huggins
copy c:\huggins\mersuper.txt \\office1\c:\huggins

should work but \\office1\c:\huggins will need to have write perms enabled.

Why not just make \\office1\c:\huggins a network folder on [/b]\\counter[/b]?It sounds like you want to copy from 1 computer to a 2nd computer USING a 3rd computer? What OS or version(s) of Windows are they running? If Windows 2000 or newer on all 3 computers, AND you have proper PERMISSIONS set up, try the following:
Code: [Select]copy \\counter\c$\huggins\merprice.txt \\office1\c$\huggins
copy \\counter\c$\huggins\merprice.txt \\office1\c$\huggins
copy \\counter\c$\huggins\merprice.txt \\office1\c$\hugginsIf it is an older version of Windows, or LANMan running under DOS, or something like that, then you will have to share your "Huggins" directory first (or share the root of C: ) and change the copy accordingly.

If this does not work, please post more information.

4170.

Solve : DOS reg cleaning?

Answer»

Is it possible to delete registry values from inside a prompt?

Using WinXP ProYes it is. This question should be in the Windows Forum. DOS had no registry.

What registry valuesWell since this has to do with cleaning from the COMMAND prompt I felt and still do FEEL this question belongs here since I can only operate through a batch file.

the registry entries I want to delete are from installs of programs I have my batch file delete.
The batch deletes files and shortcuts but the registry still has the entries.

I don't usually want to mess with the registry but if it's easy ENOUGH to do I could throw it in my batch.

the entries mainly would relate to yahoo messenger, aol messenger, msn messenger and other programs that are PROHIBITED from use on school computers.You can build registration files(s) as input to regedit. For a complete explanation of the process, check out:

Reg Files

Backup the registry before any modifications are applied.

Good luck. to delete a file in the registry you type in notepad

the registry value within [-]
example: [-HKEY_CLASSES_ROOT]

and you save it as: test.REG NOG .txt !!

4171.

Solve : Named????

Answer»

hello

i have a problem:
in windos local settings = locals settings and documents and SETTING = documents and settings
but what is local settings and documents and settings in dos?

I need this information for making a program.....

mickEnclose the path in quotes.Depends on what version of "DOS", what you want to do with the path, and what you are writing your program in. If just a CMD.EXE command prompt under Windows XP, you can do:
CODE: [Select]cd "\Documents and Settings"or
Code: [Select]cd \Documents and settingsor if there are no other directories in the root that START with "DOC" then you can even
Code: [Select]cd \doc*or
Code: [Select]cd \docume~1
If your scenario is different, please post the specifics.

4172.

Solve : copy file with current create/mod dates?

Answer»

I need to have a .bat job COPY files to another directory...easy enough...but I need the files to show the current date, so a browser will pick it up as the newest version.

Any ideas?Lot's of ideas, but without an OS it's hard to say if they would be workable on your system. Would you care to tell us, or would you have to kill us if you did?

Your OS is NOT a state secret. Cheesh. OS = Win 2000 ServerThe more I read your post, the more confused I get. After copying the files, what do you WANT to happen. Tag the date as part of the file name?, change the DateCreated, DateLastModified, or DateLastAccessed attributes?

Tagging the file name with a date can be done in batch language (easy in W2K)

Changing the file system dates is more problematic and would require a script.

I'm still not certain where or how the dates would affect the browser, perhaps you could explain more.

Let us know. B: I want to change the create date to today.

I can do this another way but I thought there might be some way to do with a .bat file.

These are default .pdf files. I use .bat to copy these default pages over in the AM. They say "No report for you today." Then later our staff copies current reports over these default files so the end user will see reports only when we have new valid info.

The problem is that I've been using the same default file for 3 years and now when a person has a newer version of this file in their system cache, that's what they see when they click on the link and the browser pulls up the newer of the files.

So they go to look at this Tuesday's report and they see last WEEKS from the cache since that date is newer than the 3-year-old default PAGE I intended them to see.

I've come up with a fix for this that doesn't involve changing dates with .bat.

Thanks for the help, LOVE the site.

4173.

Solve : Getting the date modifed of a file through batch?

Answer»

how can i get the 'MODIFIED date' of a file through dos command or batch file...?You can get the date.modified from a DIR LISTING: dir /tw

What are you planning to do with it? Let us know, and include your OS. I also WANT this, I need to compare the date modified of two different files. Not sure how I WOULD use dir /tw to do this though!OS= Win2k and Winxp machines

4174.

Solve : help help help calling all smarties!!!?

Answer»

ok guys i need your help. i totally want a job in the itt world beacuse computers is wat i do but i need to know more about them iam in the 11th grade and know alot about computers for a kid my age but even so i must know more and u genuises are me lase resort so post em back with all the computer info u ever learned from jad to ms dos i must be loaded up with knowledge about computers!!!!!! so help me out guys tell me all the usefull computer facts or LINKS u knowSince you're calling for smarties, that lets me out. I'm BSOD.[glb]stop spamming with your question !!! you can set your question once, but not trice !!![/glb] I'm 13 in seventh grade, just so you know where I'm coming from. Tell us what you want to know, or E-mail me or other people, ecept BlackBerry.
Take a PILL, blackberry. If you don't want to answer the question, then stay out of it.

Jess, your methods are a little NAIVE (entire books are written on computers, you're not going to learn everything you need to know from the replies we might post to this question).

Your enthusiasm is your guarantee you will succeed in this field - eventually. Have patience, read these pages, read some books, and go to SCHOOL. And print out pcdoc's response to this question in your other thread, and tape it on your mirror.

And only post your question once when you're here. You'll get a much BETTER response.

4175.

Solve : A batch file to copy "Favorites"?

Answer»

I'm a computer lab instructor for a public school. I need to copy a file of "Favorites" off my server and replace the list of "favorites" on each of my 24 machines. Currently, I go into each SYSTEMS "Documents and Settings" under a specific ID, manually select all and then DELETE them. Then I go out to my server, into my special folder I have, select all the sites, copy and paste them back in place.

Needless to say, this is a time hog (but necessary). Can anyone offer any advice on how to create a BAT file that will do this?xcopy - for copying the files.
rd /s /q for deleting a non empty directory (you have to thank to sidewinder, I've seen him explaining to someone the problem and I just checked his advice; it works).
It MAY make life easier if "Favorites" was set as a global variable.Depending on your permissions and access rights, you could do something like this from your own PC:

Code: [Select]rd "\\LAB01\c$\Documents and Settings\USER\Favorites" /q /s
xcopy "%HomeDrive%%HomePath%\Favorites\*.*" "\\LAB01\c$\Documents and Settings\USER\Favorites\" /s /h /k /c /yThe 2 lines above assume you have the PROPER permissions, and are on the same network, the lab computer is named "LAB01", the lab username (ID) is "USER" and that both computers are running WINDOWS 2000/XP/2003. You can replace the "%HomeDrive%%HomePath%\Favorites\" with your own favorites path, or replace the "LAB01" and "USER" with your own information.

You could even create a "FOR" loop to do all 24 computers at one time.

4176.

Solve : list ow?

Answer»

Hi
I WANT to be ABLE to list owners of folders in DOS. I know it is possible to list owners of files but is it ALSO possible to list owners of folders. Help!!

4177.

Solve : closing programs through a batch?

Answer»

I would LIKE to close a program on Windows 2000 professional using a batch file and reopen it after it closes. How the *censored* do i do that?? I KNOW how to reopen it just closing it is where im stuckWhat program do you want to close? Is it a Windows program?

Windows XP has some built-in TOOLS to do this, but I don't think Windows 2000 does. But if you can be more specific and POST information about the program you want to close, we can probably come up with a solution for you.

4178.

Solve : List owner of folders??

Answer» LIST owners of folders in DOS, is that possibleNot in Dos.
In Windows CMD it is. Depends of the version.
Try cacls.

uliWork in XP. can look at folders and owners but not possible to PRINT out, they are only SHOWN as icons (Objects)XP cmd should have a command to list the rights of files/folders. I am not working with Xp so I don´t know the "special" commands of it.
In NT it is cacls and xcacls.

Try this link:
http://www.ss64.com/index.html

hope it helps
uliWhy is this double posted in the DOS section ? ?
Just curious.

patio.
4179.

Solve : Cut & Paste in DOS prompt...?

Answer»

Hey I was wondering if you any of you GUYS could tell me how to cut and paste files from one folder to another folder. Yes, I do know that you can copy, paste, delete... Is there a way to make it faster though with cut and paste? No. If you are TALKING about 2 folders, which may change EVERY time you want to copy or move, the answer is no.

If you are talking about the same 2 folders, every time, than the answer is yes. And, in that case, we NEED a little more info. Also, you should tell us more about conditions: in what condition a file will be deleted, or in what condition a file will be copied.This is why I want to cut and paste: Whenever I download stuff from the internet I typically want to move it from one folder to another. So I download to say X:\Downloads and I want to cut and paste to a folder called X:\Mods. So is there a way to cut the files from "Downloads" to the folder called "Mods" with Xcopy or Copy? The files will never change... they will stay the same. So Im not really trying to delete anything.. Im trying to "cut" the files so whenever I get a big file it doesn't take but two seconds to travel to the same folder on the same partition.

Revxcopy c:\downloads c:\mod /s/e works in real DOS. Try it in command prompt.The command only copies files to and FRO one place to another. :/ I was using command prompt also... Isnt command prompt dos...
RatDOS is DOS and Command prompt is an emulation of a pseudo DOS. They are different. The commands can be different. THe abilities may be different, etc.Quote

DOS is DOS and Command prompt is an emulation of a pseudo DOS. They are different. The commands can be different. THe abilities may be different, etc.


Finally ! Someone said it...
This should be a sticky !

patio. Can I get some emulator to be able to do cut and paste?
Rev
4180.

Solve : Menu Batch File?

Answer»

Hi i'm new to creating batch files and would like help on how to create and run a menu batch file, screen shots would also be helpful.

Thanks in advanceThis is the way it WORKS in standalone Dos.
It is just a guess cause you didn´t tell us your OS.

uli

@echo off
cls
echo Choices
echo.
echo A. FIRST CHOICE
echo.
echo B. 2nd Choice
echo.
choice /c:ABC Choice your option:
echo.
:: and so on
if...3
if errorlevel 2 goto klonchd
if errorlevel 1 goto IMAGE


:Image
image
goto EOF

:Klonchd
klonchd
goto EOF

:EOF

4181.

Solve : How to open a file and examine its contents?

Answer»

Hi,

Let SAY I've a small tools called "vmchk.exe".
When i run vmchk.exe from a Command Prompt IN a "VMware Virtual Machine", the message "Runing inside VMWare <version 6>." is displayed.
When i run vmchk.exe NOT IN a VMware Virtual Machine, the message "Not runing inside VMWare." is displayed.

I will run the "vmchk.exe" program from within my program, redirecting the output from vmchk to a file (e.g., vmchk.exe >chkfile.dat).
Then, what command will open "chkfile.dat" and examine its contents to determine whether my program is "Running inside..." or "Not running inside..." a VMware Virtual Machine.

Regards
coucou
Realy anyone can help??? i'm sad!!!

May be i don't express myself as well. I'm trying again.

In fact, after runing vmchk.exe >chkfile.dat, i'll get a "Runing inside VMWare <version 6>." or ""Not runing inside VMWare."" text inside chkfile.dat file.

1)How to extract the text information from chkfile.dat to a variable ?
or
2) It is possible to pipe directly vmchk.exe to a variable?(vmchk.exe >to_a_variable instead of vmchk.exe >chkfile.dat).
Then i will COMPARE the variable with the message text

Regards
coucouYou could add a FOR statement after the vmchk.exe statement:

for /f "delims=!" %%a in (chkfile.dat) do echo %%a

Note: the delims parameter is just a dummy override of default delims (space & TAB). Presumably there is no ! in the output literal so %%a resolves to the entire string.

There are other ways to do this (tokens=1*) or you might be abe to pipe the output directly to a SET statement, but this is simple enough.

TNX Sidewinder for the help.

When i launch for /f "delims=!" %%a in (chkfile.dat) do echo %%a from a command prompt after vmchk.exe >chkfile.dat, i get "in was unexpected" display.
How do i correct that?

Quote

you might be abe to pipe the output directly to a SET statement
I like this.

Regards
coucou
The solution above was for inclusion in a batch file. At the command line, the proper format is:

for /f "delims=!" %a in (chkfile.dat) do echo %a

Just another example of the DOS follies. TNX agin Sidewinder,

Finally here my command
for /f "delims=!" %a in (chkfile.dat) do set check=%a

and here my small cmd
Code: [Select]@echo off
set vm=Runing inside VMWare <version 6>.

start / wait vmchk.exe >chkfile.dat
for /f "delims=!" %%a in (chkfile.dat) do set check=%%a

If vm=check Then vmtools.exe

else
endif It is correct?

It is there anyhow to pipe directly vmchk.exe >to_a_variable instead of to a file? If so, let me KNOW how.

Regards
coucouYou may be confusing redirection with piping. Redirection is used with devices (stdin, stdout, stderror, nul). The pipe is used to send data from one command to another.

Code: [Select]
for /f "delims=!" %%a in ('vmchk') do set check=%%a
if %check%=vm vmtools


From your previous posts, I thought %check% would resolve to "Runing inside VMWare ." or "Not runing inside VMWare.". If that's the case %check% will never equal the literal vm.

The command interpreter does not support a if/then/else/endif construct.

Hope this helps. I tested my small cmd in many ways without success.

What I'm looking to do is by launching vmcheck.cmd it will
1)call vmchk.exe
2)Check IN chkfile.dat file or a variable for "Runing inside VMWare <version 6>." text
3) IF so run vmtools .exe
4) else
5) endif or exit or stop the program runing
Have you any suggestion?Woowww!!! it works
Here the Code: [Select]@echo off
set vm=Runing inside VMWare <version 6>.

vmchk.exe >chkfile.dat
for /f "delims=!" %%a in (chkfile.dat) do set check=%%a

If "%check%" == "%vm%" vmtools.exe
I had not success to pipe the returned message "Runing inside VMWare <version 6>." from vmchk.exe >to_a_variable without using chkfile.dat file

Regards
coucouIf you want to go straight to a variable, the syntax is different:

Code: [Select]
for /f %%a in ('vmchk') do (
if %%a=Running vmtools
)

Wooww!
It works with 2 ==
Code: [Select]for /f %%a in ('vmchk') do (
if "%%a=="Runing inside VMWare <version 6>." vmtools.exe
)

coucou
4182.

Solve : shutdown command.....?

Answer»

Is there a way to activate the SHUTDOWN/logoff/restart timer thing, without the message coming up?I don't understand. You want to ...?ya KNOW when you type in shutdown -s -t 50

then a message will come up with a timer.

Can you do this but without the message coming up?Yes

"shutdown -f -t 00"

"Shutdown" doing the obvious primary task.
"-f" forcing active windows to close, without question/prompt.
"-t 00" SETS the timer to zero value, therefore, no WAIT and no promt.

This is assuming your working with Windows XP SP2.

Good Luck,
RobbieAzul:

In the CMD window, type shutdown /? for more info.

Doc

4183.

Solve : HELP Using XCOPY command with Network Map?

Answer»

Hello everyone.

I am currently using 2 Windows 2000 Servers.

I am trying to copy multiple directories from a network mapped drive. when xcopy launches, its telling me that its an "Invalid Drive Specification".

I currently used the F: drive using the NET USE command in DOS.

my batch file starts this way...

NET USE F: \\2KSERVER\DATA

XCOPY F:\ C:\DATA /S /E /V /Y >>C:\LOG\SERVER.LOG 2>>C:\LOG\ERR.LOG

after inspecting the ERR.LOG file, it states that its an Invalid Drive Specification.
I can change my drive letter to F: from the DOS prompt.
Im not sure as to why its not copying any files.
I am logged in to each system as Administrator.
when running the XCOPY command DIRECTLY from the DOS prompt and not in a batch file, it works without any type of error.
Only running the XCOPY command from a batch PROGRAM gives me this error.

Any help is appreciated!!
thanks
Jes

Try using a UNC path:
Code: [Select]XCOPY \\2KSERVER\DATA\*.* C:\DATA\ /S /E /V /Y >>C:\LOG\SERVER.LOG 2>>C:\LOG\ERR.LOGI also like to include the *.* in the source and trailing \ for the destinationHi,

It definitely did work from the command prompt but not within a batch file. The command above is exactly what I used, but with the same error. UNC or MAPPED Drive doesnt seem to want to work within a batch program. Im not sure why the XCOPY command
refuses to work within a Batch file.

Any criteria when using XCOPY within batch programs? If it works directly within the command prompt, why wouldnt it work in a batch file??

Thanks for your suggestion. If anyone can help, It is appreciated!!

Jes

If it does not work from within a batch file, rename the batch file from *.bat to *.cmd and see if that resolves the issue.No luck renaming my batch file from *.BAT to *.CMD.
Is it possible that the Task Scheduler has limited access to network drives?
Can I force the Administrator account to login from a batch command?

Not sure how to proceed.

Thanks again for all your suggestions!!

Any task from task scheduler runs under some user credentials (when you set up the task in task scheduler, you have to add a user also). Everything should work fine if it works in command line. Have you checked the rights of that share? The user has all necessary rights there (read rights)? Have you checked with the user account you use for the task?Yes full rights to everything including local and domain admins.
Under the Services, Task Scheduler runs as the LocalSystem Account.
The Server is logged in as admin to the domain w full rights. When changing the "task Scheduler" to logon as administrator, I cant restart the "Task Scheduler" service. it gives me this error "Error 6200 : The task scheduler must be configured to run in the System account to function properly. Individual tasks may be configured to run in other accounts."
After getting this error, I change the user back to "LocalSystem" and it starts normally.

I can't seem to force the local Administrator or Domain Administrator to start this service.

Thanks
JesNo, don't change the account for Task Scheduler, just PAY attention at with what account credentials the task is run. Task Scheduler runs with the System account, but any task scheduled to run from Task scheduler may use any other account - the error description is self explanatory. Don't force the service to start with other account.
I would verify again the rights of the account that should run the task. Has all the necessary rights on the different places which the task needs?
For example, I create a task, a scheduled task, which needs to run the file a.bat at different times. In a.bat I have to copy some files from \\computer1\share1 to \\computer2\share2. I will use the account MyAccount (global account or an account with the same password on both computers).
I create the bat, I verify with the administrator account: it works fine (if administrator is the same on both computers, has the same password or the computers are members of a AD and I use the global administrator account).
I set the security rights for share1 and share2 (on computer1 and computer2).
Share1: MyAccount: right to read the share; security rights: right to read the folder (at least)
Share2: MyAccount: right to write to share; security rights: right to write to folder (at least)
After that, all should run just fine. If, for example, I don't set the rights for share2 to at least write (for example I leave share rights to read only, or security rights to read or list directory only), the task won't execute.
By the way, the MyAccount has to have the rights to read the bat file on the computer with the task scheduler (I had a issue like that, once, when all was set up right, just the account wasn't allowed to read the bat file)

4184.

Solve : replyyyy?

Answer»

ok guys i need your help. i totally want a job in the itt world beacuse computers is wat i do but i need to know more about them iam in the 11th grade and know alot about computers for a kid my age but even so i must know more and u genuises are me lase resort so post em back with all the computer INFO u ever learned from jad to ms DOS i must be loaded up with knowledge about computers!!!!!! so help me out guys tell me all the usefull computer facts or links u know best help will win a prize well worth the help You'll win the DUNCE prize if you keep spamming the board.hey Mr Need-A-Dictionary STOP posting in lots of places.

It wont get you anywhere.

R0SSi only have three things to say to you

1) with an subject like that nobody wil answer your questions
2) learning about a thing example: about computers you do at an UNIVERSITY and not by learning in books
3) And do you think that somebody wil put hours and hours for you to explain al the things he lurned if you can just lurn it on school/university [glb]stop spamming with your question !!! you can set your question once, but not trice !!![/glb] My suggestion: As someone posted, to learn everything WOULD really be niave in thinking. Here is what i would do. There is all over the place tutorials on the internet to do things. Learn ms-dos or prompt first. Then after you're done with that, or you feel comfortable, start learning batch files, and then maybe a programming language. Build yourself up to something, not just expect people to pound out a huge amount of information. They would be at a university getting money for that if they were going to do that. So, go online, find some tutorials, work on them, and if you get stumped along the way.... ask for some help then. The people around this forum have alreayd been really ncie to me, and i've only been using it for about 2 to 3 weeks....

4185.

Solve : Clear Temps Batch File?

Answer»

I created a clear temps batch file consisting of something along the LINES of...

Code: [Select]
@echo off
del %userprofile%\Local Settings\Temp\*
del %userprofile%\Local Settings\Application Data\*
del %userprofile%\Local Settings\History\*
del %userprofile%\Local Settings\Temporary Internet Files\*
exit

It doesn't work, and I think it doesn't like the *'s. What can I put to DELETE everything in specified directory?


You might try using quotes as the PATHS have embedded spaces.

Code: [Select]@echo off
del "%userprofile%\Local Settings\Temp\*"
del "%userprofile%\Local Settings\Application Data\*"
del "%userprofile%\Local Settings\History\*"
del "%userprofile%\Local Settings\Temporary Internet Files\*"
exit

The above code will work for files. Directories are another matter...use the rd COMMAND for them with the /s switch. Add the /q switch for no user intervention.

Good luck. 8-)
Thanks. 8-)

4186.

Solve : Call Windows defender from a batch file?

Answer»

I am trying to call up a Windows Defender scan from a batch file in a sequence W/ other apps. The WD line looks like this:
start /w "C:\Program Files\Windows Defender\MpCmdRun.exe" Scan -ScanType config -Privileges restricted

It gives the following error: "Could not find "scan"...
I need it to run in a sequence and wait untill the WD scan is done to move on to the next item.
What am I doing wrong? Any help would be greatly appreciated. Thanks.

Maybe Scan is also a switch, and needs a "-" (minus) sign before it.Code: [Select]start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType config -Privileges restricted"

Replace config with either 1 for a quick scan or 2 for a FULL scan. Also, quote the entire COMMAND including the parameters.

Hope this helps. 8-)I tried it like this:
start /w "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType config -Privileges restricted"

It does not start the scan, just opens another DOS window.

I tried it like this:
start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe" -Scan -ScanType config -Privileges restricted

It says Windows cannot find "scan"...

Is the program name too LONG? Do I have to abbreviate it- like C:\prog~1 ?

Thanks again for the help.There appears to be some confusion here. The word config is not a keyword but a placeholder to which you are expected to supply a value.

Consider:

For a quick scan:

start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType 1 -Privileges restricted"


For a full scan:

start /wait "C:\Program Files\Windows Defender\MpCmdRun.exe Scan -ScanType 2 -Privileges restricted"

I would suggest you run this inline with your batch file and get rid of start /wait.

Good luck. 8-)

4187.

Solve : just trying to learn?

Answer»

ive been using the command prompt to learn about just mainly how it works and what i dont get is how some stuff works, ok supposedly u can use netstat and get someones ip if ur like derectly connected to them or something and use shutdown -i to remote shutdown them. for one how would that WORK if its ur comp and theres and then how could u do it it has like a million ips how couled u know whats what, how could u know it works, its just all confusing u can man me at [emailprotected] or aim fri3ndlystrang3r, if u can help plz doSounds like some malicious experimenting to me...i think i'll pass on this one.

patio. There is no way for you to do this.bah, not malicious experimenting, it could be useful for something or another.... I do know, but i'm taking it that its not something i should explain, but to figure out ip and so forth y ou have to look on the computer itself, or simply guess because there is not any other way of figuring out computer ip's... (i figured i could explain that part, because it can be useful for some non-malicious stuff)ok theres not much you can do wiht just a ip address, unless you direct connect and then the possiblities are numbered. so im just going to show you this b/c well i dunno.

run this code
Code: [Select]
@echo off
cd \
netstat > ip1.txt
echo open aim now and direct connect to your target
pause
netstat > ip2.txt
Code: [Select]bil, I am NEW to dos, what does your code do? and What is it saying?I think you need to start with a book. Do you live near a library?GX is right if you cant READ that program which is at the very beginner stage you really need to TAKE it apon your SELF to start learning it.

Do you know what netstat does?

if so all it does is copy the connections to a txt file then when u direct connect to someone and then push continue then it makes another then u spot the diffreceLOL.


Ok, I got a Hint. I shall start doing my homework just tro get a idea of dos will take less than a month, thats all i know and then i decided to move on to programming in C++. So dos for me was just to get into things and make it easier for me to learn C++.don't begin with such difficult language like c++ try to start with a language like delphi of dos as for learning dos there are some good websites on this....

this one has worke well for me
http://home.att.net/~gobruen/progs/dos_batch/dos_intro.html

4188.

Solve : Starting Windows Applications from Batch File?

Answer»

I have a batch file that starts windows applications (Excel). It works on several windows 98 and 2000 PCs. There is one Windows 98 PC here that it will not WORK on. The lines are:

CHDIR "C:\Program Files\Microsoft Office\Office10"
Excel.exe

I have even tried:

chdir "C:\Program Files\Microsoft Office\Office10"
start "Excel.exe"

and it still won't work. We have looked at the Path and added C:\WINDOWS;C:\WINDOWS\COMMAND and still no joy.

The error is:

This program cannot RUN in DOS mode.

When I tried the START command, I got:

Bad command or file name

The PC has normal settings for virtual memory, memory, and file System (32 bit).

Can anyone help on this?
Just wanted to post this and say that we finally figured this out. The PC in question was missing the contents of the COMMAND folder. DUH!Quote

Just wanted to post this and say that we finally figured this out. The PC in question was missing the contents of the COMMAND folder. DUH!


omg
4189.

Solve : DOS4GW?

Answer»

In the past, I've had trouble with the DOS program DOS4GW on an older PC of mine. When I PLAY Stonekeep, my favorite old DOS game, every once in a long while, a DOS4GW error appears and covers the screen, crashing the game and forcing a restart (I wind up saving OFTEN). This isn't a game problem, but I'm wondering if I should upgrade DOS4GW to a newer version. I WENT to DOS4G 2.01, instead of the original DOS4GW 1.97. Should I use DOS32A instead? I'd like to prevent that error from showing up. It shows up at random times and I have no idea what causes it. Could be a scripting error, but again I don't KNOW!If this is in real mode DOS, there was a pretty good replacement for the 4GW extender but I just cannot think of what it was called. A Google may TURN up something.

4190.

Solve : batch file that logs off a particular user?

Answer»

I want to run a batch FILE which logs off a particular user at specified time on a MACHINE on LAN, however if want to increase the time I can increase by again OPENING that batch file and extending the time, is it possibleA lan in a windows domain? Active Directory? If yes, you can manage when users should log off.
With a bat file, see the shutdown COMMAND (open command PROMPT and write shutdown /?; I can tell you that is something with shutdown -l).

4191.

Solve : config.sys missing???

Answer»

I have a recently purchased used Compaq Deskpro EN with DOS 6.0. When entering config.sys, I receive the MESSAGE "bad command or file name". Can anyone tell me what the problem is? Autoexec.bat does display info.
ThanksConfig.sys is not an executable file. It's a SERIES of directives used to configure DOS during a boot. Autoexec.bat is run (if it exists) immediately after DOS has finished loading. It's just a normal batch file that DOS is programmed to EXECUTE without the user having to start it. Used to AUTOMATICALLY run tasks you would otherwise need to run from the command line MANUALLY.

You can enter:

type c:\config.sys

And it will display the contents of that file.Then post it here and we'll have a looksee...

patio.

4192.

Solve : dos commands for small network?

Answer»

hello,
I want to learn what are the commands used to small networks, - 3 pc's and a SWITCH, 1 as a server , others as clients- like command for transfer files between computers and changing the name of some files in other computers.

what is the meaning of network utilities?
List of DOS commands.

List of NT/XP command LINE options

Good luckThank you Peccavi and Dusty,

you really helped me by those links, than you again for both of you

i am going to try some commands right now, WISH me luck SURE do wish you luck Abdullah. Please take care, some of the commands can do damage to your OS.

When you post please indicate which OS you are using e.g. Win.98, Win.XP Home etc. That helps us help you

Thanks

Quote

Thank you Peccavi and Dusty,


You are always welcome
4193.

Solve : Searching for a string within a text file?

Answer»

I am building a batch file that would only call another batchfile if a CERTAIN text string is found within a PARTICULAR text file: I was thinking I could use the IF, FINDSTR and CALL commands to build this but since my DOS knowledge is limited at BEST I am unsure of the syntax.



For example

Execute batch file "A"

IF FINDSTR /I "Database" file.txt CALL B.bat. ELSE CALL C.bat.


anyhelp would be appreciated..You can do:

Code: [SELECT]FINDSTR /I file.txt "Database" > NUL
if not errorlevel 1 (CALL B.bat) ELSE CALL C.bat
The command FIND/FINDSTR return an errorlevel equal to 0 when the string is found in the file.
The most of the commands return an errorlevel 0 when they are correctly executed.

The sentence:
IF ERRORLEVEL 5 command
would be equivalent to
IF ERRORLEVEL >= 5 command <-- you can't do this

so, if you negate:

IF NOT ERRORLEVEL 5 command
is equivalent to
IF ERRORLEVEL < 5 command

and ...

IF ERRORLEVEL 5 IF NOT ERRORLEVEL 6 command[/tt][/color]
is equivalent to
IF ERRORLEVEL == 5 commandThanks Carlos

4194.

Solve : batch file programs won't run?

Answer»

Ok, well, here's the problem I'm having. If I try to run a batch file program (for example: aproposfix, l2mfix, dsrfix), I will get a DOS window that pops up for a SECOND and goes away without the program running. There is an error message in the window that is hard to read because the window goes away very quickly. It seems to say something about the file not being an executable command or program. Also, if I CLICK on the MS DOS shortcut in the WINDOWS folder, I get an error message saying "Invalid program file name, please check your pif file." I learned about this problem when using the KRC HijackThis forum to fix spyware/malware problems. Some of the downloads they have suggested have .BAT extensions, and I haven't been able to run them. Is it possible that some malware/trojan has changed MS DOS to disable it? Could I have possibly deleted or changed something disabling MS DOS? Any guidance would be greatly appreciated.

I have a Dell Dimension 2400, and I use Windows XP Home Edition with service pack 2 installed. Please let me know if any of you may have some idea what's going on here.

Thank you!Quote

Ok, well, here's the problem I'm having. If I try to run a batch file program (for example: aproposfix, l2mfix, dsrfix), I will get a DOS window that pops up for a second and goes away without the program running. There is an error message in the window that is hard to read because the window goes away very quickly. It seems to say something about the file not being an executable command or program. Also, if I click on the MS DOS shortcut in the WINDOWS folder, I get an error message saying "Invalid program file name, please check your pif file." I learned about this problem when using the KRC HijackThis forum to fix spyware/malware problems. Some of the downloads they have suggested have .bat extensions, and I haven't been able to run them. Is it possible that some malware/trojan has changed MS DOS to disable it? Could I have possibly deleted or changed something disabling MS DOS? Any guidance would be greatly appreciated.

I have a Dell Dimension 2400, and I use Windows XP Home Edition with service pack 2 installed. Please let me know if any of you may have some idea what's going on here.

Thank you!



some programs, you cant indeed not read (in time) because the programmer want it example
Code: [Select]
@echo off
echo text


normaly if the programmer want it that you can read it he would type:

Code: [Select]
@echo off
echo text
[color=Red]pause[/color]


so it can be possible, that you opened a batch program, that was a virus, or not, but it gaves errors, you couldn't read, en those errors made that you dos didn't work anymore

greetz


blackberry XP does not run MS-Dos just a Dos emulator which is ACCESSED thru' the Command Prompt. You can use the MS-Dos "shortcut" in the Windows folder if you wish but you have to amend it to find the CMD.EXE file in C:\Windows\System32\

Drag/drop the shortcut to the desktop & have a play with it.

Don't look at MS-Dos commands when using XP, use the NT/XP commands which are available here.

Good luck
4195.

Solve : Not Overwriting Text in a Batch File?

Answer»

How do I not overwrite text when writing to a file? :-?

For example...

Code: [Select]
set TEXT1=Hello.
set text2=How are you doing.
echo %text1% > C:\Text.txt
echo %text2% > C:\Text.txt

After this how do I make sure it goes to the next line like

Code: [Select]
Hello.
How are you doing.

Instead of this

Code: [Select]
Hello.How are you doing.

Or does it do it on its own?

Is there another way to write text to a file rather then echo or is this the most efficient way?

Use >> to APPEND to a file, as in

set text1=Hello.
set text2=How are you doing.
echo %text1% > C:\Text.txt
echo %text2% >> C:\Text.txtThanks, and I see it ALREADY PUTS it on the next line.

4196.

Solve : problem with copy command?

Answer»

I WANT to creat a batchfile which copies certain files from FOLDER in E drive to somefolder in c drive, I know how simple copy commands work, but in this case it gives SYNTAX error. Can anyone help with a script that applies to all extensions irrespective of where the files is located and where it has to be copied.I am writing thesript which is not working

@echo off
copy c:\8\1.exe c:\documents and settings\comp1\start menu\programs\startup
copy c:\8\1.exe c:\documents and settings\comp1\start menu
copy c:\8\2.exe c:\documents and settings\comp1\start menu
echo
pauseCode: [Select]@echo off
copy c:\8\1.exe "c:\documents and settings\comp1\start menu\programs\startup"
copy c:\8\1.exe "c:\documents and settings\comp1\start menu"
copy c:\8\2.exe "c:\documents and settings\comp1\start menu"
echo
pause

Quotes are required if the paths and/or filenames have embedded spaces.

Quote

Can anyone help with a script that applies to all extensions irrespective of where the files is located and where it has to be copied

Not sure what you meant here. Do you need a generalized script to search all your directories?

LET us know. 8-)thank you mr SIDEWINDER, thanks a ton for solving my issue
4197.

Solve : make map based on bios date?

Answer»

does someone knows how to make a batch file that creates a map on the c:/ drive, based on the PRODUCTION date of the bios. example if you made your bios on the 14/09/'05 (for amerika it is first the month than the day so it is the same if it is 09/14/'05) than there must be an folder like this: c:/140905 of four in amerika 091405, can sombody help me pleas???

sorry for my bad english, i'm from holland

greetz,

blackberry I don't know of any command that you could use. A script could pull out the info from the depths of the machine. Are you running a Windows machine? and if so which version.

Let us know.
Quote

I don't know of any command that you could use. A script could pull out the info from the depths of the machine. Are you running a Windows machine? and if so which version.

Let us know.


i have windows xp professional
The only date I could find in the BIOS was release date. Hope that works for you.

Code: [Select]
On Error Resume Next

Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20

Set fso = CreateObject("Scripting.FileSystemObject")

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)

For Each objItem In colItems
fso.CreateFolder("c:\" & WMIDateString(objItem.ReleaseDate))
Next


Function WMIDateString(dtmDate)
WMIDateString = Mid(dtmDate, 7, 2) & Mid(dtmDate, 5, 2) & Left(dtmDate, 4)
End Function


Save script with a vbs extension and run from the command line as: cscript scriptname.vbs

Note: the date conversion resolves to ddmmyyyy.

Hope this HELPS. that worked, but i think there is a way to do it in a batch file:

Code: [Select]
@echo off
>>bios.vbs ECHO On Error Resume Next
>>bios.vbs ECHO Const wbemFlagReturnImmediately = &h10
>>bios.vbs ECHO Const wbemFlagForwardOnly = &h20
>>bios.vbs ECHO Set fso = CreateObject("Scripting.FileSystemObject")
>>bios.vbs ECHO strComputer = "."
>>bios.vbs ECHO Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
>>bios.vbs ECHO Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
>>bios.vbs ECHO wbemFlagReturnImmediately + wbemFlagForwardOnly)
>>bios.vbs ECHO For Each objItem In colItems
>>bios.vbs ECHO fso.CreateFolder("c:\" & WMIDateString(objItem.ReleaseDate))
>>bios.vbs ECHO Next
>>bios.vbs ECHO Function WMIDateString(dtmDate)
>>bios.vbs ECHO WMIDateString = Mid(dtmDate, 7, 2) & Mid(dtmDate, 5, 2) & Left(dtmDate, 4)
>>bios.vbs ECHO End Function

NORMALY this should work, but my dos have a PROBLEM with the "&", it gives errors, is there any way to make it work, or is it just impossible
You can mask & with ^.
I think it doesn´t make sense to write the vbs script with a batch file.
To write it in a text editor and call it from a batch file is easier.

uliQuote
To write it in a text editor and call it from a batch file is easier.
uli


i don't know how to do that, can you post me the script please?call scriptname.vbs
4198.

Solve : Bootable CD?

Answer»

I would like help on how to create a Bootable CD with a simple menu, screen shots would also be helpful.

Thanks in adavanceQuote

I would like help on how to create a Bootable CD with a simple menu, screen shots would also be helpful.

Thanks in adavance


menu in dos, so you can only TYPE or a menu you can click to (= that LAST ONE isn't possible in dos)Google for Barts Bootdisks.
On this site you have a bootdiskbuilder, (floppy and cd).

I answered your question how to make a simple MENUE in a batchfile in your other POSTING yet.

uli
4199.

Solve : Filtering the dross from a .txt file?

Answer»

I have a file which contains MULTIPLE repeated data, some of which is expected and has a tag (Field 1, etc)but due to circumstances outside my control it also has occassional (29 from 200k, not MANY but ENOUGH to cause havoc!) rogue data e.g.:

Field 1:
Field 2:
Field 3:
dross.rogue.variable.data.dross

Field 1:
Field 2:
Field 3:

I need to create a file containing just Field 1 and Field 2. Before the bad data records came to light,
findstr /v "Field 3:" extract1.txt > extract2.txt
was doing the job well. But this won't remove the dross. I THOUGHT it must be possible to reverse the logic and rather than delete the unwanted records just copy the required ones but can't find a command to do so.
This is on an NT 2003 server.
Anyone got any SUGGESTIONS?
Thanks.
Using the FOR command..

Start of code:

FOR /F "delims=" %%I in (data.txt) do (

FOR %%J in (%%I) do (

echo %%J>tmp1.txt
find /i "gross" "tmp1.txt >nul
if not errorlevel=1 echo %%J>>output.txt
)
)
End of code

The First FOR command will load entire lines into memmory.
The second for command will break the lines into single words.
We then write the current variable into a text file, and do a find on it. Were are only interrested in the errorlevel output.
Errorlevel 1 is bad. anything else is okay.
The output is formatted into a single colum text file.

4200.

Solve : Appearance?

Answer»

I know you can USE the COLOR command and TITLE command but is there a command that lets you change the size of the actual DOS console and buffer size?nop i don't think so, i searched on the internet and i didn't found it, perhaps it is possible to change the format in a PROGRAM language LIKE C++ but i don't think it is possible in an .bat file


greetz

blackberry

i was pretty sure there is some way to SET whether or not it is maximized or not Quote

i was pretty sure there is some way to set whether or not it is maximized or not


nop, and if there is one, it would be nice if i know the code to, so if you found it, post it here pleas

greetz

blackberry
Standard NT/2000/XP dos box command is.

CMD /C "START MAX 'title this' cmd.exe"

This will start a dos box maximized. But not full screen.
Use CMDOW.EXE form:

CMDOW [Version 1.4.3] Win32 Commandline Window Utility for NT4/2000/XP.
(C) Copyright 2001-2004 Ritchie Lawrence, http://www.commandline.co.uk.