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.

4251.

Solve : DOS FAT, FAT32, or NTFS??

Answer»

I'd like to set up an old system for exclusively running DOS games. I've tried using DOSBOX and other such things through XP...but it simply isn't the same. There always seems to be animation or sound issues.

The drive was converted to NTFS, and as far as I remember, DOS requires FAT or FAT32. Does it matter? DOS is not currently installed. How do I format the drive to FAT (or whichever) and then install DOS? Do I need fdisk? What are the exact parameters (my DOS skills are a little rusty)?

Any help getting me up and running would be greatly appreciated.You'll need a DOS boot disk with FORMAT.EXE (or is it .COM?) on it. Boot from the floopy and then just FORMAT C:.

You're right in thinking that an ordinary DOS session will not be able to see the contents of an NTFS-formatted partition.

Try that, and if it doesn't work, maybe you DO need to fdisk after all. fdisk is pretty self-explanatory though - worry not.You won't format an NTFS drive from a DOS bootdisk. You won't even see the drive!
I've upped a bootdisk here that contains Delpart. Unzip it and run the resulting bootdisk.exe with a diskette in the floppy drive. Use Delpart to delete all PARTITIONS and reboot. Now run Fdisk and create however many partitions you need. If you're using DOS 622 or below, don't format the partitions with this disk but use the format command on the DOS setup disks which will use FAT16.well, technicaly you don't need a FAT12, FAT16, or FAT32 drive to play dos games. my drive is ntfs and it plays DOOM II just fine. really the only reason you would change the formatting is to reduce the slack in the drive the BEST FS for that right now is NTFS.If you have DOS games that you want to run in real-mode DOS, then you will probably want to go with FAT16. I think FreeDOS and DrDOS support FAT32, but there is a chance the old DOS games may have issues with anything other than FAT16.

You will need a DOS boot disk, FDISK and FORMAT. If you still have an old version of DOS laying around then I would use that. MS-DOS 6.22 was the latest official release of DOS from Microsoft. DOS 7.00 and 7.10 came with Windows 95 and Windows 98 respectively, but I would stick with MS-DOS 6.xx, or FreeDOS or DrDOS.

Just run FDISK to remove the NTFS partition (I think DOS 6 will see it as a HPFS partition), then re-create a FAT partition, then reboot, then format c: /s.

Copy your games to the C: drive and you are in business.

4252.

Solve : Image Batch?

Answer»

Hi

To START i must say that i use Xp pro but the batch need also work on 2k..

That's what i want to do

I got files.jpg in a specific folder.
For each files i want to resize and change the DPi

i want to put in a txt files the name of the last modified file.

The problem is that i want to use Irfanview to work on the jpg but it don't accept wildcards.

I think to use a For loop but i don't succeed...

One more QUESTION, how i can put in a text file at line n the first line of an other txt files ??

Sorry for my poor english..

Thanks for any help..

@+MaxAssuming you have all the *.JPG files in 1 folder.

Do this first:

DIR /B *.JPG >JPGLIST.TXT

in a DOS script, use the FOR command.

@echo off
echo.
FOR /F "delims=" %%I in (JPGLIST.TXT) do (

Echo Opening file %%I with infranview
INFRANVIEW.EXE %%I
ECHO Moving customized file to processed folder.
MOVE %%I .\PROCESSED
)

This will process all the files in the JPGLIST.TXT, one by one. It will open INFRANVIEW.EXE with only that file in question. After you close infranvie, it will move the file to a processed directory. It will then loop and re-open infranview onto the next file.
Hi

Thanks for your answer, i'll try it as soon as possible..

An idea for the last question ?

Thanks again

@+MaxRe

so i try that

REM --------------------------------------------------------
REM Listage des fichiers
REM --------------------------------------------------------
dir /b /o:-N H:\DAP\*-J.jpg > H:\DAP\Jacq.txt

REM --------------------------------------------------------
REM Redimmensionnement en 340*340 sous 72 Pixel/pouce
REM --------------------------------------------------------
FOR /F "delims=" %%I in (H:\DAP\Jacq.txt) do (
Echo Traitement du fichier %%I avec Irfanview
C:\PROGRA~1\IRFANV~1.97\i_view32.exe H:\DAP\%%I
ECHO D‚placement du fichier modifi‚ %%I dans /Jacquettes
MOVE H:\DAP\%%I H:\DAP\JACQUE~1\
)

and it work but i want to add command lines for irfanview and i try this:
REM --------------------------------------------------------
REM Listage des fichiers
REM --------------------------------------------------------
dir /b /o:-N H:\DAP\*-J.jpg > H:\DAP\Jacq.txt

REM --------------------------------------------------------
REM Redimmensionnement en 340*340 sous 72 Pixel/pouce
REM --------------------------------------------------------
FOR /F "delims=" %%I in (H:\DAP\Jacq.txt) do (
Echo Traitement du fichier %%I avec Irfanview
C:\PROGRA~1\IRFANV~1.97\i_view32.exe H:\DAP\%%I /dpi=(107,107) /jpgq=100 /killmesoftly
ECHO D‚placement du fichier modifi‚ %%I dans /Jacquettes
MOVE H:\DAP\%%I H:\DAP\JACQUE~1\
)

and it don't work, i think to the (..) of the parameters but not sure. Any idea to solve the prob (an other soft...)

Thanks for the help

@+Max

4253.

Solve : Input?

Answer»

This is probably very simple. I have creaed a batch file that will simply map a person to their personal drive and a office shared drive.

But I want to modify the file so the user is prompted for the ring code for the their site. Then take the variable and plug it into the command to connect to the drives. (That I tink I can do. Just can't find how you add a prompt for the user to input a ring code.) ThanksWhen you need to set a variable that is input by the user, you would enter into the script...

set [highlight]/p[/highlight] MyVariable=Please enter in the required variable:

TIP: type 'help set' from the command prompt will also provide details.

If you ECHO the variable %MyVariable% afterwards, it will DISPLAY the text ENTERED.

Example:
C:\>test

... This is a TEST bacth job ...

Please confirm...
Do you wish to continue ? [y/N] :n

You have chosen NOT to continue.

Ending Script...

C:\>type test.bat
@echo off

@echo.
@echo ... This is a TEST bacth job ...
@echo.
@echo Please confirm...
set /p SQLContinue= Do you wish to continue ? [y/N] :

IF /I "%SQLContinue%" NEQ "Y" (

@echo.
@echo You have chosen NOT to continue.
@echo.
@echo Ending Script...
@echo.

sleep 5

GOTO :FinishRun

)

@echo.
@echo End of Script (anyways).

:FinishRun

:EOF
C:\>
Hope that has been of some help.The previous example, and my example both assume you are running this from a command prompt under Windows 2000/XP/2003. Here is some more simple code:
Code: [Select]@echo off
set /p RingCode=Please enter your ring code:
echo The ring code entered was %RingCode%Just in case you're not running XP/2000/2003, answer.com and input.com can be used to prompt for input. (Google for them). Both are little assembler programs that work by setting an environment variable to the value you're prompted for. You can then query the variable in your batch file.

Good luck. 8-)

4254.

Solve : dos won't open?

Answer»

i double click on a file, DOS window opens, then IMMEDIATELY closes, what is wrong? i can open my command prompt, but when i click on a file it won't. it also won't open if i DRAG a config file onto an exe. what's wrong?

ps- i run xpWho said you could do all of that in XP?

What are you trying to accomplish? Run a DOS program in XP?

Command prompt is not the same as DOS, you know.

Goodgle for DOSBOX and see if that is what you need.The DOS program may be running properly and finishing which would close the CMD window. For example, if you find the ping.exe command in C:\Windows\System32, and you double-click on it, it will flash the CMD window quickly and then go away because the command ran quickly (in the ping.exe example it would probably just display the help screen and exit) and then the CMD window will close.

As asked by GX1_Man ... What are you trying to accomplish? If it is a batch file, you can put a "PAUSE" statement at the end.

4255.

Solve : Question for All?

Answer»

Does anyone who posts in this sub-forum understand what DOS is and is there a reason for trying to WRITE batch files for Windows ? ? ?

Inquiring minds want to KNOW...Yes and maybe - depends on which Win version.

Yes I understand; there is a difference between native DOS and cmd.
- and sure there is a reason to
write batchfiles / SHELL scripts in Windows.

uli
Of course there are reasons for writing batch files on Windows machines. Just the other day we had a POSTER who insisted on using a batch file to write a vbscript. Quote

Of course there are reasons for writing batch files on Windows machines. Just the other day we had a poster who insisted on using a batch file to write a vbscript.


I see....
4256.

Solve : Using Command To Change Filepath?

Answer»

I want to be able to INPUT a USERNAME e.g. Crusty69er or Wateva and then have a command input that username into a filepath.

e.g. Input username: Crusty69er, Wateva etc...
"c:\DOCUMENTS and SETTINGS\%USERPROFILE%\....."


If i havent explained properly soz, please ask for more info if ur unsure of wat im asking

If u could help that would be awesome
My email is [emailprotected]I'm not exactly sure what you are asking, so I'll take a guess. Here is a script that will ask for a username, and then attempt to change to that user directory based on your example:
Code: [Select]@echo off
set /p UsrName=Please enter the username:
cd /d "C:\Documents and Settings\%UsrName%"Note that this %USRNAME% would be very similar to the existing built-in %USERNAME% value (if you input the same user currently logged into Windows).

4257.

Solve : error, anybody know??

Answer»

is anybody familiar with this boot error screen the white box on the right says IBM in it
Operating System, processor, at what point in the boot sequence does this APPEAR, what have you recently installed, what have you done to try to eliminate this error???.

More info, More info, More infosorry this is a friends COMPUTER that hasnt been booted up for a few years i didnt even know he had it so i know no specs but he says that it goes through the memory SELF test then beeps twice then this screen comes upLook on the VENDORS web oage and that will tell you waht the beeps indicate. ie, long beeps, shorts beeps and how many.
the beeping is a form of error reportingIf it ain't been booted for a "few years" the cmos battery has probably gone into meltdown. Regardless, it should be replaced anyway.

Quote

sorry this is a friends computer that hasnt been booted up for a few years i didnt even know he had it so i know no specs but he says that it goes through the memory self test then beeps twice then this screen comes up



So expiration date is out Quote
If it ain't been booted for a "few years" the cmos battery has probably gone into meltdown. Regardless, it should be replaced anyway.


I didnt even think about that i will do that once i get over to his HOUSE i havent even seen the computer in person yet so i am trying to arm myself with some posibilites before i go in and work on it. thanks.Thanks for coming back to us & Good Luck!!
4258.

Solve : how to assign OS ver to a variable??

Answer»

I NEED to identify the OS version (W2K or WXP) as a variable in a DOS Bat file. example.......based on which OS run prog1.exe or prog2.exe

can't find the command to assign the contents of VER into a variable.

thanxThis code NEEDS to be in a batch file:

Code: [Select]
for /f "tokens=1-4*" %%a in ('ver') do (if %%c==XP (prog1) else (prog2))


HOPE this helps.

Gee! FOR's are so POPULAR we'll have to BRING back our two for one sale.There should be a variable %OS%.

if "os"=="XP" (prog1) else (prog2)

So you can save one FOR loop. ;-)


Please correct me if I am wrong.
uli

4259.

Solve : Net Send Data Packets?

Answer»

Hello everyone.
i have a question, how many bytes do data packets from a net send message contain?
The net message would be abbout this long"Hello everyone how are you today?"
sorry about the double thread i CLICKED post and didnt think it worked so i clicked it again so now... double threads.
sorryI would guess the packet is at least as long as the message plus any routing bytes needed to get the message to it's destination. Why would ANYBODY NEED to know this?

i WANT to know this because im going to send a Merry Christmas message around my work with net send but first i want to make SURE it wont clog anything up or lag the network.
thanks

4260.

Solve : DEL command?

Answer»

Hi,

When I try and delete a FILE with the del command it does NOTHING. It comes up with the Are you sure you want to delete this file Y/N question but then the file is still there. Im an admin on the computer and it still happens when I turn my ANTI virus off. I can delete FILES normally no problem (through GUI). What am I doing wrong? Im guessing its an easy answer. What OS is this, what files are they and where, what attributes do they have and under what circumstances are you attempting to delete them? Are there any error messages GENERATED?Windows xp. I just created a file on the desktop for the purpose of getting deleted to test it. No special attributes. The are no error messagesAre you sure that the path to the file is correct:
C:\Documents and Settings\Username\Desktop\filename.ext

Did you refresh the desktop view?How did you create the file? Could the file you are trying to delete be in use? For example, if you created the file with NOTEPAD, and the NOTEPAD program still has the file open it will not be able to delete the file because it would still be in use.Im trying to delete a folder if that makes a difference?

http://i41.photobucket.com/albums/e273/notme91/delcommand.jpg

Thnx

Yes indeedy it makes a difference. Use the rd command to delete both the files and the directory.

Code: [Select]rd /s c:\documents and settings\%username%\desktop\foldername
Feel free to replace foldername with whatever folder you need. Add the /q switch if you can't be bothered with the "Are you sure?" prompt.

You need to use the command (rd for folders, del for files) that applies.

Good luck. 8-)
Quote

Yes indeedy it makes a difference. Use the rd command to delete both the files and the directory.

Code: [Select]rd /s c:\documents and settings\%username%\desktop\foldername
Feel free to replace foldername with whatever folder you need. Add the /q switch if you can't be bothered with the "Are you sure?" prompt.

You need to use the command (rd for folders, del for files) that applies.

Good luck. 8-)


Thank you so much it works. Your a genius!
4261.

Solve : AT command task scheduling?

Answer»

I have set up an "at" commands that SHUTS my SONS pc down at a 11pm, I now need to stop him from altering the time.He has admin privelige otherwise I would have to spend my life installing games for him.

Is it possible to create an "at" command to resync time in xp with one command, using the next function or is the next function only for dates
I have created a command that works for a specific time ie
at \\%username 00:01 /every:M,T,W,Th,F,S,Su w32tm /resync
Which resyncs the time at 1 minute PAST midnight. I want to keep resyncing the time at ten minute intervals.Do I have to create a task for every ten minutes or can it be done with one command.This really needs a scheduled script where you can loop a ten minute sleep and resync or utilize the setinterval method and run a resync every ten minutes.

Earlier versions of Windows had a CHOICE command that used a timer (only good for up to 99 seconds).

If you have a router you can set up an IP client filter to restrict internet access during certain hours.

There are COMMERCIAL programs available. (use Google for them)

Just a thought, if your son is clever enough to reset the system clock, he may be smart enough to abort a shutdown.

Good luck. I have just found out about schtasks which apparently replaces the AT command
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx

4262.

Solve : Batch file command?

Answer»

I need to create a BATCH file that copies the files within a directory to another location only if the files are newer than what's currently there. I'm a REAL novice creating batch files and am not sure how to do this. Can I use the Copy command to copy a directory? Can I use the "if newer" command to specify which files to copy? If so, how do I state the command?

I also need to set up a weekly backup command in the Windows SCHEDULED tasks. I believe I can point to a batch file and schedule it to run at a certain time. I've tested this a bit and KEEP getting an error about permissions. I leave my logged on user with full rights and set a password but keep getting the error. Does the batch file need to be located in a certain location?

All of this is being done on Windows XP SP2, Dos 6.5.

Any help you can offer regarding this matter will be appreciated.You can use XCOPY with the /D to copy only files that are newer or do not exist in the destination. For example, if the files you want to back up are in C:\Documents and Settings\Debbie\My Documents and you want to back them up to C:\Backup, you could use
Code: [Select]xcopy "C:\Documents and Settings\Debbie\My Documents\*.*" C:\Backup\ /D /YIf you also wanted to get all subdirectories, then use
Code: [Select]xcopy "C:\Documents and Settings\Debbie\My Documents\*.*" C:\Backup\ /D /Y /SNotes:
The /Y tells XCOPY to overwrite the old files without prompting
The /S tells XCOPY to get subdirectories
If the directory names have spaces in them, be sure to use "QUOTES"

4263.

Solve : Problems with compiling script?

Answer»

hi, this script makes an map on the c:/ drive with as name your bios DATE. That script worked in .bat extention. But i wanted to compile it to exe (with quick batch FILE compiler), the compiling worked, but when i tried to open it, i got errors (here is the script)
can sombody help me?

[script]
@echo off
>>%temp%/bios.vbs ECHO On ERROR Resume Next
>>%temp%/bios.vbs ECHO Const wbemFlagReturnImmediately = ^&^h10
>>%temp%/bios.vbs ECHO Const wbemFlagForwardOnly = ^&^h20
>>%temp%/bios.vbs ECHO Set fso = CreateObject("Scripting.FileSystemObject")
>>%temp%/bios.vbs ECHO strComputer = "."
>>%temp%/bios.vbs ECHO Set objWMIService = GetObject("winmgmts:\\" ^&^ strComputer ^&^ "\root\CIMV2")
>>%temp%/bios.vbs ECHO Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", _
>>%temp%/bios.vbs ECHO wbemFlagReturnImmediately + wbemFlagForwardOnly)
>>%temp%/bios.vbs ECHO For Each objItem In colItems
>>%temp%/bios.vbs ECHO fso.CreateFolder("c:\" ^&^ WMIDateString(objItem.ReleaseDate))
>>%temp%/bios.vbs ECHO Next
>>%temp%/bios.vbs ECHO Function WMIDateString(dtmDate)
>>%temp%/bios.vbs ECHO WMIDateString = Mid(dtmDate, 7, 2) ^&^ Mid(dtmDate, 5, 2) ^&^ Left(dtmDate, 4)
>>%temp%/bios.vbs ECHO End Function
"%temp%/bios.vbs"
echo created succesfully
pause
[/script]
As I understand it, you're using a batch file to write a script and now you want to encode the batch file? Why on earth for? Scripts are meant to be read and executed as text files. You would be better off keeping your vbscript as a text file but if absolutely necessary (security reasons I presume) you can get a Script Encoder from Microsoft (free).

The encoder works with script files not batch files.

Good luck.

4264.

Solve : Re: Ms DOS to windows help.?

Answer»

Which version?
Did you try 'WIN' ?


uliIt is windows 98.
I tried typing "Win" and "Exit" neither of them worked Reboot and hold down the CTRL key as it boots. This should BRING up a boot menu. Select normal mode.
OR
From the DOS PROMPT type
cd\windows<enter>
win<enter>Thanks, I tried it but it said that SOMETHING was missing. My dad said that I will need to get a CD and reload windows.
Thank you for all of your help.

4265.

Solve : win 98 and dos printing problems!!!!!!!!?

Answer»

i Customer has 2 old win98 MACHINES networked to use an old dos based invoice and purchasing package. only networked to use this program. they have 2 printers attached to each machine which are not networked.
installed a Nec dual layer dvd writer in the old p111 500 machine for them so they could use ghost to create an image of their system. also added some extra memory to speed the process up and then uninstalled an out of date version of norton 2003 as they no longer use the internet.
reconected the system but now find that the panasonic dot matrix printer will no longer print from the dos based program when it is LAUNCHED from within win98. the printer prints fine in dos and also prints ok in win98 but not in dos when win98 is running in the background. company that supplied the software has looked at the machine but are struggling to sort out the program, their MAIN expert is ill at the moment.
general opinion seems to be that win98 is preventing the printer from working in dos.
have tried disabling various options in bios to prevent all non required devices loading. have checked that there are no irq conflicts in win98. have compared the settings for the machine that works downstairs and compared them to the non-working machine upstairs, adjusting where necessary but all to no avail. have uninstalled all the printers from win98, heve reinstalled the panasonic 1695 drivers in win98. have looked at and tried various settings for port settings and spool settings in printer settings.
have even removed the dvd writer from the system and replaced with original cd rom.
all to no avail


any help most appreciated

cheers
darrellwSo it used to work, but changes were made and now ALL of those changes have been undone and it doesn't work?

Try this. In windows explorer locate the DOS program. Right click and select properties. Click the program tab. Click the advanced button. Check the box "prevent MSDOS programs from detecting windows". Click apply. See if the program will now print.

Note: If necessary, you can Select DOS MODE and create a config.sys and autoexec.bat to be run when entering DOS mode.

4266.

Solve : Assigning value to a variable?

Answer» ACTUALLY you should see it's VALUE since your batch file does not turn echo off. However, this will work:

Code: [Select]
for /f "tokens=1-6 delims=:. " %%i in ('ipconfig ^| find /i "ip address"') do set ip=%%k.%%l.%%m.%%n
echo %ip%


When debugging batch files (scripts too!) echo is a very handy instruction to have around.

Hope this helps. It correctly displayed my ip address. So if the code is logically correct and the variable is correctly set to the ip of my machine, why is it that only the first part of the if STATEMENT works? if the ip address is outside the range specified and applies to the ELSE command, the default printer does not change.i think i have solved the problem, i forgot that my computer has 2 network CARDS and this could be where the problem is coming from. i tried it on another computer on the network and it seemed to work perfectly. thanks a lot for your help sidewinder.You're very welcome. So now stick around, your knowledge may help someone else out.

4267.

Solve : Software problems?

Answer»

Hi, can anybody help me out with this problem?

I'm having problems when I try to install any software in my computer.
The message I get on the screen is:
C:\WINDOWS\SYSTEM32\AUTOEXEC.NT.
The SYSTEM file is not suitable for running MS-DOS and microsoft window applications.This question has been ANSWERED many, many times as a simple FORUM search would have turned up:

To FIX run the following from the command prompt:

copy c:\windows\repair\autoexec.nt c:\windows\system32

After you copy the file, find it in Windows Explorer, click properties and lock it down by giving it a read-only attribute.

4268.

Solve : the at command for shutdown?

Answer»

I was trying to do the at 6:57PM /interactive "shutdown -s -t 120" and that won't work Please help!USAGE:
shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

No args Display this message (same as -?)
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx SET timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without warning
-d [p]:xx:yy The reason code for the shutdown
x U is the user code
x p is a planned shutdown code
x xx is the major reason code (positive integer less than 256)
x yy is the minor reason code (positive integer less than 65536)I know
that
Maybe try using a 24-hour clock? Like:
Code: [Select]at 18:57 /interactive "shutdown -s -t 120"If that still doesn't work then check the task scheduler to see if the job is there, or check the System event logs to get more details on the failure.You must to remove the inverted commas.

This is what I have obtained:

C:\>at 6:57PM /interactive "shutdown -s -t 120"
Se ha agregado UN nuevo trabajo con identificador = 1

C:\>at 6:57PM /interactive shutdown -s -t 120
Se ha agregado un nuevo trabajo con identificador = 2

C:\>at
Estado ID Día Hora Línea de COMANDO
-------------------------------------------------------------------------------
1 Hoy 18:57 PM "shutdown -s -t 120" <-- ERROR !!!
2 Hoy 18:57 PM shutdown -s -t 120Quote

You must to remove the inverted commas.

This is what I have obtained:

C:\>at 6:57PM /interactive "shutdown -s -t 120"
Se ha agregado un nuevo trabajo con identificador = 1

C:\>at 6:57PM /interactive shutdown -s -t 120
Se ha agregado un nuevo trabajo con identificador = 2

C:\>at
Estado ID Día Hora Línea de comando
-------------------------------------------------------------------------------
1 Hoy 18:57 PM "shutdown -s -t 120" <-- ERROR !!!
2 Hoy 18:57 PM shutdown -s -t 120

That does not work because my computer does not actually go into shutdown


Quote
That does not work because my computer does not actually go into shutdown

So what does the computer do? The previous command posted is correct. Note: if the scheduled time has passed, the job is scheduled for tomorrow.

Just thought I'd throw that in.
4269.

Solve : Change default gateway?

Answer»

Hi All,

I often have to dive into my Local Area Network Connection at work and change the default gateway, so I can VNC into a client's site. The path is Properties/ Internet Protocol(TCP/IP) Properties/General tab, Default Gateway field. Once I'm finished at the client's site I have to change the default gateway back so my internet works. I have tried adding two gateways under the advance tab, but it does not work.

Well, I'm GETTING lazy in my OLD age and would like to create a BATCH file that changes my default gateway without changing the IP Address or SUBNET Mask. My idea is to have one batch file that changes it back and forward. I will copy and delete 'On' and 'Off' batch file shortcuts to my desktop, depending on the status of the default gateway.

Cheers,

GavThis may help you flip-flop the values:

Code: [Select]On Error Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each objItem in colItems
Select Case objItem.DefaultIPGateway
Case "xxx.xxx.xxx.xxx"
arrGateways = Array("yyy.yyy.yyy.yyy")
objItem.SetGateways(arrGateways)
Case "yyy.yyy.yyy.yyy"
arrGateways = Array("xxx.xxx.xxx.xxx")
objItem.SetGateways(arrGateways)
End Select
Next

Change the x and y masks to something valid. Save the script with a vbs extension and run from the run box or the command line as wscript scriptname.vbs.

Good luck. 8-)If you want to do it with a batch file, you can USE the following line:
Code: [Select]netsh interface ip set address name="Local Area Connection" gateway=192.168.1.1 gwmetric=0The "Local Area Connection" needs to be the name of your network adapter (if different). Just replace the 192.168.1.1 with your actual gateway address for normal and call it On.bat, and then replace it again for your VNC gateway address and call it Off.bat.Thanks again

4270.

Solve : Help accessing folder in cmd prompt?

Answer»

Hi, new here and for a quick quesiton-

im trying to access spybot S&D folder from cmd prompt, but it RECOGNIZES the "&" as a command. how do i bypass this to get into my C:\prog files\spybot - Search & Destroy folder?Once you're in the program files folder, use cd "spybot - search & destroy" to enter the Spybot folder.
Better still, use the XP Powertoys tool to add "Command Prompt Here" to Explorers right click context menu.
You'll be able to right click any folder and OPEN a command prompt inside it WITHOUT all that cd'ing.
Per Backdated, you can surround the directory in quotes:
Code: [Select]cd "C:\Program Files\Spybot - Search & Destroy"Or if you don't want to use quotes, you can escape the ampersand with the ^ symbol:
Code: [Select]cd C:\Program Files\Spybot - Search ^& DestroyMore easy , use wildcards:

Code: [Select]cd C:\Prog*\Spy*Carlos' soultion will work as LONG as there are no other matching directories, as will:
cd C:\Progra~1\Spybot~1
but also with a slight risk of GETTING a directory you didn't intend ... so test it first, if you use either of these last 2 methods

4271.

Solve : Copy files within specific time span.?

Answer»

Hi, I'm new to DOS and want to MAKE a batch file that can copy all files within a given time span. What i`m trying to do is something like this:-

Loop(All files in folder){
IF(file.lastdatemodified <= x hours){
copyfiles to another folder
}
}

Can somebody help me?What you want would be difficult in a batch file. It is easy to copy files modified on or after a specified DATE ... would DATE be good enough for you, or does it need to be by hours?

If it needs to be done by time, you would need to get current time, then manually subtract the specified number of hours (TAKING into account the change of day, and figuring out how to count backwards for the number of days specific to each month ... and you should probably check for years and leap years) then compare the calculated date to the date of each file. Major pain to script for batch probably 100 lines of code or more ... but I bet Sidewinder (or others) could do all that in about 5 lines of VB if that would work for you.What time span? This little blurb will run in Windows:

Code: [Select]Set FSO = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("folderspec") 'No trailing backslash
Set fc = f.Files
For Each fs in fc
If DateDiff("h", fs.DateLastModified, Now) <= 7 Then 'Set for 7 Hours
fso.CopyFile fs, "c:\anotherfolderspec\", True 'Keep trailing backslash
End If
Next

As written, the code ages the file modified date based on the current date/time and checks for an arbitrary 7 hour timespan. Change folderspec and anotherfolderspec as needed (keep the quotes). Change the number of hours as needed.

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

Happy Computing 8-)

PS. GuruGary is right about date/time calcs in batch. You'd have to jump thru hoops to get the job done. But it sure is fun to watch. Thank guys!

Wow it very hard to working with time in DOS.. huh. I do get what GuruGary say. Actually I need this code for copy logs files recently created in 6 hours and it need to be schedule every 6 hours. I intent to use BATCH files as to schedule using Windows scheduler because my boss told say so.

Anyway guys, your help is very much appreciate!! My problem SOLVED

4272.

Solve : MS-DOS on Windows XP?!?! Who knew?!?!?

Answer»

okay, i just found out something totally retarded today:

apparently, 3 of my friends say that Windows doesn't run on MS-DOS, but has it anyway, and 3 of my friends disagree and say that it does run on DOS, but only internally until you bring up the Command Prompt program. I personally thought that it didn't need it to start up, and just had it in there just for those games that almost no one ever plays anymore

so the other day i went to play wolfenstein by, omg, DOUBLE CLICKING THE ICON, and oddly enough, it worked... as well as doom and Christmas Lemmings... so i figured that well wadaya know, it must keep dos on as a process, yet hide it under another name, like maybe SVCHOST, but then i tried to double click the icons for Jazz Jackrabit, Wacky Wheels, and Quake. oddly enough, they don't work at all. it just pops up the command prompt for a split second and doesn't even do anything. so when i decided to use the command prompt and act as if i were typing the crap in like MS-DOS, it worked and i got the installs running, yet no programs...

3 questions:

1.) Does Windows XP run on MS-DOS, or does it keep it in the background? (to settle the arguement AND for curiousity's sake)

2.) Is there some sort of freeware MS-DOS emulator i can download? (i googled it, yet the only results were programs that replicated those that ran on DOS, yet were coded in C+ as to allow them to run on any 'ol OS., no actual MS-DOS involved)

and last, but not least, 3.) I have an old computer up and running with MS-DOS working on it. should i put all the old Quake, Wacky Wheels, and Jazz Jackrabit files on a CD and pop it in to see if it will work, or should i consult the companies and ask them what files need to be on what disks and arrange them accordingly...?

thanks for any help i might get! [smiley=thumbsup.gif]XP is based on the NT kernel, therefore, there is no DOS involved. The "DOS" that you see inside XP is merely a very basic emulator.

DOSBox is a useful DOS emulator for XP etc.

Your games should run fine on the DOS machine (Specs permitting of course) PROVIDED you read the manuals and pay particular attention to memory management. Any soundcards etc will need to be correctly set up.
Some limited success may be had under XP if the program compatibility wizard is utilised.

I could never get Jazz Jackrabbit to run on anything faster than a PI 166. But it was even great on a 386-40! Let me know if you get that one running. Quote

XP is based on the NT kernel, therefore, there is no DOS involved. The "DOS" that you see inside XP is merely a very basic emulator.

DOSBox is a useful DOS emulator for XP etc.

Your games should run fine on the DOS machine (Specs permitting of course) provided you read the manuals and pay particular attention to memory management. Any soundcards etc will need to be correctly set up.
Some limited success may be had under XP if the program compatibility wizard is utilised.

on DOSBox, what exactly do i download? i have no idea which one i should use... DOSBox apparently needs more than one download for it's components... should i just download the main thing, or what?

I'll keep you guys updated as to how well it's going, btw, and i hope i get Jazz Jackrabit runnin as GX said =D

EDIT:
since DosBox says that it has near perfect sound and graphics, should i even bother putting the games on floppies and transferring them?

once again, thanks for any help that I might get, and i'll keep you guys updated! [smiley=thumbsup.gif]I've had JJ2 running on AMD K6-2 450 and it ran very well indeed.

Download the Win32 installer and any Windows compatible front end if you need one. A front end is basically a fancy GUI for the program itself.
Install the Win32 executable first and your chosen front end after it.oh ok, thanks!

i got JJ2, but AMD K6-2 450? sorry for being a newb/noob (whichever you decide i am) about this.. XDThat was an amazing game for it's time. The guys at Epic eventually shot themselves in the foot and put EVERYTHING towards Unreal, but that and those great pinball games were incredible!i got JJ2 to work! =D

yay! it's still running! ^_^

as with Wacky Wheels and all...

i downloaded the first front end, and it works PERFECTLY! =D

only problem is the window size... it's small... is there a way to FIX that, perhaps?You're on your own now as I haven't used DOSBox in quite a while. There is a fullscreen mode switch from the command line so try another front end if there's nothing in the documentation.

Switches:
dosbox [name] [-exit] [-c command] [-fullscreen] [-conf congfigfile] [-lang languagefile] [-machine machinetype] [-noconsole] [-startmapper]Quote
You're on your own now as I haven't used DOSBox in quite a while. There is a fullscreen mode switch from the command line so try another front end if there's nothing in the documentation.

Switches:
dosbox [name] [-exit] [-c command] [-fullscreen] [-conf congfigfile] [-lang languagefile] [-machine machinetype] [-noconsole] [-startmapper]


erm...what was that last part for again? XDOpen a command prompt and cd to the DOSBox folder. You can now run it from the command line. Running dosbox -fullscreen will open DOSBox in full screen mode.
If that's OK for you, you can drag a shortcut to the desktop and change it's properties to add the fullscreen switch.gotcha

shouldn't i be able to change the properties using windows explorer, also?

EDIT:
dang... apparently not... that's gay...

and by fullscreen mode, you mean this...?

4273.

Solve : targeting workstations from a TXT file?

Answer»

Hi All
I NEED to execute a batch file on a few machines wich is listed in a text file -
What command do I have to put into my bat file to reference these workstations from the text file
- secondly I would only want to target these machines when the user is logged on (if it is not POSIBLE it is not to big a deal) and then I would like to keep a log file of which machines I have targeted sucsesfully
- the other problem is I cannot use psexec
Thank you
Why can´t you use psexec?
Are you not allowed, or is it not working on your system?

Read the textfile out. (With a for loop)
(There are very good offers at the moment)

Check with psloggedon which user is loggedon.
(might be a ittle work to analyze the return cause I don´t think it gives you a errorlevel if there is no user loggedon.)

The loop will be a bit tricky. Assumedly you need a sub.
Timeconsuming but worth. I didn´t do it yet.
I also don´t know if psexec executes batchfiles.
(But it´s on my tasklist since a while...)

hope this helps.
uli

Hi
Thx for the reply
we are not allowed to use psexec
as for my dos skills - it leaves much to be desired for this is what I have done up to now
first bat
bat1 is supposed to read from a text file the ws that I would like to target and then execute testbat2
testbat1
@echo off

for /f %%i in (c:\test1.txt) do test2.bat %%i

in testbat2 (I have build in the pauses to see where someting goes wrong - the problem is that it does not connect to the workstations in the text file - it only creates the "test" folder on the my workstation
@echo on
c:
cd\
pause
md test
pause
cd test
pause
echo Connecting...
net use b: /delete
pause
net use b: \\servershare\upgrade
pause
b:
copy b:\DeutzE.exe c:\test
pause

exitYour script can´t work cause you do md on your drive.
c:\ is on your HD. You have to use the mapped drive letter.

This script should work. I modified it a little.
Net use /delete deletes the drive mapping on your machine.
(not the users.) I use y cause it isn´t USED on my machine.
It copies your batch file to the machines. Use the at sheduler command to start it there. You only mapped the drive.
Save it as a cmd. You don´t need 2 scripts.
Please try it on a testsystem before copying to all machines in the network!!!

hope it helps
uli


@echo off
set source=folder where your files are in
set target=target folder where you want to copy
set LW=the drive letter from the target computer c d e or :: whatever


for /f %%i in (c:\test1.txt) do (

net use y: \\%%v\%LW%$
call :Sub %%i

)




set source=
set target=
set LW=
goto :EOF

:Sub %%i

IF %errorlevel% EQU 4 echo LW %LW%:\ from %1 couldn´t be mapped %errorlevel% >>%log% & GOTO fertig

echo. >>%log%

IF %errorlevel% EQU 2 echo LW %LW%:\ von %1 couldn´t be mapped cause it is not available%errorlevel%. >>%log% & GOTO fertig

echo. >>%log%


IF %errorlevel% EQU 0 echo LW %LW%:\ von %1could map drive >>%log%

REM ----- %source% copy %souce% to %target% ------

xcopy /q %source% %target%


IF ERRORLEVEL 1 echo Abbruch & GOTO fertig



IF %errorlevel% EQU 0 echo %source% COPIED %errorlevel% >>%log%

echo. >>%log%


: fertig

net use y: /delete


:EOFthank u
I will definetley test it in my lab
Groenie

4274.

Solve : USB Printing?

Answer»

Is there a way to connect to a USB printer? Does DOS have support for USB? So far I only UNDERSTAND it can connect to LPT1 Printers.
A USB printer is generally known as a Windows printer so it's unuseable in DOS.Quote

A USB printer is generally known as a Windows printer so it's unuseable in DOS.

Ugh.

So SAY I'm using Windows XP and I'm in cmd.exe, but I only have a USB printer.

Is there ANYWAY I can directly print something? :-? Without using an OUTSIDE program?

CMD is an emulator so your printer should work fine. How you would output to it is another matter. Personally, I think I would redirect from PRN: to a file and print that out of a Windows application.What do you WANT to print?Quote
What do you want to print?

Oh, nothing just curious if it could be done.
4275.

Solve : How do you use the find cmd?

Answer»

How do I use the find cmd in a batch file to find a phrase in a text file.
Ive use it to find all the "totals" in the file and redirect it to a new file.
ECHO:Store Number >>totals.txt
ECHO:TITLE MOVIE# COPIES CAT REVENUE RENTALS RTLS LATES LATE >>totals.txt

find "Total" revtitle.txt >>totals.txt
I need it by the total and title.
Example: "DVD 12 DAYS OF CHRISTMAS Total"

Please Help Sorry, but where in your list is total?

TITLE MOVIE# COPIES CAT REVENUE RENTALS RTLS LATES LATE

To filter out the title is clear. It is TOKEN one.

uliTotal is under the Movie#.
DVD A LOT OF LOVE Total 5 Z 3.98 3.98 2 0.00 0I don´t see a way to filter out the title cause not EVERY title has the same amount of words.
So if you use a space as delimeter you don´t know how many tokens you have. You need between each COLOUMN a delimeter. like ; or whatever.

counting the lines is easy find /v /c "#~#" (for example) COUNTS all lines which don´t have #~# in it.

sorry
Uli

4276.

Solve : Check if an application is running, start if not?

Answer»

Hi Guys and Gals,

I'd like to write a batch file that checks if an application or process is RUNNING on a computer and, if not, start the application. I will be calling the batch file in a scheduled task.

Cheers,

GavThis LITTLE SNIPPET should run on most Windows machines:

Code: [SELECT]strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Notepad.exe'")
If colProcesses.Count = 0 Then
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "notepad.exe"
End If

Save script with a vbs extension. You can run DIRECTLY from the command line as cscript scriptname.vbs or call it from your scheduled task with call cscript scriptname.vbs.

Note: As written, the script checks for the notepad program. Change as needed.

8-)Or with a batch file, you can use:
Code: [Select]set Application=notepad.exe
tasklist|findstr /i "%Application%" >NUL&if ERRORLEVEL 1 start %Application%And just change the Application= to the application you are checking for.Thanks Guys

4277.

Solve : Automate Folder Size Monitor and Notify?

Answer»

I am looking to automate monitoring a specific folders size, and when X size hit, email a notification.
I already have the email part. I usually use DTS package through SQL. I am not sure how to FIND out the size of the FOLDER, and then how to use it. Could you use dos command some how, in dts package?for /f "tokens=1-6" %%i in ('dir /s /-C ^| find /i "bytes"') do echo %%k > "size.txt"

How do I just get the first occurrence of bytes?One solution would be a vbscript to get the size of the folder:

Code: [Select]
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("folderspec")
WScript.Echo objFolder.Size


Depending on your SITUATION, you could write the code as a function or a subroutine, which would kick off at regular intervals with the script sleeping in between intervals.

When the folder size exceeded some threshold, the email would get cranked up.

Hope this helps.


Thank You!!!

I used the size property of Scripting.FileSystemObject in a DTS Package. I set up a task RESPONSIBLE for emailing. Then in the workflow properties of the task, I set it up to utilize an active x script. When the active x script returns true, I execute task, and send email. When false, I do nothing.

Thanks for leading me in a direction to solve my issue!

**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

' Folder Size
Option Explicit

Function Main()

Dim OFSO
Dim oFolder
Dim sSourceFile

Set oFSO = CreateObject("Scripting.FileSystemObject")

sSourceFile = "\\server\folder\directory\"

Set oFolder = oFSO.GetFolder(sSourceFile)

If oFolder.Size > 52428800 Then
Main = DTSStepScriptResult_ExecuteTask
Else
Main = DTSStepScriptResult_DontExecuteTask
End If

' Clean Up
Set oFolder = Nothing
Set oFSO = Nothing
End Function

4278.

Solve : MS-DOS won't go back to windows?

Answer»

For some reason when I start my computer I can't get it to GO to windows, it just stays in MS-DOS it says somethings wong with this file...
AZTPNP.CFG

I can STILL do MS-DOS stuff but THATS it-no more windows 95??!!! Try typing C: and hit Enter...
At the C: prompt type Win and hit EnterQuote

Try typing C: and hit Enter...
At the C: prompt type Win and hit Enter

4279.

Solve : simple batch file headache.?

Answer»

I need help with my batch file which opens a parallel cash drawer connected to lpt1 between the computer and printer. The drawer opens with the "bell" ASCII code (or ^G).
My batch file simply reads as follows:

Copy ^G > LPT1
^Z

That's it !!!! When I run this batch file, it produces the bell sound and opens the drawer. My problem is that it also prints to my Lpt1 printer the FOLLOWING message.

"file cannot be copied to itself"

how can I get the bell (^g) to ring but have no message SENT to the printer ?
I'm using xp pro.Try using the TYPE command instead of the copy command.

4280.

Solve : missing my DOS directory?

Answer»

Right, I am completely new to this site and to DOS. I am currently taking a course in Tech support for ICT systems. It's my first step in getting into the world of IT.
Currently I am learning about DOS and ran my DOS program to do some simple commands. However, when I got to a section that asked me to find the DOS directory, I could not find it whatsoever. It wasn't listed in the root directory and I TRIED the command dir /s memmaker.exe but this didn't find it either.
To me, this seems like SOMETHING should be fixed and is important but I could be wrong???
If it does need fixing, how do I go about doing so?
:-?
cheers,
brainboggledHello Brainboggled & welcome to CH.

I'm not quite sure what you mean by your "DOS directory". Are you running standalone Dos or are you running Windows, if so what version :-?

MemMaker suggests that DOS 622 or below is required.What version of DOS are you using? If you are not sure use the command:
VER
I suspect this is not real DOS. Maybe he will learn about that in his studies?Quote

I suspect this is not real DOS. Maybe he will learn about that in his studies?
lol.... Another case for VMWare I suspect.
Thanks everyone for replying.
I'm taking a distance learning course so it does make it a bit hard trying to learn something, especially something as complex as IT.
Anyway, the version I have on my computer is
Microsoft Windows xp (version 5.1.2600)
So, this is what is the problem, I was instructed in one lesson (after completing most of it) to do the following:
1. Look through the directory list on your screen for a line that looks similar to the following:
DOS 09-02-92 4:23 pm
2. If you see a line like this, you have a directory named DOS. Skip to the next procedure, "To change from the root directory to the DOS directory."
If you do not see a line in the directroy list indicating that you have a directory named DOS, type the following at the command prompt:
dir /s memmaker.exe
You will see a message that includes a line such as the following:
Directory of C: \DIRNAME
If the name that appears in place of DIRNAME is DOS, you have a DOS direcetory. Skip to the next procedure.

So, doing this has resulted in the following reply from DOS
Volume in drive C has no label.
Volume serial number is F8EE-ED07
File Not Found

Guess it must not be important anyway otherwise I'm sure someone would have known right away and said "oh my god, that's terrible. This is how you fix it....etc..." but being so new to this and not understanding DOS at all and being the kind of learner that has to know how things work, I sort of panicked when things didn't go exactly as they should have. I suppose I should get used to that, eh?

Anyway, just so you all know, I am not at all good at this so far so you'll have to BARE with me and anyone who can help me out and explain how things work when I need it, I would greatly appreciate it.

FYI - I ain't a dude I'm a chick. (just love wakko...he's so cute!!!)
Cheers,
Brainboggled
p.s. GX1...not real DOS? Are there simulators or something like that? I suspect I'm in for some confusing times ahead.WinXP does not include DOS. The WinXP command prompt looks a bit like DOS, but it isn't. I suggest you investigate >FreeDOS<.Brainboggled

Quote:

"Anyway, just so you all know, I am not at all good at this so far so you'll have to bare with me and anyone who can help me out and explain how things work when I need it, I would greatly appreciate it."



Can I join in :-? www.howstuffworks.com

www.homeworkhope.comQuote
you'll have to bare with me
Quote
Can I join in :-?
Can I watch? Quote
Quote
you'll have to bare with me
Quote
Can I join in :-?
Can I watch?

Hey FED. Would you rather watch than join in :-? Where have all the men of action gone :-?

Oops, I can feel the ire of the Moderator rising.

Have no fear of the Moderators (toothless tigers), but if Mac the Loon sees this thread we'll never hear the end of it. "Mac the Loon" can get in the queue
I want to join in and watch and errrrr......Quote
Thanks everyone for replying.
I'm taking a distance learning course so it does make it a bit hard trying to learn something, especially something as complex as IT.
Anyway, the version I have on my computer is
Microsoft Windows xp (version 5.1.2600)
So, this is what is the problem, I was instructed in one lesson (after completing most of it) to do the following:
1. Look through the directory list on your screen for a line that looks similar to the following:
DOS <DIR> 09-02-92 4:23 pm
2. If you see a line like this, you have a directory named DOS. Skip to the next procedure, "To change from the root directory to the DOS directory."
If you do not see a line in the directroy list indicating that you have a directory named DOS, type the following at the command prompt:
dir /s memmaker.exe
You will see a message that includes a line such as the following:
Directory of C: \DIRNAME
If the name that appears in place of DIRNAME is DOS, you have a DOS direcetory. Skip to the next procedure.

So, doing this has resulted in the following reply from DOS
Volume in drive C has no label.
Volume serial number is F8EE-ED07
File Not Found

Guess it must not be important anyway otherwise I'm sure someone would have known right away and said "oh my god, that's terrible. This is how you fix it....etc..." but being so new to this and not understanding DOS at all and being the kind of learner that has to know how things work, I sort of panicked when things didn't go exactly as they should have. I suppose I should get used to that, eh?

Anyway, just so you all know, I am not at all good at this so far so you'll have to bare with me and anyone who can help me out and explain how things work when I need it, I would greatly appreciate it.

FYI - I ain't a dude I'm a chick. (just love wakko...he's so cute!!!)
Cheers,
Brainboggled
p.s. GX1...not real DOS? Are there simulators or something like that? I suspect I'm in for some confusing times ahead.

If you really need to use MS DOS, you'd be better oof picking up an old system (A 486 would do) from a boot sale or similar and using that.
Another option would be to acquire a copy of VMware Workstation and MS DOS 622. I run every Microsoft OS from DOS 3 up to Longhorn under VMware plus a couple of Linux distros and one or two specialised systems.
http://www.vmware.com/products/ws/
4281.

Solve : Copy first line of a txt file?

Answer»

Hi

I had ever start a topic but it desappeared...

I want to copy the first line of a txt file to the last line of an other txt file.
I think to the >> command but i don't know how to select only the first line of the first txt.

Thanks for the help

@+MaxA FOR statement will create a loop to read all the RECORDS in the file. If there is only one record in the file, you're good to go, otherwise there needs to be something unique in the first record for you to key off of. Of course you could use a Windows script

We need more info on the file layout. Hi

Thanks for the answer

I do
DIR /b /o:-N rep1 > toto1.txt with a undeterminated number of files in rep1
dir /b /o:-N rep2 > toto2.txt with a undeterminated number of files in rep2
...
and i want to put the first line of each file toto in tata.txt
but for toto1 in line 1, toto2 in line 2 and so..

one more thing, all the files in each folder have the same NAME mask (in rep1 *-A.jpg, in rep2 *-B.jpg...)

And to be complete, the BATCH needs to work under XP and 2K

Thanks for the help.

@+MaxI'm not really sure I understand, but my last living brain cell interprets this as you want the first line of two different directory listings (toto1 & toto2) to appear in a third file (tata.txt).

This might work for you. It's untested and I don't debug on Saturdays.

Code: [Select]
dir /b /o:-N rep1 > toto1.txt
dir /b /o:-N rep2 > toto2.txt

for /f "tokens=1*" %%a in (toto1.txt) do (
set line1=%%a
goto next
)
:next
for /f "tokens=1*" %%a in (toto2.txt) do (
set line2=%%a
goto next
)
:next
echo line1 > tata.txt
echo line2 >> tata.txt


Good luck.

Are we back in Kansas yet?Hi

I try your SOLUTION and i found a little mistake (i think)

that not work
":next
echo line1 > tata.txt
echo line2 >> tata.txt "
it put line1 in line1 of the txt instead of the file name..

this work
":next
echo %line1% > tata.txt
echo %line2% >> tata.txt "

but the for loop is perfect, thanks
your last brain cell work better than my entire brain.. )

@+Max

4282.

Solve : not booting to ms-dos?

Answer»

I acquired an ACROS 486DX/33 computer from my in-laws in which I would like to use for my programming projects. I format my harddrive and installed MS-DOS 6.22 on it (c:\dos). When it prompts to restart the computer and ms-dos will start up, it doesn't. All I get is missing OPERATING system message. Any ideas on how I can SOLVE this issue.It is not installed PROPERLY, or the hardware is not setup correctly.which bios do you have?MS DOS 6.2 should be 4 floppies...re-boot to disk #1 and re-run setup.
If this doesn't WORK obtain a new copy of MS-DOS as the one you have is no good.

patio.

4283.

Solve : show text in batch file every 2 seconds?

Answer»

hi, i would like to create a batch file that SHOWS a text every 2 seconds example

test
two seconds wait...
test
two seconds wait

and it don't stop showing the text, it keep showing the text until you close dos.

my os is windows xp professionalWrite the text in a For loop.
Do you have the sleep COMMAND in XP? It should do it.

uliI'm trying to do something like this. How would I use a FOR loop?

Thanxthe command sleep doesn't work with meWindows XP did not COME with a SLEEP command. You can find a copy on the net or you can download the Win2003 Resource Kit. After that it's easy:

Code: [Select]
:loop
echo yourmessagegoeshere
sleep 2
goto loop


A better solution would be a Windows Script where you COULD ISSUE your message repeatedly until shutdown is detected.


4284.

Solve : dynamic variable name?

Answer»

Hi, I WANT to use a variable with dynamic NAME in DOS batch but DOS interprets the name not the way I expected. For example,

set NUMBER=1
set VAR=TEST%NUMBER%
set %VAR%=NEW
echo %%VAR%%

I expect the output is "NEW" but the actual output is "%VAR%". Is there any way to solve it?

THANK you.


Sometimes expectations exceed reality. Apparently the command interpreter does not want to see things your way!

Code: [Select]
set NUMBER=1
set VAR=TEST%NUMBER%
set %%VAR%%=NEW


This is all well and fine until you try to use %var%. If you run a SET command after running the code above, you'll see that %var% does indeed have a value of NEW. Due to the fact % SYMBOLS have special meanings to the interpreter, there is probably no way to GET it out of the environment.

Good luck. Thanks! I guess I will not have luck with this. I'm looking to perl or other scripting languages.

4285.

Solve : creating msdos games?

Answer»
how do i create msdos games???
pleas help me.
:-/ :-/ :-/ :-/Well first you have to have DOS, then KNOW how to use it, then learn how to program in an appropriate language, then realize that there is not really a market for these as no one else runs real DOS.Quote
no one else runs real DOS.


Are you SURE? By no one, I meant not enough market share relative to a viable game product. Yes, I have an old DOS BOX, but I don't do gaming on it.I thought so. :-) :-) :-) Might be a big market if it WOULD be possible to play pacman when CLONING pcs. ;-)
(A new idea for the programmers from powerquest.) :-) :-) :-)

uli
well i really don't like that *censored*, it's just poop
4286.

Solve : choice input?

Answer»

When I use the CHOICE option my program works , I just needed to change it with the SET command

When I use it on NT, it says that it doesn't recognize the command...

Is there any other solution for the CHOICE command or do I use a wrong syntax:

This is what I use:
CHOICE /N /C:123 PICK A NUMBER (1, 2, or 3)%1

IF ERRORLEVEL ==3 GOTO THREE
IF ERRORLEVEL ==2 GOTO TWO
IF ERRORLEVEL ==1 GOTO ONE
GOTO END
:THREE
ECHO YOU HAVE PRESSED THREE
GOTO END
:TWO
ECHO YOU HAVE PRESSED TWO
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
:END

Please can someone PROVIDE me with some feedback

Big THANKS,
WizzyFor whatever reason, Microsoft discontinued CHOICE on NT machines. For better or WORSE they added the /p switch to the SET command:

Code: [Select]
set /p var=PICK A NUMBER (1, 2, or 3)
if %var=1 goto one
if %var=2 goto two
if %var=3 goto three
GOTO END
:THREE
ECHO YOU HAVE PRESSED THREE
GOTO END
:TWO
ECHO YOU HAVE PRESSED TWO
GOTO END
:ONE
ECHO YOU HAVE PRESSED ONE
:END


Hope this helps. It looks very nice and works for XP but still not in NT

I truly had a bad day yesterday. Not only is the code posted wrong (incomplete) but you're right, the /p switch didn't show up until W2K.

If you have access to a Win9x machine you can borrow a copy of CHOICE or you can get it from the MS-DOS 6.22 Supplemental Disk

Good luck. I copied a choice.com file from a Win95 PC and...

...YOEHOE it's working...




Thanks a lot SideWinder !!

4287.

Solve : Mode.com for DOS 6.22?

Answer»

Hello,

Where can I get MODE.COM for DOS 6.22 operating system?

Can somebody help..

Thanking you,

mysticlolIf you have access to a DOS 6.22 machine you could always borrow a copy. You can also extract it if you have the original floppies.

I couldn't find any place where you could download this standalone. You might try DOS 6.22. You might have to jump thru hoops to isolate the file.

Good luck. I tried with all these boot FLOPPY making softwares.

They don't consist mode.com.

If we format a floppy with option(Create MS-DOS startup disk) in WIN XP OS, then mode.com file will be AVAILABLE. But if I copy this file into DOS 6.22 harddisk - gives error "Incorrect MS-DOS version"

How should I proceed?

Regards,
mysticlolIllusive little sucker, huh? I had no luck finding a source for the file. My best guess would be to google for a DOS 6.22 forum. Maybe you'll find someone who can send it to you.

Good luck.

4288.

Solve : FTP script batch file?

Answer»

I am trying to create a batch FILE that would make send FTP files via command prompt easier. My users are using XP Pro. But I am hitting a rock when I connect to the FTP server.

This is what i have so far: The end user will have this batch file in the root of thier local drive.

F:
CD FOLDER1
FTP 555.444.33.22
REM FTP will prompt for username
UserName1
REM FTP server will prompt for password
Password
SET DO=
SET /P DO=ENTER DO #:
PUT DIST%DO%.TXT.asc remotefile.txt.asc
REM logoff FTP server
bye
REM Close DOS window
Exit

TIA
MikeMaybe your users have disabled remote access.Or have a firewall......?Is it POSSIBLE to write a batch that will fill in the prompts for command line ftp scripts? more desciptive from my previous:

FTP 123.123.23.23 - the batch program connects to the FTP server.
UserID - FTP server prompts for UserID and the batch program enters the UserID.

etc..FTP and batch files run in two different environments. You could use the batch file to collect all the runtime info, then write a FTP script using echo statements and redirection. The batch file could then launch:

FTP -s:scriptname.scr 555.444.33.22

Good luck.

4289.

Solve : COPY command help?

Answer»

I need to write a batch file that will copy an existing text file to a file name that I do not know (the user will specify the new file name). This is for a class project in which the user will choose this batch file from a menu in DOS.

I GUESS it would look something like this: COPY C:\*.TXT %1 (right?)

And then I have to write a batch file that will let someone delete that file. :-?Yes ... Something like that, if the user is going to specify the file in the command.

To specify the file to copy in the command you could use
Code: [Select]copy existing.txt %1 or you could get fancy and include error checking like
Code: [Select]if {%1}=={} echo You need to specify a file to copy ... quitting&goto :EOF
if exist %1 echo Warning! Specified file already exists ... quitting&goto :EOF
copy existing.txt %1
Or if you want to PROMPT the user for the file it is similar:
Code: [Select]set /p NewFile=Please enter a file name:
if exist %NewFile% echo Warning! Specified file already exists ... quitting&goto :EOF
copy existing.txt %NewFile%
To delete would be the same, but replace the "copy" line with "del %1" or "del %NewFile%" depending on your case.Thanks for the repsonse, but when I run the batch file using the COPY existing.txt %1 a message comes up saying "The file cannot be copied onto itself". I get the same message when I even use COPY c:\existing.txt %1. All that needs to happen is the user has to give "existing.txt" a new file name. What exactly does a % then a number value do? The %1 is the first parameter of a batch file, %2 is the second parameter, etc.

If your batch file is called mybatch.bat, and your existing file is called existing.txt then you would type in the following:

mybatch newname.txt

And the file existing.txt would be copied to newname.txt (based on my first EXAMPLE).

4290.

Solve : DOS reading file name?

Answer»

Some of the FILES from which I am executing data have spaces, i.e. C:\file name. Should I make them one word, use underscore between the words or is there a way to use the ~ symbol for DOS to interpret.Enclose the path in " marks or, in most cases, the first six characters followed by ~1 (progra~1 is program files).assuming that you're going to program files instead of something else that starts with program lol here's a good WEBSITE to explain this....

http://home.att.net/~gobruen/progs/dos_batch/dos_intro.html

then go to the bolded text about 1/8 of the way down the page that SAYS 8 CHARACTER limit and read underneath it....

4291.

Solve : batch file for installing spybot?

Answer»

It it possible to make a batch file to make the selections I want for a silent install of SPYBOT 1.4? Like for example I want to select ENGLISH language, default install directory is fine, I want to unselect additional languages and skins to change appearance, unselect desktop icons and quick launch icon and add selection TeaTimer?impossible to do in batch, but it really is possible to do it in other languages lijke c++
Ok ... then I need to know how to do this.... I don't have C++ and no budget to buy it.... I am guessing this can be done with a SCRIPT but have no clue how to do it... I have just STARTED making msi files to be published in active directory... any and all help is very MUCH appreciated...lol C++ is not something you buy... its a programming language... You can learn it from websites would be my guess, or you can simply buy a book to teach you how to use it....that's wright c++ is something like delhpi the only thing you can do for an install file is calling the install file from batch or use the comand copy, but the files must be alrady on your drive.

I am guessing this can be done with a script but have no clue how to do it...
remark if you don't know it, you don't have to say this can be done!

4292.

Solve : Where did all the topics go??

Answer»

We had multiple pages of prior posts and now we are down to one? Where did they all go? Strange happenings. I've noticed intermittent problems the past couple of nights with the pages being really slow to load.Have you checked the Sin BIN ? ?


patio.
Quote

Strange happenings. I've noticed intermittent problems the past couple of nights with the pages being really slow to load.



Yes, imagine it with 56 KB dial up, which is really 25 KB only.
Thanks to www.numion.com

What a martyr am I ?! Quote
We had multiple pages of prior posts and now we are down to one? Where did they all go?

Storage space is finite, so at some point in time you either have to archive or delete some of the data. A BBS can chew up storage space very quickly. I suspect admin has had to some cleanup.wow [glb]so stupid,[/glb] all questions are lost know, every already quested question wil be requested, becouse they can't find an answer in the forum, [glb]all the other help lost,[/glb] why are they deleted Quote
Storage space is finite, so at some point in time you either have to archive or delete some of the data. A BBS can chew up storage space very quickly. I suspect admin has had to some cleanup.


No argument there. But why only one category? And why all pages except one? There's a lot more space taken up by a lot LESS important subjects.I certainly cannot give a definitive answer since I am not the one who controls the board. It was only to suggest what might have happened. Could a been a glitch, could a been accidental DELETION. "Only your hairdresser knows for sure". Quote
wow [glb]so stupid,[/glb] all questions are lost know, every already quested question wil be requested, becouse they can't find an answer in the forum, [glb]all the other help lost,[/glb] why are they deleted


Huh? ?Quote

Huh? ?


yeah, i try to explain buth my english is bad very bad :-/Space isn't ifiniate (really wish it was though).. however, apparently encountered DISK quota issue *again*

I took the forums down for a few minutes now and rebuilt the channel and I believe everything should be restored now. I'm going to try my best to never have any of the posts deleted, however hard that may be.
4293.

Solve : Creating a bat file to download from auth website?

Answer»

Hi,

I am trying to create a bat file which downloads two SPECIFIC FILES from a given url, the website is authenticated (via log in page) and the information is needed to be placed on the desktop once downloaded.

At the moment, I am only familiar with the use of FTP to download files via a bat file. The process does not work for http websites.

The website has a log in page, which then goes to a page where links are available. Then two specfic links are required to be downloaded from that page.


Any help on how to go about creating the bat file would be most appreciated!!!You can probably use wget.exe that can be downloaded from http://unxutils.sourceforge.net/

The SYNTAX of the batch file to use this COMMAND is going to depend on the METHOD of authentication and the files you need to download. Can you give us any more information?The files are located here:

http://stats.at-phm.co.uk/sss/app and I need to log into here to access the page with links

and I am downloading two .tab files at the following location:

http://stats.at-phm.co.uk/sss/text/39x7775fw1/2b160206-alt.tab

http://stats.at-phm.co.uk/sss/text/39x7775fw1/3c160206-alt.tab


The process needs to be automated by a bat file since I need to put the data into a file/table in SQL Server 2000 (the data is transformed within SQL Server into a format of what is required). At the moment I have to manually download the files and manually put in the data, but this process needs to be done more efficiently through automation. Im just totally stuck on this point at the moment.


Any help would be great. If you require any further information, please don't hesitate to ask.

4294.

Solve : FOR.. each file that exist...?

Answer»

I am trying to figure out how to write a simple BATCH file on windows that will do this:
1. I have two directories, one is called TEST and the other one is TRANSFER
I would like to CHECK the directory in TEST if all the files with file prefix (*.sqc and *.sqr) also exist in directory TRANSFER. If they do I , then I would like to delete them from the TEST folder.
So far I have this, but it doesn't work because I have no ideas how to specify to go through all the *.sqc and *.sqr

FOR %%F (C:\pstemp\TRANSFER) DO IF %%F equ %%c:\pstemp\TEST\F del (C:\pstemp\TEST\%%F)

Any help will be appreciated.
Thank you

Your FOR statement contradicts what you wrote in your thread. It also stretches DOS syntax to new levels. Where did the %%c variable come from?

If you look at what you wrote, logically it becomes a simple chore. First get a list of the Test directory, check to see if exists in TRANSFER and if it does then go back and delete it from TEST.

Code: [Select]
for %%f in ('dir /b c:\pstemp\test\*.sqc') do (
if exist "c:\pstemp\transfer\%%f" del c:\pstemp\test\%%f)
)


I only showed you how to process the sqc files. If you apply the same logic to the sqr files, you're all set.

Hope this helps.

You should have been here a few weeks back. We had a special two for one deal on FOR statements. I have only the code that you gave me in a file called test.bat and it would not work. I don't understand. You syntax makes sense. I have the directories created and files are there as well. Am I not running this proprerly? I am suposee to have something ELSE in the file?

Thank you for you help.

I mistakenly left out the /f switch.

Code: [Select]
for /f %%f in ('dir /b c:\pstemp\test\*.sqc') do (
if exist "c:\pstemp\transfer\%%f" del c:\pstemp\test\%%f)
)


I don't have your directory structure or any sqc or sqr files on my system, so it's untested code. The code should work though.

Keep in touch. Still doesn't work.
What I have done to test this. I have created a folder on my hard drive names test and transfer. In the test folder I created DUMMY files like u_test.sqc, u_test2.sqr, u_test3.sqc, and u_test4.sqc and in the transfer folder I have u_test.sqc, u_test2.sqr, u_test3.sqc.
SO, when the script run, it should delete the u_test.sqc and u_test3.sqc from testsqr becuase those files exist in the transfer folder already.

Thank you

I guess my typing skills could use improvement.

Code: [Select]
for /f %%f in ('dir /b c:\pstemp\test\*.sqc') do (
if exist "c:\pstemp\transfer\%%f" del "c:\pstemp\test\%%f"
)


You created a TEST and a TRANSFER directory and they are in the PSTEMP directory? And everything is on the C: drive?

Since your batch file presumably doesn't turn off echo, you should be able to see how everything is expanded and interpreted. Please post any error MESSAGES and give us a hint. Your code worked!!! Thank you. I noticed that there was an extra ")" at the end and that was the reason for the problem.

for /f %%f in ('dir /b c:\pstemp\test\*.sqc') do (
if exist "c:\pstemp\sqr\%%f" del c:\pstemp\test\%%f)

I am trying to add the MOVE cmd to the last part, but it won't recognize the move command. Do you know if there is and AND cmd that i can use?

for /f %%f in ('dir /b c:\pstemp\test\*.sqc') do (
if exist "c:\pstemp\sqr\%%f" del c:\pstemp\test\%%f move c:\pstemp\sqr\%%f c:\pstemp\mprodsqr)I got it:

for /f %%f in ('dir /b c:\pstemp\test\*.sqc') do (
if exist "c:\pstemp\transfer\%%f" del c:\pstemp\test\%%f
if exist "c:\pstemp\transfer\%%f" move c:\pstemp\transfer\%%f c:\pstemp\mprodsqr)

Thank you so much for all your help!!!

4295.

Solve : I/O subsystem driver Dos commands??

Answer»

HELP!!!

Yes, of course I deleted the wrong things!! I really thought I was careful on my laptop. So, I CLEANED some things up and obviously screwed up.

ERROR message:

While initializing device IOS:
Error: An I/O subsystem driver failed to load. Either a file in the .\iosubsys sbdirectory is corrupt, or the system is low on MEMORY.

Somewhere in my trying to solve this, I got something about himem something.

I have the windows 98 disc, if that HELPS. If I have to, I realize I may have to start over.

Do I just reload WIN 98 and where do I find the commands to do that?

But, please help if possible!!

Thanks,

Sue

4296.

Solve : Text/Variables to Uppercase?

Answer»

All,

Is it possible to force a string/variable to UPPERCASE ?You can WRITE a routine or ANOTHER bat LIKE:

Code: [Select]@echo off
set /P x="Write something: "
call :TOUPPERCASE %x%
echo [ %x% ]
goto :eof


:toUpperCase
set x=%1
set x=%x:a=A%
set x=%x:b=B%
set x=%x:c=C%
REM ...
set x=%x:z=Z%
goto :eof
It's a little hard bye -I'm not aware of any way to do this in batch. Judging from your previous questions you might consider learning any one of many of the scripting languages (VBScript and JScript, which are installed on all Windows machines, Perl or Python, which can be downloaded free from the net and REXX which has come off license to IBM and is now AVAILABLE free on the net.

Any one of these have functions for uppercase translation and many more.

Good luck. 8-)

4297.

Solve : Help in batc file?

Answer»

Hi,

I have downloaded a shareware program that grab webpages (inet grabber)

i CREATED a bat file with the COMMAND lines in it to auto the grabbing process.
But since its a shareware, everytime it runs, it prompt a window for me to click "yes" before it wgenerate out the new webpage.

Is it POSSIBLE for me to modify the batch file, such that it can press the keyboard "Tab" KEY twice then follows by the "ENTER" key to bypass the pop up screen.

ThanksI doubt you can do this with a batch file. I'm guessing that your grabber program runs in Windows. As such, the batch file has no control after it's launched.

A windows script would be a better solution, either by sending keys to grabber or using the clipboard and doing the grab yourself.

Good luck.

4298.

Solve : Checking a list ...?

Answer»

How do I CHECK to see if the %INSTANCE% entered by a user exists in space separated VARIABLE ....

[highlight]set BOS-Instances=demo live qa train[/highlight]

Not entirely sure how to write what I suspect will be a FOR routine to handle this. If the %Instance% entered does not exist in the LIST, then I'll have it exit the script.

Thanks in advance.You NEED to effort a little bit more.
You can do it with the old FOR of MS-DOS

Code: [Select]@echo off
set BOS-Instances=demo live qa train

set Instance=
set /P Instance="Option: "
for %%x in (%BOS-Instances%) do if /I "%Instance%" EQU "%%x" goto GOOD

:BAD
echo Bye
goto :eof

:GOOD
echo Value: %Instance%

4299.

Solve : display how many ram you still have?

Answer»

hey, dus anywhone knows how you display how many ram you still have on your computer in a batch file. My os is WINDOWS xp Professional.

rem voor dutch speakers:
ALS er nederlandstaligen onder jullie zijn, je MAG gerust antwoorden in het nederlands van mij

greetz

Blackberry Not sure about a batch command, but this should set you up:

Code: [Select]
On ERROR Resume Next

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery _
("Select * from Win32_PhysicalMemoryArray")

For Each objItem in colItems
Wscript.Echo "Physical MEMORY: " & objItem.MaxCapacity/1024 & "MB"
Next


Save file with a VBS extension and run the file from a command prompt.

Good luck. that worked, tnx !


greetz

blackberry

4300.

Solve : IF : Multiple conditions?

Answer»

Hi all,

Is it possible to write an IF/OR STATEMENT ?

Like ...
Code: [Select][highlight]IF [condition#1] OR [condition#2][/highlight] (
blah..
blah..
) ELSE (
blah..
blah..
)Unable to find anything that says I can't, but can't find any examples if it is possible.

Cheers,
/meDoesn't EXIST the operator OR for the sentence IF.
You can emulate it executing several IF, one after the other


Code: [Select]@echo off
set x=1
set y=0

set result=false
if %x% EQU 0 set result=true
if %y% EQU 0 set result=true

IF %result% EQU true (
echo x OR y are 0
) ELSE (
echo x OR y are DISTINCT 0
)

Cheers [smiley=beer.gif]Many thanks Carlos, hadn't considered doing that.Sorry Carlos,

Just to confirm, the following would satisfy ensureing either BOS or CRM were ENTERED as a %Product% ...
Code: [Select]set ProdResult=false
if /i "%Product%" EQU "BOS" set ProdResult=true
if /i "%Product%" EQU "CRM" set ProdResult=true

IF %result% EQU true (

if /i "%Product%" EQU "BOS" set Product=BOS
if /i "%Product%" EQU "CRM" set Product=CRM

) ELSE (

@echo.
@echo ERROR: Invalid Product Entered.
echo Valid Products Are:
@echo BOS - Back Office System
@echo CRM - Customer Relationship Manager

goto :FinishRun

) Yes, this work fine, You are guaranteed that the input is BOS or CRM in capital letters.