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.

8301.

Solve : Printing to a Print Server??

Answer»

Hello all.

I have been testing my print command here at HOME on my network and everything works fine.

When I installed the application on the client machine the printers are not declared on the server itself, but rather handled thru a Print server. For some reason I cannot print to a printer thru the server even if I specify the Print server as in the following example, any suggestions?

print /d:\\SRV-PRINTERS\PRN-ENCM MyFile.txt

KenTry to authenticate for permissions first like using RUNAS etc, but ((( This is a security vulnerability having the credentials in a BATCH ))) If it MUST be in a batch, I'd complile it to an EXE for an extra layer of security, although still not very safe from determined individuals.

8302.

Solve : add in batch?

Answer»

It's possible to make bat program wich will add the numbers to each other in loop??
like a calc "1+1=2 2+1=3 3+1=4" etc??
Welcome to the CH forums.

Please read this.

Assuming your OS is XP see the SET /A switch (enter set /? at the Command Prompt)

e.g.
set /a number=%number%+1 (for ADDITION)
set /a number=%number%*10 (for multiplication)

See the set /? display for other permitted arithmetic operations and their precedence.

Good luck

sry for minimal information
im using vista but it works exelent
thx dudeTrivia: When Xcopy is used to copy a particular file, that file is REWRITTEN and defragged simultaneous. Xcopy doesn't take LONG, but it sure TAKES a long time defragging this way. True or just kidding. Who would kid around about a very serious subject like Xcopy

LOL again and again....

8303.

Solve : Please Help with Batch File to Delete Profiles?

Answer»

Hello Everyone,

I am trying to write a .bat that I can set to delete profiles in
c:\DOCUMENTS and settings. I want to be able to delete all profiles, except five of them. I am HOWEVER under the impression that you can't select files to not delete, so as a work around I have copied them out to a TEMP folder, then running the DEL /q /s but it's not working. Is there something that I am missing?

Here is my file:

cd c:\

REM Creating the directories to copy the profiles into.

mkdir c:\Temp_Prof
mkdir "c:\Temp_Prof\All Users"
mkdir "c:\Temp_Prof\Default User"
mkdir c:\Temp_Prof\ms-admin
mkdir c:\Temp_Prof\ms-libtech
mkdir c:\Temp_Prof\ms-faculty

REM Xcopying the profiles to the temp folders created above.

cd c:\documents and settings
xcopy "all Users" "c:\Temp_Prof\All Users" /m /e /v /c /h /k /y /x
xcopy "Default User" "c:\Temp_Prof\Default User" /m /e /v /c /h /k /y /x
xcopy ms-admin c:\Temp_Prof\ms-admin /m /e /v /c /h /k /y /x
xcopy ms-libtech c:\Temp_Prof\ms-libtech /m /e /v /c /h /k /y /x
xcopy ms-faculty c:\Temp_Prof\ms-faculty /m /e /v /c /h /k /y /x

REM DELETING profiles in Documents and settings.

del /q /s *.*

REM Recreating profile folders in Documents and Settings.

mkdir "c:\documents and settings\All Users"
mkdir "c:\documents and settings\Default User"
mkdir c:\documents and settings\ms-admin
mkdir c:\documents and settings\ms-libtech
mkdir c:\documents and settings\ms-faculty

REM Copying files from the temporary folders back to the proper profiles.

cd c:\Temp_Prof
xcopy "all Users" "c:\documents and settings\All Users" /m /e /v /c /h /k /y /x
xcopy "Default User" "c:\documents and settings\Default User" /m /e /v /c /h /k /y /x
xcopy ms-admin "c:\documents and settings\ms-admin" /m /e /v /c /h /k /y /x
xcopy ms-libtech "c:\documents and settings\ms-libtech" /m /e /v /c /h /k /y /x
xcopy ms-faculty "c:\documents and settings\ms-faculty" /m /e /v /c /h /k /y /x

REM Deleting c:\Temp_Prof and its contents

rmdir /s /q c:\Temp_Prof



Thank you to anyone that can offer any help.

8304.

Solve : DOS/Command Line file reading capabilities.?

Answer»

Hello all,

I have been tasked with finding out who has a file locked. Sounds RELATIVELY SIMPLE, but there are many interesting variables involved.

So far, we are using a dBASE 5 for DOS program that is definitely LEGACY. There are functions within dBASE that need to lock a file exclusive. Which means that only the user within the dBASE environment that has the file locked can use it.

What I was wondering, is if DOS (or now the command line) is able to read that file that is locked by dBASE. The locked file has information on which workstation locked the file and that is what I am trying to access.

Thanks,
MattYou MIGHT find this useful (although it refers to DB4, it may well be COMPATIBLE)
http://www.clicketyclick.dk/databases/xbase/format/rec_lock.html
Graham

8305.

Solve : List of service's name, script to manage services ??

Answer»

Hello,
1. From this COMMAND output: SC query state= all

.....
SERVICE_NAME: WPDBusEnum
DISPLAY_NAME: Service Énumérateur d'appareil mobile
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

SERVICE_NAME: wuauserv
DISPLAY_NAME: Windows Update
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
.....

is there a way to get only the DISPLAY_NAME value and SERVICE_NAME value (both on 1 line) ?

.....
Service Énumérateur d'appareil mobileWPDBusEnum
Windows Updatewuauserv
....

Maybe, using a temp. file: SC QUERY state= all>"allSrv.txt"

1.a. Is SERVICE_NAME the name used with the commands "NET START" or "NET STOP" ?
1.b. Is this list the same as this ONE: Start > Run > services.msc ?

Then I'll build a MngServices.bat script to manage services I would stop. Example:
MngServices.bat

NET STOP stisvc
NET STOP CryptSvc
NET STOP Themes

2. How should I use this script MngServices.bat ?
2.a. Should I run this script once or for each Windows start ?
2.b. In the second case, what is the best way to run the script at Windows start ?

Thanks
CONFIG: MS Windows Vistahere's a vbscript
Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colRunningServices = objWMIService.ExecQuery("Select * from Win32_Service")

For Each objService in colRunningServices
Wscript.Echo objService.DisplayName & VbTab & objService.Name
Next
usage: save as myscript.vbs, and on command line, type in
cscript /nologo myscript.vbs

8306.

Solve : scheduling a bat execution problem?

Answer»

I built a bat FILE in dos to copy all my documents on the desktop to my backup drive. I want to SCHEDULE the bat to run every day at 7:00pm. I set it up in XP "schedule task" but it fails with a "the scheduled tasks did not run because an incorrect password or user name was entered" . I built the scheduled task with a password and without and still get the same error.

1. Am I going about this problem the EASIEST way? (bat file and scheduled tasks)
2. If so then whats this error mean?

Thanks
Sounds LIKE the problem might lie with your backup destination. Where are you attempting to backup your files?Nevermind, I found it on the on Microsoft web site. You can't have a blank password on your user acct. I fixed it and its now its works.

8307.

Solve : Finding an .exe within multiple directories?

Answer»

Hello all!

I'm wanting to create a batch file that will search for a specific .EXE and run it once it finds it.

For instance:

e:
cd\winnt
setupnw.exe/acu/u:e:\winnt\unattend.txt

Where the "/acu/u:e:\winnt\unattend.txt" is a way to run the setup with the settings in the unattend.txt file. So, in theory, if setupnw.exe was always within the directory e:\winnt, I wouldnt have this PROBLEM, and with limited knowledge of DOS, I wouldnt even know where to begin.

In all, I'm wanting DOS to search through C:, D:, E: etc until it finds the setupnw.exe, then run the setup.exe/acu/u:x:\winnt\unattend.txt where x: is the drive it found the setupnw.exe on.

Thanks in advance!



This wouldn't be the first time I made a stab at something I really don't understand. Searching disks with batch language is LABOR intensive. This little snippet may run a while.

Code: [Select]@echo off
for /f "tokens=3" %%i in ('echo list volume ^| diskpart ^| find /i "partition"') do (
for /f "tokens=* delims=" %%x in ('dir %%i:\ /s /b ^| find /i "setupnw.exe"') do (
if errorlevel 1 setup.exe/acu/u:%%~dx:\winnt\unattend.txt
)
)

Good luck. lol. Indeed!

Well, this could be an easier way to do it.

Is there a way of instead of searching the directories, to default the "x:" drive to where ever the batch file was ran from?

For instance, if the batch file was ran from "e:\winnt" that it'd run:

e:
cd\winnt\
setupnw.exe/acu/u:e:\winnt\unattend.txt

Or if the batch file was ran from the "f:\winnt" that it'd run:

f:
cd\winnt\
setupnw.exe/acu/u:f:\winnt\unattend.txt

Only reason I hesitate to use yours is that we do have some network DRIVES, and depending on the department they're in, it could take a long long time

Thanks!I still don't fully understand the question, but now that I'm knee deep in it, I'll just continue on. You can derive the drive from this: SET drive=%cd:~0,2%

Seems logical you could simply replace the drive letter with the variable:

setupnw.exe/acu/u:%drive%\winnt\unattend.txt

Let us know how it goes.

Note: this could work from the command line unless the setupnw.exe was found in a directory on the path and not in the current directory. If run from a shortcut, results could be unpredictable.Right on the money.

A big internet man-hug goes out to you good sir!

8308.

Solve : DOS command in XP to remember prior entry RESOLVED?

Answer»

Hi,

What is the command to make DOS in XP remember the last entry? Used to be able to ping xxx.xxx.xxx.xxx
and then hit a key to reenter the same command.

Thans,
JoeI believe it's the up key to recall the last command you entered.You may need to type doskey in the command prompt
Then you can use the up arrow or F3 for your last entry

For more info see
https://www.microsoft.com.nsatc.net/resources/documentation/windows/xp/all/proddocs/en-us/doskey.mspx?mfr=trueHi Panda25,

Thanks for the quick response and great info!

Thanks,
Joe
PS WOULD you happen to know why SYMANTEC Internet Security 2008 can be CONFIGURED to see/share all three comuters on my network, but I can't ping any of them? Hi TheManFrom,

Thanks for the quick response and info. How do I indicate this ISSUE is now resolved?

Thanks,
JoeYou're welcome, Joe.
Sorry but I don't really know much about any of the Symantec products. You may want to POST another question and see if anyone else can help you with that.
As far as saying the issue is resolved, you can edit the subject line to say resolved.
Brenda

8309.

Solve : find a moving files?

Answer»

in ms batch im trying to find all MP3 files on thew hard drive and then move them to a folder, not copy. or if copy then delete the original afterwardsQuote from: djbenny on December 04, 2007, 05:25:58 AM

in ms batch im trying to find all mp3 files on thew hard drive and then move them to a folder, not copy. or if copy then delete the original afterwards

If it is absolutely necessary to do it from the command line, using only commands that are available there, then someone will probably be along shortly to advise you. In the meantime, answer this: Are you using WinXP? if not, then what?


If you just want to get the job done from the command line, it is possible to use a VERY handy third party utility program.
Free. (uncrippled shareware)
I've used it under MS-DOS, a dos WINDOW in OS/2, and dos windows in Win98. I BELIEVE it will work in a 'dos' window in XP.
Fast File Finder (FFF)
http://www.pcworld.com/downloads/file/fid,3771-order,1-page,1-c,alldownloads/description.html
can be downloaded here.

You will need to unzip it.
Put it in a directory that is in your path, so you can run it on the command line from any directory.
It is VERY easy to use.
In your example, fff *.mp3 would quickly find them all, and present you with a menu. From there, you can elect to copy or move them.
There are LOTS of other options too.

I LIKE to keep a copy of this program on my computer, in the path. Sometimes it is just very handy to have it available when you want one of its functions.

I hope this helps.

8310.

Solve : typing in a BASIC program to run in XP?

Answer»

I have a BASIC program I wrote in 1987 to run on an Apple IIE that I now want to run on my Gateway with XP. I do not REMEMBER how to enter the program and SAVE it to run.
You'll find that most versions of the Basic LANGUAGE can be found on the WWW. There are also offshoots like FreeBasic etc.

I suggest you look for QBasic 4.5 which, tho' not be latest, is recognized by most enthusiasts as the greatest version of the Basic family.

BTW there are some drawbacks in using any version of Basic with XP, such as the COM and Parallel ports being very difficult to access without using third party utilities.

Good luck

8311.

Solve : Script to stop Windows services?

Answer»

This script provides the RESULT below.

Code: [Select]::Customize this list of services
SET Services2STOP=ALG BITS WZCSVC

FOR /f "Tokens=1,2 Delims=:" %%r IN ('"SC QUERY state= all"') DO (
IF /i "%%r"=="SERVICE_NAME" (
FOR %%f in (%Services2STOP%) DO (
IF /i " %%f"=="%%s" (
ECHO.SC STOP%%s
SC GETDISPLAYNAME %%s
)
)
)
)
Pause &EXIT
Code: [Select]SC STOP ALG
[SC] GetServiceDisplayName SUCCESS Name = Service de la PASSERELLE de la couche
Application
SC STOP BITS
[SC] GetServiceDisplayName SUCCESS Name = Service de transfert intelligent en a
rriÞre-plan
SC STOP WZCSVC
[SC] GetServiceDisplayName SUCCESS Name = CONFIGURATION automatique sans fil



1. How to avoid (not display) this: "[SC] GetServiceDisplayName SUCCESS Name = " ?
2. Which command is better to stop a service:
NET STOP service_name
SC STOP service_name
3. This script should be executed once or at each Windows startup ?
ThanksUnless I missed something, this script doesn't do a whole lot.

1. How to avoid (not display) this: "[SC] GetServiceDisplayName SUCCESS Name = " ?

Eliminate the SC GETDISPLAYNAME %%s line

2. Which command is better to stop a service:

SC communicates with both the Registry and Service Database

3. This script should be executed once or at each Windows startup ?

Try using SC CONFIG to change how a service starts up; To run at EVERY boot, put script in startup folder



Curious about something: why not use the services snapin (services.msc) and stop the services directly? It would only need be done once instead of every boot.

Just asking: I trust you researched these services to see check the consequences of turning them off.

8312.

Solve : batch command prompt?

Answer»

Hi, I need LITTLE HELP to know how to HIDE the execution of a prompt command
Please, it's very urgent
Can you clarify.

Do you mean output of the command "prompt"OK, I have a bat command file executing another command in Python command line, I need to hide the Python command prompt.
thanks for help and supporting

8313.

Solve : DIR on remote computers?

Answer»

Hey all, I'm trying to use the CMD command DIR to see the contents of a remote computer (i.e. \\PC01) CONNECTED via LAN (on the same server).

Right now, just typing, for EXAMPLE, dir \\PC01 yields no results (The filename, directory name, or volume LABEL syntax is incorrect). However, typing a specific path (i.e. "\\PC01\My Documents") does show the contents.

So, is there any way (short of using net view \\PC01 and parsing the share name) to view the entire contents (with /s, of course) of a remote computer, either through dir or another command?


Thanks.
--Dark BladeTo enumerate everything on the c drive try
dir /s \\pc01\c$


alternativly you COULD run the dir command using psexec by sysinternals (now microsoft )
http://www.microsoft.com/technet/sysinternals/utilities/psexec.mspx

Hope that helps

8314.

Solve : Help with AT command?

Answer»

Hello,

I've created a batch file that uses the AT command to create a scheduled task. The scheduled task will start a program like Yahoo messenger. The problem is that when ran, the scheduled task starts the program "silently". What I mean is that the process starts, but it does not load in the tray nor does it open a window. The only way to actually use the program is to kill the process then restart manually.

What do I NEED to do different? The command looks like the following.

AT %NewTime% "C:\Program Files\Yahoo!\Messenger\YahooMessenger.exe"

NewTime is a VARIABLE that is previously DEFINED in the batch file.

I am running XP sp2.0

Thank you,

CraigI ANSWERED my own question

I needed to use the /interactive switch. The new command looks like:

AT %NewTime% /INTERACTIVE "C:\DelayedStartup.bat"

Craig
OK, another question. When the Scheduled task runs (it starts a couple PROGRAMS) it runs with the user as NTAUTHORITY/SYSTEM. How can I specify a user...or can I?

Thanks,

CraigInstead of the AT commands, use SCHTASKS, with this you can specify a user.Thank you...

That helped. Do you know how to set the Start in: value when creating the task?

Craig

8315.

Solve : How do I lock a computer in DOS??

Answer»

We've done this before, I have forgotten how to do it and my husband knows, but basically won't set it up for us to do this again. You see, he is a stay at home dad, with ADHD, who SPENDS 8 hours a day on the computer searching the MILLIONS of webistes available on a single topic to fill his time. Meanwhile, our house has been in remodel mode for 9 years! Kids are in school all day, so this would be the time to work. I can TELL when he's been on the computer compared to when he is off - more is done, and his mood is better when he is not on it all day long.

What we did the in past what push a Function key to get in DOS mode when the computer was restarting, and then make some selections from the menu to get to the password section etc. We tried this recently, however at start up after I thought I had set the password, it bypassed it and went right into XP.

I would love to have the steps, please!

Thanks. Quote

What we did the in past what push a Function key to get in DOS mode when the computer was restarting, and then make some selections from the menu to get to the password section etc.
Are you sure this is DOS?
If you can move around the menu with the arrow keys and select options like passwords and boot devices you are probably in the computers BIOS.

What exactly do you mean by lock the computer?
Do you want it to ask for a password every time you switch it on before it loads XP?
If this is what you want to do then the password will probably have to be set from the BIOS.
If you don't remember how to do this it will be in your computers manual if it came with one and you still have it.

Re: How do I lock a computer in DOS?
« Reply #1 on: Today at 01:18:02 PM »

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

If you can move around the menu with the arrow keys and select options like passwords and boot devices you are probably in the computers BIOS.
OKAY, WHAT YOU ARE DESCRIBING SOUNDS RIGHT.

What exactly do you mean by lock the computer?
Do you want it to ask for a password every time you switch it on before it loads XP? YES SO THAT I ONLY KNOW THE PASSWORD AND CAN TURN ON THE COMPUTER IN THE EVENING
If this is what you want to do then the password will probably have to be set from the BIOS.
If you don't remember how to do this it will be in your computers manual if it came with one and you still have it. GOOD POINT, I AM NOT SURE IF WE STILL HAVE IT..... UNFORTUNATELY i can't give exact instructions as pcs BIOSs vary.

you can try looking on the internet though.
Either search for an online manual for your PC using the model no. (it should be on the PC somewhere)

Or enter the BIOS again and look for a make and version number for the BIOS itself. Search for instructions on using your particular BIOS with the make and version number. This might bring you more luck as some PCs share the same BIOSs.Thank you. This does help.
8316.

Solve : Locking Down BAT Files??

Answer»

Whats the best way to convert a bat file to an EXE or even lock a bat file down so others cant get in and mess with your code and or use the code for other things?I never understood why users would take a reasonable sized BATCH file and convert it into a bloated 10K module but that's just me.

Look for bat_to_exe_converter.exe on this page

Be aware converter PROGRAMS such as this as add load and TERMINATE routines to your code and inflate the code SIZE on magnitudes of 10 to 100.

8317.

Solve : Unable to get C: prompt?

Answer»

A little history first. This is a computer I built for my 5 year old several years ago, PC100 Systemboard motherboard, WD 80G hard drive, 128M RAM. No internet, PRINTER at this time. I installed WIN 98.

The on-board video was weak so the first thing I did was upgrade the RAM from 128 to 384. I attempted to install WIN XP but upon registering decided I wasn't going to buy a second licence. With no apparent method of uninstalling WIN XP I booted up with DOS and GOT an A: prompt. I attempted to change to C: but was unable to do so. The DIR of A: reveals nothing in the autoexec.bat and config.sys files.

I removed the hard drive and installed it in my Gateway and formatted it, non-quick format. I re-installed it and all I seem to get now is NTLDR is missing. I downloaded a the MultiTask Utility from Eddie Maintenance in an attempt to boot up from the CD Rom. After several attempts I burned the image files to a CD. I guess I need to reburn it IAW his specific directions. It currently just gives me the flashing cursor.

Any suggestions will be highly appreciated. At this point I have no IDEA how I was able to install WIN 98 the first time along with the Systemboard drivers. If I remember correctly, I booted up with a WIN 98 Startup floppy which will not work at this time.

At the A: prompt what happens if you type C: and hit Enter ? ?
If you formatted it NTFS on the Gateway it will not be recognised.
If C: shows up after trying the above then type format C: /U and hit Enter.
You should now be able to proceed.you need to re-partition the drive again. with Win98 Fdisk. it is on the startup floppy. first delete all partitions and CREATE one new one. then reboot with the floppy again and then format C: /s optionally since the win98 boot floppy has CD support just do D:\setup with win98 cd in CD-ROM drive to install win98. it'll notice the unformatted drive and ask if you want to format it some point before install.

8318.

Solve : keystrokes?

Answer»

i'm KIND of new to this,so bear with me. When I hit ENTER in the DOS program i get a log-in prompt... problem. It will not let me enter any key strokes to log-inYou need to be more specific so people know what you need help with.

8319.

Solve : NON SYSTEM DISK OR DISK ERROR?

Answer»

halo everyone

My problem is...I started to image a HARD disk and that hard disk CONTAINS two OS..
the QNix and the DOS..
When I copy the DOS using xcopy C: D: /s command it was shown in the directory that all files were copied...but when I boot it up it was NON system disk or disk error...

The qnix OS is working...only the DOS has a problem..

Is there someone who can help me...


Thanksxcopy C: D: /s /h

Try it again with the /H switch to grab hidden system filesYou cannot simply copy an OS and expect it to run...won't work.
You could try this but no guarantees:
Place the first DOS FLOPPY in and at the prompt type sys\D: and hit Enter
Then see if it will boot but i doubt it.that's right XCOPY will help you move files, but the IO.SYS and MSDOS.SYS (or IBMBIO.COM and IBMDOS.COM) files must be located in the right location on the disk. you just need to run SYS from a floppy with that version of DOS installed ONTO the drive in question, as stated above.

8320.

Solve : i need to save my data quick xp is dead only command prompt?

Answer»

my lap TOP crashed>>> hp compaq nx9010 windows xp home,
TOOK to geek squad no luck. called 4byte4 no luck. used xp setup disk and it won't REPAIR. i do have a command prompt but couldn't tell you if THATS good or bad. i don't know much about dos.
please HELP. just got external wester digital 360 g hard drive would love to copy all to it. is that possible thru dos? Welcome to the CH forums.

Can you give details of the 'crash', was an onscreen error message displayed? Are you sure you are at the Command Prompt? What is on your screen after booting?

Does the start up show command prompt, and are you sure.

Type assoc to see all your files if I am right.

8321.

Solve : Need MS-DoS/Command Promt Script to Lock folders?

Answer» NEED MS-DoS/Command PROMT SCRIPT to LOCK FOLDERS
8322.

Solve : Dual booting with multiple versions of DOS and Win98se?

Answer»

Does anyone know how or know where to learn how to setup a dual boot with MS-DOS 1.1, MS-DOS 2.2, MS-DOS 4.1, MS-DOS 6.22 and Win 1.1, Win 3.1, and Win 98se?
Would you use a batch file to create a MENU ?

HALP!I haven't done a lot of research on your query but I don't think that being able to select which version of Dos to boot is possible. The second and subsequent versions installed would simply overwrite the Master Boot Record for the previous version. In the days of Dos supremacy it was probably not thought that anyone would want an old and new version on the same system.

Win 1.1/3.1 requires that a Dos version be installed before Win can be installed so the same holds good for that one.

Someone with greater knowledge than I have may know of a workaround.

Good luck

Thanks for replying!

Would you happen to know where I could get an early-version-of-DOS boot disk? Like around DOS 1.1 or something?Quote from: Eniac1o1 on December 10, 2007, 06:05:56 PM

Thanks for replying!

Would you happen to know where I could get an early-version-of-DOS boot disk? Like around DOS 1.1 or something?

Check out:
http://oldfiles.org.uk/powerload/bootdisk.htm

You might also like to browse:
http://oldfiles.org.uk/powerload/msdos.htm
After you decide on how many/which versions you want to install we can better advise...Thank-you to WillyW, I actually have that site bookmarked on my browser but hadn't thought to look there.


To patio, Thank-you for the support, I haven't got a definite list yet but I will get back to you with in the next week or two. As the main man would say...we'll leave the light on.I'm not sure about 98, but I know Windows 2000 and XP and so forth automatically enable dual-booting when installed on separate PARTITIONS. Right now my C:\ hosts DOS 7.1 and a WfWg 3.11 installation and F:\ has W2k. But if the computer is too old to even install these at all then that solution won't work...


There is another problem, at least for certain DOS versions. Unfortunately, DOS 1.1 does not support hard disks at all. That is, the DRIVE letter for any HD's likely will not appear. DOS 2.0 was the first one to support HD's, with HUGE drives up to 10 or 20MB . So if you do a dual-booting, or, tri-booting, etc... scenario, DOS 1.0 might not me applicable. DOS 2.0 will just need to reside on a teensy partition, keeping in mind that partitions larger then 10 or 20 Megs might not be visible. a Example Partitioning scheme might look like this:


let's say you have say a, err, 4GB drive.

20MB C:\ with DOS 2.0
32MB D:\ with DOS 3.11 (I think that is the highest amount that version supports...)
<4.0 omitted due to possible drive corruption....>
2GB E: with DOS 6.0. This can serve as a base in which you can install the versions of windows you desire, just make sure to put them in separate directories.

Also, to ensure you get a selection screen with this config you will need either Win2K, WinXP, or one of those Linux CDs. I wouldn't be able to help with that last one, but I know of an easy way you can get the boot loader portion on the disk without necessarily installing (well, keeping it installed) the OS:

the config could take a while, but here's a quick run-down.

First make sure you have EVERYTHING you need. at once. some of these steps are necessary, and installing stuff out of sequence could be messy.

-First, you need to repartition the drive of course. DOn't use the DOS 2.0 Fdisk.com, use a newer version. DOS 6.0 or DOS 7.1 (if you can find it...) version would be best.
Make a primary partition, (for DOS 2 in this case), and then an extended partition that consumes all the rest of the space (trust me on this one....)

-then, select the option to create logical drive letters in the extended partition. Go nuts here, make one for each OS you wish to install. If you have a big enough drive, make sure to leave room for whatever OS you will use to provide the boot screen.(W2k, XP)

-once you have them partitioned, ready your newer DOS boot disk (not 2.0, at least not yet...)

-format each partition. when formatting, you could plop a /s on the command for the drive that will contain DOS 6 and windows and so forth. not necessary though.

-now reboot again, with the older dos disk. you could try to prove me wrong about DOS 1.1 not seeing drives, but I'm not holding my breath . Anyway, get say DOS 2 up with the floppy, and then SYS C: with it. Remember to Copy Command.com over there to. Older versions don't take the liberty for you.

-now, for each DOS version you want to put each drive, use a boot disk from that particular DOS to SYS (or format /s) the drive in question. Note that using this method, if you need to (read, DOS 5 and 6) the DOS version, you can, but it is tricky:

See, the Installer will probably rewrite the boot code on C:\. That would be the DOS 2.0 code there. so then when you reboot onto C:\, you'll be in the newer dos again! even though you say E:\DOS as the folder! So you need to do this-

Reboot onto C:\ (now DOS 5, 6 or whatever new ver).

do a quick SYS of the drive that ACTUALLY contains this version of DOS. make sure to specify for example E:\DOS\SYS.COM so you run the right version.

reboot AGAIN onto the DOS 2 boot disk, and then reformat the C:\ drive AGAIN with /s (if DOS 2.0 has sys.com though, do that. I'm not sure if it does though....)


you'll need to repeat this Install->Sys the right drive->re-sys first drive for each DOS installer you run. major pain. but what do you expect ?

once (if ever) you finally get these all sysed (at the moment you cannot boot into any of them but C:\, but watch and learn.

If you are using W2K or XP as the boot loader, your free. Just install the OS onto a unused drive, and presto! you have a dual boot between DOS 2 and XP. hey! where are the others?

to get the others to work, you'll need to fiddle with boot.ini- it might look like this, and will be a hidden file in C:\.

[boot loader]
timeout=30
default=C:\
[operating systems]
multi(0)disk(0)rdisk(1)partition(5)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
C:\="Previous Version of MS-DOS"


notice the exclusion of any reference to D:\,E:\ or F:\. or whatever other drives you defined. the trick is simple! assuming you sysed them right, just add another line for each Drive as shown with "Previous version of MS-DOS"

After your done, it might look like this:


[boot loader]
timeout=30
default=C:\
[operating systems]
multi(0)disk(0)rdisk(1)partition(5)\WINNT="Microsoft Windows 2000 Professional" /fastdetect
C:\="MS-DOS 2.0"
D:\="MS-DOS 5.0 and Windows"
E:\="MS-DOS 6.0 and Windows"
F:\="please tell me you get the idea"


and that should do it. If you didn't want Windows 2K or XP at this point, you could simply delete the partition it was on and remove the line from boot.ini that references it.


Woops. I guess I got a bit verbose there. Guess I wanted to make sure to myself I understood the semantics involved.

Also can't be sure it would work, since this is just off the top of my head. (I SWEAR!)
8323.

Solve : Surround a variable with double quotes in a FOR loop ???

Answer»

Hello,
In some rare case the SERVICE_NAME contains spaces, like:
Ati External Event Utility

So, I have to surround this SERVICE_NAME with double quotes, like:

CODE: [SELECT]sc QC "Ati External Event Utility"

In my script, in the 2nd FOR LOOP, how can I surround this variable %%s with double quotes?

Code: [Select]SET z=.\SrvBKUP.LOG
TYPE NUL>"%z%"
FOR /f "Tokens=1,2 Delims=:" %%r IN ('"SC QUERY state= all"') DO (
IF /i "%%r"=="SERVICE_NAME" (
FOR /F "SKIP=3 Tokens=1,3 Delims=: " %%a in ('"SC QC %%s"') DO (
IF /i "%%a"=="START_TYPE" (ECHO%%s:%%b)
)
)
)>>"%z%"
"%z%"

This:
Code: [Select]FOR /F "usebackq SKIP=3 Tokens=1,3 Delims=: " %%a in (`SC QC "%%s"`) DO (
doesn't work.

Thanks

8324.

Solve : Problem with random number batch file?

Answer»

Im having problems with a batch file i created to generate a random NUMBER between 2 numbers.
This is what i have:

@echo off
:start
cls
echo Picks a Random Number
echo.
SET start=
set /P start=From:
set end=
set /p end=To:
echo.
set /a number=%random% %%%end% + %start% > nul
echo The Random Number is: %number%
echo.
echo Press any Key to Start Again..
pause > nul
goto start


It works fine most of the time but sometimes with some ranges chosen it generates a number above the RANGE. anyone GOT any ideas?For anyone interested this will produce a random number with a chosen upper and lower limit:

@echo off
echo Picks a Random Number..
echo.
set /p from=From:
set /p to=To:
echo.
set /a diff=%to% - %from% + 1
set /a number=%random% %%%diff% + %from%
echo The Random Number is: %number%

8325.

Solve : Command line for screenshot?

Answer»

Is there any way to use command line to capture screen/window on XP and/or VISTA?

THANK you!! I don't think so, but why would you want that? The command PROMPT window would be CAPTURED EVERY time.

8326.

Solve : if not exist bad-command?

Answer»

Hi All,

Need to create a batch job to perform the following:

  • Check if a file/multiple files exist/s
  • Size of file > 1kb
  • Creation time of file < 24hrs old

Not sure how crude such a script should be.
Any suggestions?

Cheers,
CameronHomework Hi Dusty,

Actually no (but to be that young again!)
Task was given to me by the boss, just to interupt my PCI work.
When I posted the query; thought sadly that the question might be seen as some FORM of homework.
I've not done work with timestamps or filesizes before, hence the question. And I've had my hand out of DOS scripting for a little while now.

Any help/direction appreciated.

Cheers,
CameronHeres a VBScript that will do the job
open note, copy and paste the script below, save as something.vbs
open command prompt, type: cscript something.vbs filename
where the filename is the file you want to check. This needs to include the full path.

If you want to check mulitple files, you could create a batch file which calls something.vbs for as many files as you need


'-----------------------------------------------------
Set objArgs = WScript.Arguments
If WScript.Arguments.Count < 1 Then
wscript.echo "Usage: cscript scriptname.vbs drive:\path\filename"
wscript.quit
Else
StrFile = wscript.arguments.item(0)
End if

Dim fsoFile
Set fsoFile = CreateObject("Scripting.FileSystemObject")

If fsofile.FileExists(StrFile) Then
Set objFile = fsoFile.GetFile(StrFile)

sName = objFile.Name
sCreated = objFile.DateCreated
sSize = objFile.Size

If sSize > 1024 Then'Check Size
Age = DateDiff("d", sCreated, Date())'Get Age difference
If Age > 1 Then 'Check date is greater than 1 day
wscript.echo objFile.Name
wscript.echo objFile.Size
wscript.echo objFile.DateCreated
End If
Else
wscript.echo "Not met the criteria"

End If
End If

set objfile = nothing
set fsofile = nothing
'-----------------------------------------------Many thanks TheManFrom,

Spent a few hours stumbling with the old scripting last night - sad when you forget so much of it.
Seems that to perform the task purely as a MSDOS/NT script would be a painful challenge.
Is VBScripting becoming (or is now) more the MAINSTREAM ?

Cheers,
CameronYes I think VBS is the way forward for admin tasks. DOS is GREAT but has its limitations which is where I think VBS comes in handy
Anyways GLAD I could help.is there a particular program you need to write VBscript? My school has "Object oriented Turing"
but I want to write this at home, and the computer I use at home, doesn't have internet. . .
can I just use notepad for Visual Basic? is there any ONLINE tutorials? (I forget the strings things. . .
eg.


var:String
var:name
var:pass
cls
LOOP
put "what is your username"
get name
put "what is your password
get pass
exit when pass = "wood" or pass = name
end loop

that is Turing (except with a fault in the "Var" block at top. . .
I can't seem to get that to work right. . . anyway can you write stuff like this in
NOTEPAD?? (on a 10yr old computer?? with no internet. .)

Please, these questions are important to me lol. . .VBScript is like a cut down version of visual basic and has the advantage of like dos batch file, you can simply open a text editor like notepad, add your script and instead of .bat, save the file as .vbs.
Then to run the program, from the command prompt (Start->Run->cmd) simply type: cscript name.vbs
You do no need internet however it would be handy for tutorials to learn from

It doesnt matter how old your computer is as long as you have at least windows 95 (I think thats the minimum)

As of your example above, in vbs you do not need to declare your variable (although it is best practise to always declare them )

The above in vbs would look somthing like

Code: [Select]DO
Pass=""
pass = InputBox("Please enter your password")
Loop Until Pass="wood" or pass="name"
8327.

Solve : Greater than/Less than help?

Answer»

This is what i want my batch to do:

set var2=
set /p var2=var2:

if %var1% GTR %var2% goto ___
if %var1% LSS %var2% goto ___


var2 has to be a VARIABLE as it is set by the user each TIME the batch is run.
unfortunatley %var2% is ignored each time. What am i doing wrong?Not sure what you mean by var2 being ignored but a COUPLE of things come to mind.

Where did var1 come from and what is it's value? What is your plan if var1 = var2?

When checking batch files it's best to leave echo on so you can see the values and how the file behaves during execution.

This isn't a complete script. var1 would come from earlier on.

As for if var1=var2 i meant to use GEQ and LSS.

What i mean by var2 being ignored is: for example if var2 was set as 10 by the user, it doesn't check if var1 is equal to or greater than 10. With echo on it looks like this: if %var1% GTR goto ___ (var2 is missing)
Therefore the line does nothing and the script continues.

I have checked and it does work if I put: if %var1% GEQ 10 goto ___.Syntactically there is nothing wrong with your code. I even tested it and it checks out fine. The place to start MONITORING the code is not the if statement, but the set /p var2 statement.

Just for laffs, what OS are you using?

This is weird. Ive just been fiddling about with different layouts/syntax etc. and my PROBLEM is fixed
The strange thing is ive been back over it and it looks the same as it did the first time i tried. Thanks for the help anyhow.

BTW OS is Vista home premium

8328.

Solve : For users on MS Windows Vista Ultimate 32 ENGLISH?

Answer» HELLO,
To apply settings from:
http://www.blackviper.com/WinVista/servicecfg.htm
using a .BAT file, I need the output from this script, to get the match
SERVICE_NAME <-> DISPLAY_NAME(English):


Code: [Select]SET z=.\%~n0.LOG
TYPE NUL>"%z%"
FOR /f "Tokens=1,2 Delims=:" %%r IN ('"SC QUERY state= all"') DO (
IF /i "%%r"=="SERVICE_NAME" (ECHO.%%s)
IF /i "%%r"=="DISPLAY_NAME" (ECHO.%%s&ECHO.----------------------------------)
)>>"%z%"

For users on MS Windows Vista Ultimate 32 ENGLISH, please, could you post in this THREAD the output of this scrip?
Thanks in advance

I'm on a MS Vista Ultimate French, (so Service Display NAME are French).
8329.

Solve : Manager of Windows service's START_TYPE setting?

Answer»

Special thanks to all of you helping me to solve some problems while I was building this script.

Here is a script to manage (show, backup, restore, config) MS Windows service's START_TYPE setting.
There are 2 METHODS to config service's START_TYPE:

- a method BASED on a file Conf.LOG containing (for example):

Code: [Select]ServiceName1:auto
Service Name 2:auto
Service_Name3:demand
Service Name4:demand
ServiceNameMNO:disable
Service Name XYZ:disable
- a method based on 3 string variables (one for each START_TYPE VALUE), where service names are SEPARATED by "/":
Code: [Select]SET sAUTO=ServiceName1/Service Name 2
SET sDEMA=Service_Name3/Service Name4
SET sDISA=ServiceNameMNO/Service Name XYZ

Some web sites helping to build your own config:
for Vista
http://www.blackviper.com/WinVista/servicecfg.htm
http://www.tweakhound.com/vista/tweakguide/page_8.htm
http://www.speedyvista.com/servicesDetail.html
for XP
http://www.blackviper.com/WinXP/servicecfg.htm
http://www.tweakhound.com/xp/xptweaks/supertweaks6.htm


Any comment, improvement, will be appreciate.
I tested this script on Windows XP Pro SP2.
Thanks and regard.

Code: [Select]::------------------------------ MANAGER For Windows Service's START_TYPE - v1.0
@ECHO OFF &SETLOCAL &CD /D "%~DP1"
@SETLOCAL ENABLEDELAYEDEXPANSION
SET u=.\


:CHOI
ECHO.-------------------------------------------------
ECHO.MS Windows Service's START_TYPE MANAGER
ECHO.
ECHO. SHOW Current Services : 1
ECHO. BACKUP Service's START_TYPE : 2
ECHO. RESTORE Service's START_TYPE : 3
ECHO. CONFIG Service's START_TYPE based on a file : 4
ECHO. CONFIG Service's START_TYPE based on 3 vars : 5
ECHO.
SET Select=
SET Choice=
SET /P Select=----------------------- Select an action (1-5):
ECHO.
IF /i '%Select%'=='1' GOTO SHOW
IF /i '%Select%'=='2' GOTO BKUP
IF /i '%Select%'=='3' GOTO REST
IF /i '%Select%'=='4' GOTO CON1
IF /i '%Select%'=='5' GOTO CON2
IF /i '%Select%'=='' GOTO Fin
ECHO.ERROR: Invalid Choice "%Select%" &GOTO CHOI


:SHOW ::--------------------------------------- SHOW Service's NAME & START_TYPE
SET z=%u%\SrvSHOW.LOG
TYPE NUL>"%z%"
FOR /f "Tokens=1,2 Delims=:" %%r in ('"SC QUERY state= all"') DO (
IF /i "%%r"=="SERVICE_NAME" (ECHO%%s)
IF /i "%%r"=="DISPLAY_NAME" (ECHO. %%s&ECHO.-------------------)
)>>"%z%"
"%z%"
ECHO.&ECHO.1: Done&ECHO.&GOTO CHOI


:BKUP ::----------------------------- BACKUP Service's START_TYPE as a .CMD File
SET z=%u%\SrvBKUP.CMd
TYPE NUL>"%z%"
FOR /f "Tokens=1,2 Delims=:" %%r in ('"SC QUERY state= all"') DO (
IF /i "%%r"=="SERVICE_NAME" (Call :SUB1 %%s)
)>>"%z%"
TYPE "%z%"
ECHO.&ECHO.2: Done&ECHO.&GOTO CHOI


:REST ::------------------------------------------- RESTORE Service's START_TYPE
SET z=%u%\SrvBKUP.CMd
IF NOT EXIST "%z%" (ECHO.ERROR: MISSING File [%z%] &ECHO. &GOTO CHOI)
Call "%z%"
ECHO.----------------------- &ECHO.3: Done. Reboot Your PC &ECHO.&GOTO CHOI


:CON1 ::---------- CONFIG Service's START_TYPE Based on Customized File Conf.LOG
CD\
SET z=%u%\Conf.LOG
IF NOT EXIST "%z%" (ECHO.ERROR: MISSING File [%z%] &ECHO. &GOTO CHOI)
FOR /f "Tokens=1,2 Delims=:" %%r in ('TYPE "%z%"') DO (
SC CONFiG "%%r" Start= %%s
)
ECHO.----------------------- &ECHO.4: Done. Reboot Your PC &ECHO.&GOTO CHOI


:CON2 ::------------ CONFIG Service's START_TYPE Based on 3 Customized Variables
SET sAUTO=ServiceName1/Service Name 2
SET sDEMA=Service_Name3/Service Name4
SET sDISA=ServiceNameMNO/Service Name XYZ
::------------------------------------------------------------------------------
CD\
FOR %%s in ("%sAUTO:/=" "%") DO (SC CONFiG %%s Start= auto)
FOR %%s in ("%sDEMA:/=" "%") DO (SC CONFiG %%s Start= demand)
FOR %%s in ("%sDISA:/=" "%") DO (SC CONFiG %%s Start= disabled)
ECHO.----------------------- &ECHO.5: Done. Reboot Your PC &ECHO. &GOTO CHOI


:Fin
ECHO.END. BYE ..... &PING -n 2 LocalHost>Nul &EXIT


::---------------------------------------------- Sub Routine To Build SC Command
:SUB1
SET SrvcName="%*"
FOR /F "Tokens=1,3 Delims=: " %%a in ('"SC QC !SrvcName!"') DO (
IF /i "%%a"=="START_TYPE" (
IF /i "%%b"=="AUTO_START" (ECHO.SC CONFiG !SrvcName! Start= auto )
IF /i "%%b"=="DEMAND_START" (ECHO.SC CONFiG !SrvcName! Start= demand )
IF /i "%%b"=="DISABLED" (ECHO.SC CONFiG !SrvcName! Start= disabled)
)
)
GOTO :EOF
::______________________________________________________________________________

8330.

Solve : Folder Copying Complex Batch File?

Answer»

Hi, this is my first post on this site!

I have a little problem with a batch file I'm TRYING to create using command prompt in Windows XP. Basically here's the situation:

When the program runs, I want it to move ALL folders (including subfolders) from "C:\DOCUME~1\%USERNAME%\Desktop" that begin with "BTB " to the location "\\comp1\shareddocs".

It sounds easy, but I've tried using XCOPY and MOVE with no success. I just cant get the FOR loop correct; I have no idea how to read the "BTB " folder names into the FOR loop as variables.

Any help I can get is appreciated.

Thanks,

bloodghostSorry to db, but here's my current code (which doesn't work):

<----------------------------------------------------------------------
@ECHO OFF
setLocal EnableDelayedExpression
CLS
CD C:\DOCUME~1\%USERNAME%\Desktop
FOR /F "tokens=4 delims=" %%a IN ('DIR ^| FINDSTR /I /C:"BTB "') DO SET %%a=%folder%
CD %folder%
MD \\comp1\shareddocs\%folder%
XCOPY *.* \\comp1\shareddocs\%folder% /S /E /V /I /G /H
ECHO.
ECHO Copying, please wait...
RD /S /Q %folder%
ECHO.
PAUSE
---------------------------------------------------------------------->

I know its a little screwy, I'm not that good on my FOR loops. Please help!

Wasn't able to test this out. This may work but if it doesn't, we guarantee our work, so be sure to get back to us.

Code: [Select]@ECHO OFF
CLS
CD /d C:\DOCUME~1\%USERNAME%\Desktop
FOR /F "tokens=*" %%a IN ('DIR /a:d /b ^| FINDSTR /I /C:"BTB "') DO SET folder=%%a
CD "%folder%"
MD "\\comp1\shareddocs\%folder%"
XCOPY *.* "\\comp1\shareddocs\%folder%" /S /E /V /I /G /H
ECHO.
ECHO Copying, please wait...
RD /S /Q "%folder%"
ECHO.
PAUSE

Seriously, if you have any problems with the snippet LET us know. There are many knowledgeable people here that can help.

8331.

Solve : back up with batch?

Answer»

Hi, I am making a program that I hope will back up some of my important document. I decided to USE batch but I am having a problem. The program that is meant to back up everything from my documents on will only take the FILES within my documents and not any of the folders within it. This is the program that I used: and comments or reasons why this is happening would help..

xcopy "C:\documents and settings\%username%\my documents" "C:\documents and settings\%username%\HACKED"
pause
cls
pauseYou may need some switches for the XCOPY UTILITY:

Code: [Select]xcopy /s /e /h "C:\documents and settings\%username%\my documents" "C:\documents and settings\%username%\hacked"
pause
cls
pause

Run XCOPY /? from the command prompt. There is a whole alphabet soup of switches to choose from.

8332.

Solve : Pins?

Answer»

What is the command for knowing the pin of the PERSON we are CHATTING to in windows XP?There isn't ONE...

8333.

Solve : using batch file.?

Answer»

what is script to EXECUTE a PROGRAM AUTOMATICALLY at every certain time LET say 5 minute.Script - Use the AT command or the SCHTASKS command.

8334.

Solve : Startup problem screen?

Answer»

This screen continues to pop up when I attempt to turn on my computer (I am using a different computer right now): "A problem has been detected and windows has been shut down to prevent damage to your computer..........Technical info: 0x000000F4 (0x00000003, 0x829A4290, 0x829A4404, 0x805D13B6) Please help!It looks like some hardware is failing. Most likely RAM, or hard drive.

Test your RAM, using this:
http://www.memtest86.com/

Test your hard drive...How to:
http://www.bleepingcomputer.com/forums/Hard-Drive-Installation-and-Diagnostic-Tools-t28744.htmlI can't even get to windows, more/less the internet. I just got off of the phone with Dell and they told me it would cost $39.00 to fix the problem. They informed me that it was most likely a SOFTWARE issue. They also asked if I had the original operating system cd, which makes me think that if somebody on here could give me a simple answer, it would save me 40 bucks. Also, does anyone know how to use the cd if I am unable to get to windows, and will I lose any data? Thank you so much!1. You can DOWNLOAD the above tools from the computer, you're posting from. They'll CREATE bootable CDs, which you can use on bad computer.

2. Quote

They also asked if I had the original operating system cd, which makes me think that if somebody on here could give me a simple answer, it would save me 40 bucks. Also, does anyone know how to use the cd if I am unable to get to windows, and will I lose any data?
It depends what CD you have.
If you have Windows XP CD, you can try Repair option, and you won't loose your data.
If you have Recovery CD, you'll loose your data.I just tried a cd (operating system, "only use this dvd to reinstall the operating system on a dell pc) nothing happened, so i left the cd in and turned the computer off then on, now i am getting a different error message....KERNEL_DATA_IMPAGE_ERROR.... ..with a different stop code of : 0x0000007AYour latest error brings US to the very same diagnosis: bad RAM, or HD.
...and I think, Dell was wrong.i agree, just researched and tried rebooting in safe mode with prompt, then tried chkdsk/f/r but it tells me that the volume is in use by another process....any suggestions, places to take it that are CHEAP, or is it f'd???Try those two tools, I listed.
8335.

Solve : getting the no.of files and file name from a folder?

Answer» HI All,

Am new to this forum and also new to DOS(not having more idea)

Here i have written a batch file to add header, root tag to the generated file and converting .csv into .xml and moving it to another folder

here is the code :

more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/header.xml > C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/root.xml >> C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data1/employee.csv >> C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/closeRoot.xml >> C:/gsk


it's working fine, but in that i have hard coded the input and output file names like input file employee.csv and output file employee.xml

instead of hard coding the those file names i would like to get dynamically, and also let me know how to take the count of messages in folder


Thanks in Advance


Note sure I fully understand the question

But here goes....

To output a list of all files in a folder to output.txt
dir /b c:\ | find "" /n /v >output.txt

To output a list of all files in a folder and all sub folders to output.txt
dir /b /s c:\ | find "" /n /v >output.txt


To make this more dynamic and not hard code it, instead of for EXAMPLE employee.csv, you can use %1
If you for example saved this as xml.bat then running this batch file in the command prompt with the parameter employee.csv will replace %1 with employee.csv
i.e
xml.bat employee.csv

if you use a second parameter, this would be %2 in the batch file

You could then create another batch file which calls xml.bat with all its parameters. If you need to change the files, you would only need to change this batch file.

Hope that helpsall i know is that to convert a file into another file copy the code below:

rename *.csv *.xml

The above will completely change your .csv into a .xml
but the only thing you MUST remember is that you must have this program in the same folder you wish to change those certain files to the other file type.

You can add the move .xml to another folder thing in when ever you want.

Do not replace the '*' with anything else just leave it how it is.

Tan_ZaHi Tan_Za

This requirement is not that much easy as you said

please go through my post again

Hi TheManFrom,

Thanks a lot for your reply, but here my problem is

one application is keep on generating the files with the date_time stamp, i cannot pass the file name as an argument, because the files always generates id different timestamp

and also i need to add the header, open root tag, close root tag to the each and every file

please help me on this, because totally am new to dos(am not having more commanding on dos)

Thanks in Adavance, Your Help is Appreciated

Save the following in c:\xml.bat

REM--------------------------------------
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/header.xml >> C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/root.xml >> C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data1/%1 >> C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/closeRoot.xml >> C:/gsk
REM--------------------------------------


Open notepad, copy and paste the script below and change the first line to point to your folder, then save as c:\xml.vbs

'------------------------------------------
CONST StrFolder = "C:\temp"
CONST StrBatch = "C:\xml.bat"

Set fsoFolder = CreateObject("Scripting.FileSystemObject")
Set folder = fsoFolder.GetFolder(StrFolder)

Set files = folder.Files

for each objFile in files
set shell=createobject("wscript.shell")
Shell.Run StrBatch & " " & objFile.Name, 0, True
set shell=nothing
next

set files = nothing
set folder = nothing
set fsoFolder = nothing
'------------------------------------------


open command prompt and type
cscript xml.vbs


This will now run the vbs script which will go and find all files in the folder you specified. It will then pass the name of the file to xml.bat, which will add the header, root etc and output as employee.xml
Note, this will keep writing to the same employee.xml file - you will need to amend the batch file to change this. You can change employee.xml to "%1.xml" to have the name of file read .xml

Hope thats what you neededNOTE: to list the files(s) in a directory (folder) simply type:


DIR [path[dir]]?

I do this all the time, to display files in a folder, when i boot my comp in DOS-Mode.

I have no idfea what all the extra code is for, but can't u simply type:

DIR [path]
rename [path][filename]??The original code has a CSV file processed by the more utility and producing a XML file. This is not gonna happen. Oh, it will run OK, but you'll still have a CSV file (just with a new and misleading name).

Code: [Select]more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/header.xml > C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/root.xml >> C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data1/employee.csv >> C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/data/employee.xml
more < C:/gskgaa_v3/gskgaa/common/UTC_6.8.6/Receiver1/post-processor/closeRoot.xml >> C:/gsk

Processing files thru the more utility does not change the organization of a file. NEITHER does copy, move or rename. A file extension acts much like the title of a book...it indicates what to expect when it's opened. Windows uses the file extension to call the proper application that can process each file type. Simply calling a CSV file a XML file does not make it so.

Quote
let me know how to take the count of messages in folder

Down and dirty this snippet should work:

Code: [Select]for /f %x in ('dir ^| find /i "file(s)"') do echo %x

Use the above code at the command prompt. To use in a batch file, double up the percent symbols.

8336.

Solve : connecting/disconnecting local internet connection from .bat?

Answer»

Hi, new poster. nice place you have here .

As the title says.

(In ORDER to speed up a certain APPLICATION i need to disconnect, renew ip ( this PART i GOT covered in a .bat ) and reconnect again. Right now i do it manually i would like to make it as automatic as possible).

I have XP SP2 on an amd machine with kaspersky av 6. connection is cable broadband (modem).

So...

Can it be done ?



edit :

would something like this will work?

@echo off
rasdial "YouDialUpConnectionName" /disconnect
echo ipconfig /flushdns
ipconfig /flushdns
echo ipconfig /release
ipconfig /release
echo ipconfig /renew
ipconfig /renew
rasdial "YouDialUpConnectionName" "Login" "PASSWORD"
exit

8337.

Solve : saving comand prompt text to file?

Answer»

I have a batch file that TELLS me specific information about a program at a specific time. I was wondering if there is a way to save all the information shown in the comand prompt window to a text file using a command in that batch file.Quote from: brollins90 on December 11, 2007, 03:33:16 PM

I have a batch file that tells me specific information about a program at a specific time. I was wondering if there is a way to save all the information shown in the comand prompt window to a text file using a command in that batch file.

It depends.
What's in your batch file?



Redirection comes to mind.
For example, if you have a batch file that causes some text to be printed to screen, you could redirect the output to a file instead.

batch.bat on the command line executed writes to screen.
batch.bat > filename.txt on the command line writes to filename.txt

One redirection symbol will create the named text file if it does not exist, and if it exists it will overwrite it.

Two redirection symbols will create the named text file if it does not exist, and if it does, it will append to it.
As in batch.bat >> filename.txt


brollins90 :

I see that was your FIRST post here.


Welcome to Computer HOPE. That works, thanks alot.Quote from: brollins90 on December 11, 2007, 05:05:53 PM
That works, thanks alot.

Good to know that did it.
You're welcome, a lot.

Stop in any time.



8338.

Solve : batch file to download pic's from digital camera to external harddrive?

Answer»

I am having problems devising a batch FILE to download pictures from my digital camera to my eternal harddrive. I can see with the echo on that it is pulling in the pictures but I cannot get them to go the temp file I created on my harddrive. My operating system is WINDOWS XP. My camera is a Sony. My camera is connected va USB as is my external harddrive.

Thanks for your help in advance.

RobinUnless your camera is assigned a DRIVE letter when it's attached, you may be SOL.

Normally on a XP machine, when the camera is PLUGGED in, Windows asks what you want to do, with one of the choices being to transfer pictures to the hard disk.

In addition, most cameras come with SOFTWARE which allow you to transfer pics to the PC. Can you not use the Sony software?

We could probably get an idea of what you've been trying if you posted your batch file.

8339.

Solve : Xcopy file operation order?

Answer» HI, all:

May be a totally EASY question, but I did look around a while for the answer and didn't happen upon it.

When you are Xcopy-ing a large collection of files from a set of directories on ONE drive to another, what order are they copied in? Doesn't SEEM to be alphabetical or time-of-creation or anything else I can deduce.

Thanks~~~Welcome to the CH forums.

What is your Operating System?

The specific instance was CMD in WinXP SP2, but I guess I would be CURIOUS if the order was in fact different from one version of XCOPY to the next as well.

Thanks for the welcome!

JG
8340.

Solve : DOS command problem for Noob?

Answer»

Hi all:

I am trying to install Windows 98 into a new FOLDER on my machine that is also running windows 98. I am following this article found here from microsofts vault....

http://support.microsoft.com/kb/193902/EN-US/

The problem is I keep GETTING "Too many parameters" or "Bad command or file name" errors when trying to follow along.

I am specifically stuck at the step number 1 under the heading "Running Setup from the Windows 98 CD-ROM". I have tried several variations and it keeps telling me "Too many parameters". I am not sure what the "~" is there for. Can someone tell me exactly what to type??? Thanks for looking??Welcome to the CH forums.

Here is a description of the use of the tilde character "~" in filenames:

Quote

Microsoft filenames

The tilde was part of Microsoft's filename mangling scheme when it developed the VFAT filesystem. This upgrade introduced long filenames to Microsoft Windows, and permitted additional characters (such as the space) to be part of filenames, which were prohibited in previous versions. Programs written prior to this development could only access filenames in the so-called 8.3 format—the filenames consisted of a maximum of eight alphanumeric characters, followed by a period, followed by three more alphanumeric characters. In order to permit these legacy programs to access files in the VFAT filesystem, each file had to be given two names—one long, more descriptive one, and one that conformed to the 8.3 format. This was accomplished with a name-mangling scheme in which the first six characters of the filename are followed by a tilde and a digit. For example, "Program Files" becomes "PROGRA~1".

Also, the tilde symbol is used to prefix hidden temporary files that are created when a document is opened in Windows. For example, when you open a Word document called "Document1.doc," a file called "~ocument1.doc" will be created in the same directory. This file contains information about which user has the file open, to prevent multiple users from ATTEMPTING to change a document at the same time.

Type the command exactly as it is SHOWN and post back with any displayed error message.

8341.

Solve : Executable command line output into variable?

Answer»

Hi.
After looking around on the forum I have been unable to find an EFFICIENT WAY of getting a COMMAND line string returned from an executable, that is RUN within a batch file, into an environmental variable of the same batch file.
Can any one please provide me with a way of doing this?

THANKS in advance.



you use the for loop to get the executable string result. check for/? for more information
also , to set the environment variable, eg PATH, you use set.
eg
set PATH=%PATH%;%result%Thank you for that.
I found this below seems to do the job.

FOR /F %%A IN ('mycommand.exe') DO set myvar=%%A

8342.

Solve : All information from start and shutdown of computer?

Answer»

is there any command to view the details that we did from starting the computer to shutting down computer..
i MEAN after start i MAY open and use any application and close it..likewise i would do this with many applications in windows...something similar to history of webpages visited...I don't think there is a command to view what you've been doing.
If you wanted it for checking what someone has been up to on a computer there are freeware programs for windows that will record actions like OPENING programs and output them to log FILES for you to check later.

8343.

Solve : how to go the c:\??

Answer»

in my DOS PROMPT have this c:\ documents and settings \ users&GT;

all i want is go to the ROOT c:\
how to do that?Type CD\ then HIT Enter.

thanks

8344.

Solve : Printing in batch file?

Answer»

I am using windows xp pro sp2.

I want to print a txt file to printet with a BATCH file, I have treid but cannot get it to WORK. I am using USB001 to print vmy printer don't have lpt or com on it.

What can I do to make it print.
I don't KNOW what you've tried so far but have a read of this: http://www.windowsitpro.com/Article/ArticleID/39674/39674.html.
If it can be NETWORKED you should be able to map it to an LPT port.mickster9

Thank you for the LINK, I got it to work now.

8345.

Solve : netsend..?

Answer»

i know this might sound stupid
but is it possible to netsend messages over from one computer to another computer.
Both computer have INTERNET access with the same internet provider.

possible or not?why don't you try it?
i shall lol.
sometime someday.how would i GO about trying it? i unno how to use netsend 1. It's not netsend, it's net send
2. http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/net_send.mspx?mfr=true
Possible!!

MS-DOS command:net send computer name "message"
(EXP:net send agmppre "hello")Its not mandatory to give computer name, you can give the IP as well.

net send "ip" "mesg"what does it look like when it pops up and why cant i send to myself using my IP?

"The message alias could not be found on the network."I have seen that when the messenger SERVICE is not enabled or started.messenger service? does it go through MSN or sumthing like that?

8346.

Solve : Parsing the output of net view?

Answer»

Hey again. I'm WONDERING if there's any way to parse the output of net VIEW, so that there is no remark, only the computer name? I can get past the header and footer by skipping them in my search, but it's the remark that is really killing me here (I'm trying to search each line for the computer name, and then search that computer).

So, can you help?



Thanks, Dark Blade.As always, there is more than one way to to this, but this should work:

From the command line:
Code: [Select]for /f "tokens=1*" %X in ('net view ^| find "\\"') do echo %x

From a batch file, double up on the percent symbols:
Code: [Select]for /f "tokens=1*" %%x in ('net view ^| find "\\"') do echo %%x


Well, I've thought of another way, which is the one I'll use. I'm going to use for, with the DELIMITER of space (with is the default ANYWAY), so I'll only get the computer name. But if that fails, I'll use your approach. Anyway, thanks for your help .

--Dark Blade

8347.

Solve : Debugging - FOR loop?

Answer»
cd \
setlocal enableextensions enabledelayedexpansion
net view > list.txt

set /a LNE=0
:find
set /a LNE=%LNE%+1
for /f "skip=%LNE%" %%m in ('findstr . list.txt') do (
goto find
)

set /a SKP=3
:begin
if %SKP% GTR %LNE%-1 goto end
:first

for /f "skip=%SKP%" %%i in ('findstr . list.txt') do (
set PC=%%i
if exist %PC%\multimedia goto go
goto reset
:go
DIR %PC%\multimedia /s > find.txt


findstr drvmgt.dll %cd%\find.txt >nul && echo %PC% >> pos.txt
:reset
set /a SKP=%SKP%+1
goto begin
)
:end


Here is an excerpt of my code (i.e. just CUT out the parts I need), that so far is meant to:
1. Send the output of net view to a text file
2. Check how many lines are in the test file
3a. Search for the multimedia folder on the remote computer
3b. Then send the directory of it to a text file
3c. Then search for a particular file, and if found, send the PC name to another text file

However, just searching through my network of computers, there is no multimedia folder in there, so that eliminates some of the steps. However, my for loop is causing me some problems. The for itself isn't the problem, but I can't seem to isolate the exact cause of the unexpected error (from what I can read in a millisecond: . was unexpected at the time.)


Anyway, any help would be appreciated. Thanks.




I think we already had this conversation.

The run log of your code looks like this:

Code: [Select]D:\>setlocal enableextensions enabledelayedexpansion
D:\>net view 1>list.txt
D:\>set /a LNE=0
D:\>set /a LNE=0+1
D:\>for /F "skip=1" %m in ('findstr . list.txt') do (goto find )
D:\>(goto find )
D:\>set /a LNE=1+1
D:\>for /F "skip=2" %m in ('findstr . list.txt') do (goto find )
D:\>(goto find )
D:\>set /a LNE=2+1
D:\>for /F "skip=3" %m in ('findstr . list.txt') do (goto find )
D:\>(goto find )
D:\>set /a LNE=3+1
D:\>for /F "skip=4" %m in ('findstr . list.txt') do (goto find )
D:\>set /a SKP=3
D:\>if 3 GTR 4-1 goto end
D:\>for /F "skip=3" %i in ('findstr . list.txt') do (
Set PC=%i
if exist \multimedia goto go
goto reset
dir \multimedia /s 1>find.txt
findstr drvmgt.dll D:\\find.txt 1>nul && echo 1>>pos.txt
set /a SKP=3+1
goto begin
)

D:\>(
set PC=The
if exist \multimedia goto go
goto reset
dir \multimedia /s 1>find.txt
findstr drvmgt.dll D:\\find.txt 1>nul && echo 1>>pos.txt
set /a SKP=3+1
goto begin
)

D:\>set /a SKP=3+1

D:\>goto begin

D:\>if 4 GTR 4-1 goto end

D:\>for /F "skip=4" %i in ('findstr . list.txt') do (
set PC=%i
if exist The\multimedia goto go
goto reset
dir The\multimedia /s 1>find.txt
findstr drvmgt.dll D:\\find.txt 1>nul && echo The 1>>pos.txt
set /a SKP=4+1
goto begin
)

Doesn't seem to be a syntax error. I think it would be easier if you only processed the net view lines that CONTAIN any relevant data instead of hunting for dots and skipping headers.

This little snippet should do just that:

Code: [Select]for /f "tokens=1-2 delims=\ " %%x in ('net view ^| find "\\"') do (....

I'll leave it to you to fill in the do logic.

Note: %%x contains the computer name (without the backslashes; if you want the backslashes, REMOVE the entire delims clause); keep in mind that one of the computers in the net view list is yours.



PS. Pretty sure that if %SKP% GTR %LNE%-1 goto end does a string comparison and in any CASE if statments do not do arithmetic.For some reason, there is still the same error as last time. This is really annoying me now... there seems to be no apparent cause... I even tried removing one line at a time to see what was causing the fault, but to no avail...

However, in the meantime I managed to make the rest of my code bug-free! But, although it was quite helpful, that's not much of a substitute. Anyway, I'll get back to work on the for loop again, and see if I can't get this thing to work...


Thanks for your help
--Dark Blade


EDIT: But wait! It works now!!! I just replaced the PC variable with %%i (they are the same, after all), and then it worked! I always thought that creating a new variable was unnecessary....

My batch file is working perfectly now. That said, I haven't actually had a proper test run on any computers with \multimedia (my school has them, though). But I'm optimistic.


Thanks again
8348.

Solve : Self renaming bat file?

Answer»

here's the code:

wmpshelloff.bat
Code: [Select]if %0:~-5% == "f.bat" (

rem Unregistering WMP SHELL Integration
regsvr32 /u wmpshell.dll
set ren=%0:on=off%
)else (
echo no
rem REGISTERING WMP SHELL Integration
regsvr32 wmpshell.dll
set ren=%0:off=on%
)
RENAME %0 %ren%WHY DOES IT NOT WORK!?What is displayed when you run the batch ? are there error messages ?
Can you paste them in here

GrahamCode: [Select]C:\dos>wmpshelloff.bat

C:\dos>if wmpshelloff.bat:~-5 == "f.bat" (
rem Unregistering WMP SHELL Integration
regsvr32 /u wmpshell.dll
set ren=wmpshelloff.bat:on=off
) else (
echo no
rem Registering WMP SHELL Integration
regsvr32 wmpshell.dll
set ren=wmpshelloff.bat:off=on
)
no

C:\dos>rename wmpshelloff.bat wmpshelloff.bat:off=on
The SYNTAX of the command is incorrect.

C:\dos>Stramge, variable expansion seems off yet it is set to on from the registry...
Does it work for You? It's supposed to unregister wmpshell.dll, I'm USING XP SP2 BTWThe %0 parameter does not include the file extension which makes your if statement shaky. The following SNIPPET does what you need but the cmd processor does not like executing files to disappear; something to do with handles and all that .

Code: [Select]setlocal enabledelayedexpansion
set pgm=%0
if %0:~-1% == "f" (

rem Unregistering WMP SHELL Integration
regsvr32 /u wmpshell.dll
set ren=!pgm:on=off!
)else (
echo no
rem Registering WMP SHELL Integration
regsvr32 wmpshell.dll
set ren=!pgm:off=on!
)
rename %0.bat %ren%.bat

Thanks for the help all
I gave up using %0 at all because if you open it from the gui it brakes down...
i devised an easier way, albeit it rquires user input
Code: [Select]@echo off

echo Hit a key to:
set /p wmpshell=[R]egister or [U]nregister Wmp shell:
if not '%wmpshell%'=='' set choice=%choice:~0,1%
rem Unregistering WMP SHELL Integration
if '%wmpshell%'=='U' regsvr32 /u wmpshell.dll
if '%wmpshell%'=='u' regsvr32 /u wmpshell.dll
rem Registering WMP SHELL Integration
if '%wmpshell%'=='R' regsvr32 wmpshell.dll
if '%wmpshell%'=='r' regsvr32 wmpshell.dll

8349.

Solve : Rename help?

Answer»

I have a problem---
I have a program that creates log files and names them based the time and hour in which they are created. I have built a batch file to ftp the file but it will not work because the NAME changes everyday on the file. So I was thinking the one thing all the log files have in common is they contain the word "short". If I could creat a batch file that wpuld rename any file that contains the the string "short" to short_term_audio_level.csv I could write the ftp script to simply FTP that file. So the question is how could a write a batch file to run that would rename any file that contains the word "short" to "short_term_audio_level.csv".

I figured ren *short* short_term_audio_level.csv would do the trick but it is showing
The syntax of the command is incorrect.
Thanks in advance Kevin.......

If someone could point me in the right , it would be HUGE. My backround is more netwrking and VIDEO but I have to make this work asap. A bit more INFO this software is running in Windows Server 2003..I figured out how I can do it. because the naming convention always uses date time minutes and seconds it is always the same AMOUNT of characters on each side of short.
rename ???short???.csv short_term_audio_level.csv does the trick.

8350.

Solve : displaying folder name?

Answer» HI - I NEED to find out the folder name of the folder I am in and its parent and save them to a variable. I then need to use the names as aprt of the parameter for stating a program.
The structure is like

ClientName
System
Code: [Select]ECHO.%~dpnx0

FOR %%a in ("%CD%") DO SET CurrentFolder=%%~na
ECHO.Current folder: %CurrentFolder%

CD ..
FOR %%a in ("%CD%") DO SET ParentFolder=%%~na
ECHO.Parent folder: %ParentFolder%

Pause &EXIT
Result of this script:
Code: [Select]C:\Documents and Settings\users\Bureau\ess.CMd
Current folder: Bureau
Parent folder: users
Appuyez sur une touche pour continuer...