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.

5451.

Solve : Determining the base path from random computers in removable media?

Answer»

Now here is a challenge for the masses, though any help is appreciated.
I have two hot-swappable devices (a USB DRIVE and an iPod, respectively) that I USE occasionally with computer repair, among other reasons. This, in and of itself, is not the problem.
What I am after, specifically, is being able to run a shortcut from the USB drive, through a batch file, and so run a program on the iPod, without knowing what the respective drive letters are for either devices.
I am aware of the relative path function, which I frequently use between the USB device and the computer itself. The question is whether or not it is possible to use two non-root relative paths, and have it work.
The typical operating system would be XP Pro, as I recall.
(And no, in case you might be curious, it is not HOMEWORK. )

Any help in this would be most appreciated.Yes, this can be done.

To get the drive letter of the device the current batch file is running on you can use:
%~d0

For example:
Code: [Select]@echo off
echo This batch file is running from drive %~d0
From reading your question, it is not clear if you also want a batch file from the USB flash drive to get the drive letter of the iPod, or a batch file from the iPod to get the drive letter of the USB flash drive. This can also be done by using the command:
fsutil fsinfo volumeinfo
You will just have to record the volume serial number for each, and then loop through the available drive letters searching for the serial number(s) by hard-coding the values you are looking for.

Does that help?You have the right idea, I suspect. I prefer the file to be able to do it either way, but for now, start with the USB tring to get the drive letter of the iPod. Unfortunately, I do not know at this point how to scan the drives for the serial.
Overall, this is the goal:
* Determine what the drive letter is.
* Save the drive letter as a variable.
* Copy several dll files from the iPod to the system disk.
* Be able to execute an EXE program in the iPod.

And then, when finished, delete said files from the system disk.
Copying and deleting to the system isn't too hard. It's simply determinig/using the letter in a copy path. (And, as stated, knowing how to determine/use the serial.

I hope this helps.Choose drive letters for each device and assign them in Disk Management. Select 2 letters that won't commonly appear on most machines such as U: and V:

Once you have done this return to Disk Management one device at a time and also assign them a Volume label... such as USBDrive and IPod one.....up to 11 characters i believe.

This helps the drive letters " stick" across Windows platforms for some unknown Bill Gates reason...but it simply works.

When you are done the only way this will not work is if you plug them into a machine that's using those drive letters ( highly unlikely )

This will greatly simplify your batch file creation and variables.

While the attempts at help are appreciated, it doesn't appear to be true. I have tested it for the USB with a different name, different letter, different name and letter, and multiple letter types. The drive letter changed every time.
It looks like I'll have to do it the long way around.
Gentlemen, start your coding.

(Kidding. )Provided the drives have unique labels, you can use the diskpart utility to iterate thru the assigned drives.

Code: [Select]@echo off
for /f "tokens=3,4" %%i in ('echo list volume ^| diskpart ^| FIND /i "removeable"') do (
if /i "%%j"=="ipod" set ipod=%%i:
if /i "%%j"=="flash" set flash=%%i:
)


You can use the variables %ipod% and %flash% as needed.

Good luck.

You may have to change the if statements to match the actual labels on your devices.Quote from: Torano on May 15, 2007, 03:11:16 PM

While the attempts at help are appreciated, it doesn't appear to be true. I have tested it for the USB with a different name, different letter, different name and letter, and multiple letter types. The drive letter changed every time.
It looks like I'll have to do it the long way around.
Gentlemen, start your coding.

(Kidding. )

I disagree.
I have 4 different flash drives...different brands and no matter where i plug them in, no matter what customer's machine, they retain the drive designation i gave them.Quote from: patio
I disagree.
I have 4 different flash drives...different brands and no matter where i plug them in, no matter what customer's machine, they retain the drive designation i gave them.

I am not saying that it doesn't work for you, Patio. I'm saying that it doesn't work on the computers and flash drives I am using.
What I am wondering, though, is what kind of partition you have on them. The only formatting I didn't have at the time was NTFS, which might be a possible reason, however unlikely.
Another thought that has occurred to me after the fact is that I was referring to the drive letters themselves. So if you were referring to the drive name in specific, then yes, it is retained. Otherwise, no.

Sidewinder: It isn't exactly what I was after, to be honest, but it does appear to be working for my purposes. Thank you.Drive letters and Volume labels are retained no matter what file system i use.

There is no reason to format flash memory anything but FAT32 but one i keep FAT16 for older systems.

Perhaps this hasn't worked in your case because you re-named the drives instead of preparing them as i said.

I do the above steps after a full format and it's never failed me. Maybe this is not the case if you just rename / designate a drive letter on a previously designated drive...Quote from: patio
I do the above steps after a full format and it's never failed me. Maybe this is not the case if you just rename / designate a drive letter on a previously designated drive...

Simply put, yes.
I was in the process of fieldwork when I was experimenting, and had no place (or at least, not enough time) to unload, format, and re-copy the drive materials. (That, and I still use the nearly-full 30 GB iPod for its actual purpose, as well as storage space.)
In any event, the effort is appreciated, and I will keep it in mind for the future.Any problems so far mixing data files and tunes on the 30G iPod ? ?

Been thinkin about grabbing one...(Sorry about taking so long to reply...)

If you haven't gotten one already, there hasn't been a problem yet. It appears that the programming is closed-table software, and doesn't recognize anything it doesn't specifically create, save notating an "other" on the drive space.
5452.

Solve : Complicated .bat Help?

Answer»

Hello All.

This is the situation that I am in, and I hope someone can help me out here.

I am on one domain, and I have to map DRIVES to my Parent Companies servers which reside on another domain.

I currently have something like this..

Net User T:\\Servername\Public /persistent:YES
Net User U:\\Servername\Public /persistent:YES
Net User V:\\Servername\Public /persistent:YES
Net User W:\\Servername\Public /persistent:YES
Net User X:\\Servername\Public /persistent:YES
Net User Y:\\Servername\Public /persistent:YES

The problem is, that the user IDs arent the same on Domain 1 as they are on Domain 2. So when the script launches at startup, they need to logon once for every map in this Command Prompt before they even get to launch any apps. This ISNT the best solution for my users, but My Company was taken over, and the parent company and mine dont play nice together.

Is there a way to Prompt for a Domain\User and Pass at the beginning, and have it only ask once? Or have it logon to their domain so that all there server are available?

FYI: Cant add PCs to their domain as they havent made me a DA on their domain, and I dont think they will.


please Advise::I assume these computers are running Windows 2000 / XP?

If so, you could do something like:
Code: [Select]setlocal
SET /p un=Enter Domain\Username:
set /p pw=Enter your password:
Net Use T:\\Servername\Public /persistent:YES /user:%un% %pw%
Net Use U:\\Servername\Public /persistent:YES /user:%un% %pw%
Net Use V:\\Servername\Public /persistent:YES /user:%un% %pw%
Net Use W:\\Servername\Public /persistent:YES /user:%un% %pw%
Net Use X:\\Servername\Public /persistent:YES /user:%un% %pw%
Net Use Y:\\Servername\Public /persistent:YES /user:%un% %pw%Ahhh..

Mucho Grassy A$$...

I did it in VB Script since it was kind of time limited, but that is great none the less..

Thank you GuruGary.

FYI here is the VBscript I used.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DIM sUser
DIM sPassword
Dim Command
msgbox "Please follow the prompts. Be sure you have the correct logon information.", vbokonly, "MESSAGE"
sUser = inputbox("Please enter Domain\Username","User Name")
sPassword = inputbox("Please enter MS Domain Password","Password")
set WshShell = CreateObject("WScript.Shell")

Command = "Net Use Q: \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Command = "Net Use R: \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Command = "Net USE S: \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Command = "Net Use P: \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Command = "Net Use \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Command = "Net Use V: \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Command = "Net Use W: \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Command = "Net Use X: \\Server\Share " & sPassword & " /user:" & sUser & " /PERSISTENT:YES "
WshShell.Run Command,1, false

Wscript.Sleep 100

WshShell.AppActivate(WinPath)

5453.

Solve : FTP: using ls to write a directory listing locally?

Answer»

NOT SURE if I'm in the correct forum.. but here goes....

I am connecting to a SECURE FTP site daily to SEND a file to a Vendor.

Here is my script:
open ip.address.of.vendor
usernamepassword
cd uploads
put D:\folder\myfolder\*.csv
quit

this works perfect!!! what I am trying to do is add the LS command to write a remote directory listing locally. This is the only way I can think of to actually check to see if my file was successfully transmitted.

I just want to add an ls command after my put command and PULL a directory listing back to my local machine.. can anyone help with the syntax???

Dunno if this helps

I think you use dir in the local DOS ftp PROGRAM to cause an ls on the remote Unix machine to be written locally.

On this page
http://rotterdam.ics.uci.edu/info/DosFtp.htm

it says

Quote
Using FTP in MS-DOS:

[...]

To list the contents of the current remote directory, type "dir"

ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 240
-rw-r--r-- 1 ea 2607 Apr 23 15:35 FileA.gif
-rw-r--r-- 1 ea 2774 Apr 23 15:37 FileB.htm
-rw-r--r-- 1 ea 11549 Mar 17 20:04 FileC.gif
-rw-r--r-- 1 ea 5707 Apr 23 15:34 FileD.html
-rw-r--r-- 1 ea 416 Mar 17 19:11 index.html
-rw-r--r-- 1 ea 55651 Sep 1 23:54 FileE.jpg
-rw-r--r-- 1 ea 4483 Apr 23 15:37 FileF.ico
226 Transfer complete.
625 bytes received in 0.22 seconds (2.84 Kbytes/sec)

I don't know of a way to do what you want in one step. I think you have to do it in 2 steps. For example, if your current batch is called UPLOADFILES.BAT and your FTP command file is called UPLOADFILES.FTP, you can make a new command file named LISTFILES.FTP like this:

UPLOADFILES.BAT
Code: [Select]ftp -s:uploadfiles.ftp
ftp -v -s:listfiles.ftp >filelist.txt
LISTFILES.FTP
Code: [Select]open ip.address.of.vendor
username
password
cd uploads
ls
quit
Then you can parse your FILELIST.TXT
Thanks GuruGary. That is what I was looking for! I get back a directory listing from the remote end written to a .txt file - I don't get a date/time stamp on the file, but the filename contains the current date, so that should be good enough.

Thank you for your help!If you want the timestamps, try replacing the "ls" command in the LISTFILES.FTP with "dir".
5454.

Solve : How to Mass-close programs and Killing Processes?

Answer»

How would I go about writing a line of code to mass close all programs open


also to kill processes, induvidually.

And is there something to make the CD drive open on it's own accord?Why do you want this information?Well I'm using all this for a project I'm working on at school (not schoolwork just my own personal project)built off the logonexec that every STUDENT has to edit as they wish, it opens certain programs, logs off, opens the school's webmail, etc (thats what my other topic was asking about)

And now I want to implement the option of mass-closing programs so if the people I plan to give the batch file to want to get out of everything quickly for whatever reason they can just do that.

And the CD one for the lazy people who couldn't be screwed to lean over and press the button.

The kill process one I don't plan on putting in it.. just for my own curiosity and for me to play around with encase I need in future. Bump..im too lazy for killing all apps... just hit the side with your open hand. that should do the trick. What OS are you running? Do some research on TASKLIST (if you are running XP PRO) and TASKKILL.The school uses Windows 2000 and XPAnd Gary, I just read one of your other posts, for someone who likes to help you are SURE are QUICK to condemn people of using batch code for ill-mannered things.

I'm not interested in fixing something at work or getting my homework DONE

Nor am I trying to destroy/mess with every Tom, Di‬ck and Harry with my batch files.

Ever since I saw a profile cleaner made by some students from grade 12 last year I've been intrigued by batch code and it's possibilities

Now that I've started to learn how to make things work with batch files I want to learn more.

I assure you that I'm not using anything I learn off here for malicious purposes, but it's up to you, and whoever else wants to help to take my word for it.

I'll leave it at that. Have you done any code at all? I'll give you a tiny bit, and you can work off that.

Code: [Select]cd "C:\Docume~1\%username%\My Documents"
tasklist > tasklist.txt

REM In place of ^^^^ insert the programs you want to close (i.e. iexplore.exe,
REM winword.exe). Make a list of the programs that you use normally.
findstr ^^^^ tasklist.txt

Well, that's as far as I've got. Right now, all it does it echo the program if it is open. Try working from there.If you are planning on cycling thru the tasklist output, why not just use the shutdown command?

If you are referring to programs with open windows, you'll need programming access to the Windows API, which rules out batch code or scripts. I couldn't find a command or a class that references the open windows collection.

I'm guessing that "the CD one for the lazy people who couldn't be screwed to lean over and press the button" would also be too lazy to do a simple search as this has been posted many times before:

Code: [Select]Set WMP = CreateObject("WMPlayer.ocx")
Set colCDROMS = WMP.CDROMCollection

If colCDROMS.Count > -1 Then
For i = 0 to colCDROMS.Count - 1
colCDROMS.Item(i).Eject
Next
End If

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

You can also use Eject CD to eject the CD.




Quote from: Millenion on May 31, 2007, 01:07:01 AM

And Gary, I just read one of your other posts, for someone who likes to help you are sure are quick to condemn people of using batch code for ill-mannered things.

Sorry, but I've been taken advantage of before and I like to help people for positive reasons, but not negative. So I feel it is my responsibility to do what I can to reduce the possibility of my code being used for the dark side.

Under XP Pro, you can list the tasks with the TASKLIST command. You can either use the TASKLIST /FI to look for certain tasks or you can search for your items with a FOR /F loop. Then when you find the ones you want to kill use TASKKILL. Something like
Code: [Select]for /f "delims=1" %%a in ('tasklist') do (
if /i {%%a}=={notepad.exe} taskkill %%a
if /i {%%a}=={whatever.exe} taskkill %%a
)
5455.

Solve : need help renaming files with batch program?

Answer»

ok i KNOW how to label things like:
label c: i just relabeled u

but i need help renaming FILE via batch such as the file "my computer" say i want to rename it "Davids computer"... how would i GET the batch file to CHANGE this name if it is possible

5456.

Solve : Replacing the exe?

Answer»

Hi I very new to this but I need a script that replaces a file it while displaying a text saying that it is replacing the file You need to provide more details. What is the name and path of the file you want to replace? And what is the location of the file that will be replace it? And what OS are you running?

If you want to replace C:\app\program.exe with C:\new\program.exe, then you could do something like:
Code: [Select]@echo off
echo Replacing C:\app\program.exe
copy C:\new\program.exe C:\app\program.exe /y
Thanks

Will this script work with XP ,2000 ,ME ,Vista & 98Yes, it should work with pretty much everything from TRUE MS-DOS to Windows 3.1, Windows 95 through Vista and everything between.Hi I TRIED this code but it doesnt work and the files do EXIST

Code: [Select]@echo off
echo Replacing...
copy C:\Users\Somebody\Documents\Gamemaking\Open Source\Game Updater\Latest Version\V2.0.0.2 Release\lol2.txt C:\Users\Somebody\Documents\Gamemaking\Open Source\Game Updater\Latest Version\V2.0.0.2 Release\lol.txt /y
TIMEOUT 10If there are spaces in the path or filenames then you need QUOTES around them. Like:
Code: [Select]@echo off
echo Replacing...
copy "C:\Users\Somebody\Documents\Gamemaking\Open Source\Game Updater\Latest Version\V2.0.0.2 Release\lol2.txt" "C:\Users\Somebody\Documents\Gamemaking\Open Source\Game Updater\Latest Version\V2.0.0.2 Release\lol.txt" /y
TIMEOUT 10Code: [Select]Start "C:\Users\Somebody\Documents\Gamemaking\Open Source\Game Updater\Latest Version\V2.0.0.2 Release\lol.exe"
I want to launch the exe "lol.exe" why does it come up with the command promt? Is this part of the same question?

Try TAKING away the "Start" and just leave
Code: [Select]"C:\Users\Somebody\Documents\Gamemaking\Open Source\Game Updater\Latest Version\V2.0.0.2 Release\lol.exe"

5457.

Solve : Copy from subdirectories.?

Answer»

Hi All!!

I would like copy *.txt file from all subdirectories.


Any Idea???

Thanks,
JayJayanand, you don't give enough information!!!

From where?
To where?

As i have stated

From : All subdirectories
To : Specific folder in C:/ drive

Thanks,
JayDo you mean

from all subdirectories of root directory on C drive (ie all directories under C:\)
to a specific directory on the C drive or elsewhere?
yes!let us assume you want the txt files to end up in the directory c:\target directory

Code: [Select]@echo off
for /F "delims==" %%a in ('dir c:\*.txt /s /b') do (
echo copying %%a
copy "%%a" "C:\target directory"
)




Thanks !it's working perfectly.

Thanks,
JayQuote from: Jayanand on May 14, 2007, 05:17:16 AM

Thanks !it's working perfectly.

Thanks,
Jay

You edited your POST while I was answering the questions.

1. It is common practice in laying out code to indent structures such as loops, blocks, etc. This makes such elements of structure clearer. It is purely a matter of preference. It helps to SEE that you have matching numbers of start and finish structure statements, ESPECIALLY when structures are nested.

EG in BASIC, but also in many other situations.

Code: [Select]
FOR J = 1 to 10
PRINT J
PRINT J+6
NEXT J

IF X=10 THEN
PRINT X
END IF

IF A>10 THEN
IF B = 6 THEN
FOR X = B TO A
PRINT X
NEXT X
END IF
END IF





2. "delims==" tells FOR that the token delimiters are the BEGINNING and end of the each line (IE do not slice at spaces, commas, etc)

"delims=," would result in dissection of lines at commas.


Thanks for making easiest.

Thanks,
Jay
5458.

Solve : is there any Dos comand for getting details system Properties?????

Answer»

Hi, I am using Windows XP Professional , is there any Dos comand for getting DETAILS system Properties?HEYA ..YES there is .. but why wuld you wanna do that?

start > run > cmd > sysdm.cplQuote from: skannan007 on May 15, 2007, 02:03:32 AM

Hi, I am using Windows XP Professional , is there any Dos comand for getting details system Properties?
c:\>systeminfo
5459.

Solve : copy new version of applicatrion on all clients where older version already exis?

Answer»

i would like to copy one *.exe file( which is new version) from one system to many
other systems in LAN. which are already having older version of that *.exe.
How to acheive it. ALSO how to know in each client where ecatly the old version
is present (the application path).And i WANT to over write it.
I want to acheve it through batch file.
Can any one pl help??are you using a network?
you could try login in as the administrator on the SERVER and install it there so it automatically loads the new on the all the users .. i did that for my exams at school.. and it worked

good luck..

5460.

Solve : ren help?

Answer»

my files

M:\setup.exe
M:\1\setup.exe
M:\2\setup.exe
M:\2\2\setup.exe

how to rename all the .exe file become .vc use the for command ?
I assume you are running under Windows 2000 / XP / 2003 / Vista? Do you want to rename all .EXE files on the M: drive? Or just all setup.exe files on the M: drive? Or just the files you listed?

To rename all setup.exe files on the M: drive from the command line, try:
Code: [Select]for /f %a in ('dir M:\setup.exe /s /b') do ren %a *.vc
If you want to do this from a batch file, change %a to %%aOr just do:
Code: [Select]ren (your folder)\*.exe *.vcQuote from: Dark Blade on May 10, 2007, 01:52:13 AM

Or just do:
Code: [Select]ren (your folder)\*.exe *.vc

This is fine for the files in (your folder), but not any of the other folders in the example. My solution will rename all files named "setup.exe" in all directories on the drive and all subdirectories, sub-subdirectories, etc. If that is not what you want please be more specific so we can GIVE a better solution.it's work, tq

erm.... can i rename the same size *.exe files?

M:\setup.exe [5mb]
M:\1\setup.exe [5mb]
M:\2\setup.exe [3mb]
M:\3\setup.exe [5mb]
M:\4\setup.exe [4mb]

* can i rename the *exe file if there are same size in "BATCH"? Quote from: insertusername on May 11, 2007, 04:08:04 AM
it's work, tq

erm.... can i rename the same size *.exe files?

M:\setup.exe [5mb]
M:\1\setup.exe [5mb]
M:\2\setup.exe [3mb]
M:\3\setup.exe [5mb]
M:\4\setup.exe [4mb]

* can i rename the *exe file if there are same size in "BATCH"?

Yes.erm... i mean i want it auto rename when the *exe file size is same.

how to write in batch?Same size as what?Quote from: GuruGary on May 11, 2007, 09:09:32 AM
Same size as what?

I was wondering thatis same size on disk.

how i write a .bat to rename .exe file if they are same size on disk? Quote from: insertusername on May 14, 2007, 01:29:18 AM
is same size on disk.

how i write a .bat to rename .exe file if they are same size on disk?

This is like pulling teeth.

Please state as fully as POSSIBLE what you want to do!
Maybe try PROVIDING us with a flow chart, or write the program using words instead of code. Something like:
Quote
Search the entire C: drive for files named setup.exe
Ignore files that are in hidden directories
For any other files that are found, look at the file sizes
If any of them have the same file size as the file C:\setup.exe, then rename all others to setup.vc leaving the C:\setup.exe with the same name
... or whatever you want to do.Is this section of the forum

(1) A free batch file writing service for lazy numpties

-or-

(2) A place where people who are trying to write batch files get helpful hints and pointers? (ideally by providing a FIRST effort to be looked at and commented upon)

I very much want it to be (2).

Yes, (2) would be much better.(1) A free batch file writing service for lazy numpties


i DISLIKE this word! "lazy numpties", nvm i will learn with myself.

guru tq
5461.

Solve : regedit shortcut?

Answer»

i want to access mysql via start menu so i did following



i added a string to registry like following




But when i click shortcut in startmenu it opens "C:\Documents and Settings\zode>" bu i want it opens C:\PROGRAM Files\xampp\mysql\bin

why did you do this?
Try changing:
Code: [SELECT]CMD /k "C:\Program Files\xampp\mysql\bin"to
Code: [Select]cmd /k "cd /d C:\Program Files\xampp\mysql\bin"Quote from: GuruGary on May 30, 2007, 09:57:03 PM

Try changing:
Code: [Select]cmd /k "C:\Program Files\xampp\mysql\bin"to
Code: [Select]cmd /k "cd /d C:\Program Files\xampp\mysql\bin"

it is ok thanx .....

U r perfect That is one cluttered context menu you've got there.You're welcome.

Quote from: CBMatt on May 31, 2007, 02:33:50 AM
That is one cluttered context menu you've got there.
And you do have a lot of items in your top level menu. You may want to look into the "QUICK Launch" bar or something that is better suited for a larger number of items.
5462.

Solve : how do i close a open file?

Answer»

I did master GameMaker and thats not fully what i wanted.
I wanted a file that when you press a key the batch file closes an open file, then it OPENS ANOTHER so quick that it looks like its moving...
Is that proper enough for you?
Here mabye i can teach you something new.
This is movement code.
Code: [Select]{
direction=90;
speed=3;
}There.
Heres some more
Make a popup.
Code: [Select]msg * enter in what you want the popup to say.Enter that in notepad save as popup.batQuote from: itburnswhenipee on May 30, 2007, 08:18:14 AM

I did master GameMaker and thats not fully what i wanted.
I wanted a file that when you press a key the batch file closes an open file, then it opens another so quick that it looks like its moving...
Is that proper enough for you?
Here mabye i can teach you something new. (not LIKELY )
This is movement code.
Code: [Select]{
direction=90;
speed=3;
}There.
Heres some more
Make a popup.
Code: [Select]msg * enter in what you want the popup to say.Enter that in notepad save as popup.bat

What's the msg thing for? The batch help file for it says:
Quote
Send a message to a user.

MSG {username | sessionname | sessionid | @filename | *}
[/SERVER:servername] [/TIME:seconds] [/V] [/W] [message]

username Identifies the specified username.
sessionname The name of the session.
sessionid The ID of the session.
@filename Identifies a file containing a list of usernames,
sessionnames, and sessionids to send the message to.
* Send message to all sessions on specified server.
/SERVER:servername server to contact (default is current).
/TIME:seconds Time delay to wait for receiver to acknowledge msg.
/V Display information about actions being performed.
/W Wait for response from user, useful with /V.
message Message to send. If none specified, prompts for it
or reads from stdin.

You talk about GM movement code in one sentence, then you talk about a batch pop-up thing the next. I don't really get it.



ANYWAY, does anyone know a batch code for when buttons are pressed?i know one that you have to do enter at the end but i DIDNT want to use cause pressing enter is anoying
i used it to make text based games.
Code: [Select]set choice=
set /p choice=what do you do next?
if not '%choice%'==' set choice=%choice:~0,1%
if '%choice%'=='1' goto oneif you remove if '%choice%'=='1' goto one you have a code that when you enter something it saves it
and also you have to make the one next to the 0 15.
so its lik this Code: [Select]set /p choice=what do you do next?
if not '%choice%'==' set choice=%choice:~0,1%
o yeah theres a serius flaw in gml it makes the games slower...
gm needs every thing to run d an d so it takes a while to change the code
5463.

Solve : Create backup to a network drive?

Answer»

Hello people,

I am very new to this world and will like to create a batch FILE which can zip EVERYTHING under the C:\Backup directory and then copy to a network drive K:\Backup and the name of the zip file must be something like 20070514.zip

Please help me in by correcting my code

The code I am stuck at LOOKS like

set folder=%date:~10,4%_%date:~4,2%_%date:~7,2%
"C:\program Files"\winzip\WZSEPE32.EXE -a -p -r "C:\BACKUP\\%folder%.zip" C:\Programs
copy C:\BACKUP\%folder%.zip K:\BACKUP\\%folder%.zip

Thanks and waiting for replies!!!
Looks like you are off to a pretty good start. What version of Windows are you running? Do you have WinZip installed, and the command line add-on for WinZip installed? The command line versions of WinZip that I have used were either WZZIP.EXE or WINZIP32.EXE, so please verify that you have the command line add-on installed and are using the right executable. Also, unless you want a copy of your backup on the C: and the K:, you can save it DIRECTLY to K: instead of COPYING it. If you do want a copy on your C:, use that as the destination instead of K:.

Assuming the command line executable is WZZIP.EXE, you would probably need to make a couple of modifications to your code like:
Code: [Select]set folder=%date:~10,4%%date:~4,2%%date:~7,2%
"C:\program Files\winzip\wzzip.exe -a -p -r "K:\BACKUP\%folder%.zip" C:\Backup

5464.

Solve : tasklist question????

Answer»

Dear my fren

is there a batch that can check a program that was runing on tasklist and if not exist it will RUN it back AUTO by the batch file itself

im running win xpYou can parse the output of TASKLIST with the FINDSTR COMMAND, and if you don't find the program you are looking for, just launch it with the proper command or by using the START command.Quote from: GuruGary on May 30, 2007, 10:54:21 PM

You can parse the output of TASKLIST with the FINDSTR command, and if you don't find the program you are looking for, just launch it with the proper command or by using the START command.

ermmmm dont really understand what you actually want me to do
sry my english is bad cant understand

can you SAID it in more simple wayThere is a program called Tasklist.

Tasklist makes a list of the tasks.

A batch can look at the list and see if a task is running.

If it not running it can start the program.

Gary, LIKE you, apparently, I am getting bored with being a "batch writing service" for people who aren't interested in the code at all, they just want to fix something at work or get their homework done.
Quote from: contrex on May 30, 2007, 11:40:58 PM
There is a program called Tasklist.

Tasklist makes a list of the tasks.

A batch can look at the list and see if a task is running.

If it not running it can start the program.



thx alot finally i made itQuote from: contrex on May 30, 2007, 11:40:58 PM
Gary, like you, apparently, I am getting bored with being a "batch writing service" for people who aren't interested in the code at all, they just want to fix something at work or get their homework done.
Yes. And helping some people makes me nervous, especially when they want to close programs, end tasks, delete files and eject CD-ROM drives.Quote from: GuruGary on May 31, 2007, 12:00:02 AM
Quote from: contrex on May 30, 2007, 11:40:58 PM
Gary, like you, apparently, I am getting bored with being a "batch writing service" for people who aren't interested in the code at all, they just want to fix something at work or get their homework done.
Yes. And helping some people makes me nervous, especially when they want to close programs, end tasks, delete files and eject CD-ROM drives.

well anyway thank alot i just forgot the tasklist command
5465.

Solve : Change directory dynamically and start application, using Loop?

Answer»

Hi i'm NEW here.

I'm USING Windows XP with Windows Resouce Kits installed.

in my batch FILE,

i wish to change directory and start application dynamically:
Quote

cd "C:\TESTING\CROP - 001"
start testing.exe

cd "C:\TESTING\CROP - 002"
start testing.exe
...
...
...

cd "C:\TESTING\CROP - 010"
start testing.exe

portion of my code here:

Code: [Select]for /L %%x in (1,1,10) do (
IF %%x LSS 10 Set curInstancePath="C:\TESTING\CROP - 00%%x"
IF %%x GTR 9 Set curInstancePath="C:\TESTING\CROP - 0%%x"
echo %curInstancePath%

cd %curInstancePath%
start testing.exe
)
For this, echo %curInstancePath%, why i always get the value "C:\TESTING\CROP - 010"?

Pls advice..really appreciate your helps..Code: [Select]REM PUT THIS AT START OF BATCH
setlocal enableextensions enabledelayedexpansion

for /L %%x in (1,1,10) do (
if %%x LSS 10 Set curInstancePath="C:\TESTING\CROP - 00%%x"
if %%x GTR 9 Set curInstancePath="C:\TESTING\CROP - 0%%x"

REM In loop must use delayed expansion to read env variables
REM because otherwise they are expanded before loop is run
REM use !VARNAME! instead of %varname%

echo !curInstancePath!
cd !curInstancePath!
start testing.exe
)


thanks alot Contrex.

but i face another problem..

cd !curInstancePath! is not working

i check the current directory by using echo %cd%
i couldn't see any changes of directory.

once again..thanks for your helps..Do those directories already exist?Quote from: sayhigh on May 30, 2007, 07:55:40 PM
thanks alot Contrex.

but i face another problem..

cd !curInstancePath! is not working

i check the current directory by using echo %cd%
i couldn't see any changes of directory.

once again..thanks for your helps..

is curInstancePath taking the right value each time?

yes..it get the right value each time..

i've solved it by add C:

for /L %%x in (%curInstance%,1,%curMaxInstance%) do (
IF %%x LSS 10 Set curInstancePath="C:\Stress Tester\CROP - 00%%x"
IF %%x GTR 9 Set curInstancePath="C:\Stress Tester\CROP - 0%%x"

cd !curInstancePath!
C:
)

thanks alot..Oh I see you are not logged in on C:

You can do the same thing another way by adding the /D switch to the CD command.

Code: [Select]cd /D !curInstancePath!

Code: [Select]F:\>cd c:\batch

F:\>

F:\>cd /D c:\batch

C:\batch>





sorry..previously i forget to mention i run the bat file in D drive..

yeah..thanks alot man..
5466.

Solve : Question on SHIFT?

Answer»

Hi,

Was quite fresh in DOS.
Fyi I am using Window XP.

Having a prob to LEARN the shift command.

I have read up a few example on shift, but i just can't get it and utilise it on my own.
Is there anyone can show an simple example to explain how it works?
It will be better if i can paste the command and try it myself.

Thanks and will wait for anyone replies...

The SHIFT command will shift command line switches, or parameters down (line an assembly POP) to let you process in a loop, or access parameters higher than %9. Do you understand %1 and %2, etc.? Use the following example:
Code: [SELECT]@echo off
echo Command line is "%0 %*"
echo Now Param 1 is "%1"
echo Shifting
shift
echo Now Param 1 is "%1"
echo Shifting again
shift
echo Now Param 1 is "%1"
echo Shifting again
shift
echo Now Param 1 is "%1"
echo Shifting again
shift
echo Now Param 1 is "%1"
echo Shifting again
shift
echo Now Param 1 is "%1"
echo Shifting again
shift
echo Now Param 1 is "%1"
echo Shifting again
shift
echo Now Param 1 is "%1"
Save the file as foo.bat and execute with parameters like:
foo.bat This is a test for the Shift command

Each time a SHIFT command is executed the parameters shift down by 1, so %1 goes away, and %2 becomes %1, %3 becomes %2, etc.

Does that explain?Hi, thx for your prompt reply,

but just another question, as i am not quite certain about the below:

"Save the file as foo.bat and execute with parameters like:
foo.bat This is a test for the Shift command"

I have save the foo.bat files with the above code inside, but how can i put in the parameters "This is a test for the Shift command"?

Please let me know again, thanks in advance.
Sorry, one more thing, i am not sure about the %1 and %2, etc.

I only know %%i in For command.

Thanks.Execute the command with the extra WORDS at the end. For example, if you saved the file as foo.bat, to execute script from the command prompt, type:
foo.bat This is a test for the Shift command

The output should look similar to:
Quote

C:\>foo.bat This is a test for the Shift command
Command line is "foo.bat This is a test for the Shift command"
Now Param 1 is "This"
Shifting
Now Param 1 is "is"
Shifting again
Now Param 1 is "a"
Shifting again
Now Param 1 is "test"
Shifting again
Now Param 1 is "for"
Shifting again
Now Param 1 is "the"
Shifting again
Now Param 1 is "Shift"
Shifting again
Now Param 1 is "command"

C:\>

Parameters are what you type in after the command. %1 is the first parameter, %2 is the second, parameter, etc.. So when you first RUN the command with "This is a test for the Shift command", then: %1="This", %2="is" %3="a", %4="test" ... Each time you execute the "shift" command from within the batch file, the parameters shift down one number. So after the first shift command it is: %1="is" %2="a", %3="test".

Is that more clear now?Thanks for the example, its works now.

But can the SHIFT function function within a single batch file alone?
Can the parameters be obtained from a text file instead of keying them in cmd prompt?

Possible to give another example?

Thanks =)You could have one batch file call another. For example, if we keep our original batch file as foo.bat, we could have test.bat with the following code:
Code: [Select]@echo off
echo Testing the SHIFT command
call foo.bat This is another test for the shift command

That way you have not provided any parameters, but the Shift command is still used.

Is that what you were asking?Yup, more or less like this.
That mean the baseline is it only can work only when 2 bat files are used?
My initial THOUGHT is actually by reading the parameters from a text file when the .bat file run and auto asign each parameter into %1, %2, %3, ...

Thanks for your time!


5467.

Solve : Batch script question: closing non-DOS windows?

Answer»

Hi,

I'm trying to create a batch script that will run all my maintenance scans and then shutdown my computer when all the scans are done. I've got the basic idea behind it but the problem i face is that some of the scans cause DOS to pause until the SCANNER's WINDOW is closed. This ultimately causes all subsequent DOS commands to never get called.

Is there SOMEWAY to tell DOS to close the other WINDOWS that are open so that DOS may continue on? or is there someway to start a new script while the first script continues (i.e. script A will call script B then continue ONTO the scan while script B runs in parallel to script A)?

Thanks!This will let ScriptA, ScriptB and ScriptC all run in parallel:
Code: [Select]@echo off
start ScriptA
start ScriptB
start ScriptC

5468.

Solve : New to DOS have a quick qustion?

Answer»

I am trying to copy all extentions of *.dat* and have them moved to a new directory within a parent folder. I am also trying at the same time to let the user decide what the name of the directory will be for those files to MOVE into. .. Its fo a batch FILE but UNSURE how to do this or if this can be done. Any suggestions?

ThanksDo you want them moved to the parent directory, or do you want them moved to a user named directory? And what OS are you running?

To move all .dat to the parent directory, you could do:
Code: [Select]move *.dat ..I want them to move to a user named directory. I am running Windows XP.Under Windows XP, you should be able to do this:

Code: [Select]@echo off
setlocal
set /P Dest=Enter the directory you want to move the files to:
move *.dat %Dest%
Be sure to USE quotes if the path contains spaces.

5469.

Solve : Help needed using wildcards with the copy command.?

Answer»

I'm trying to copy two files from two seperate UNC's to a single directory on a single server, appending the source server name to each file to AVOID duplicate file names at the destination.

Here's an example of my failed attempts at this:

::copylogs.cmd
copy "\\server1\c$\data\*.log" "\\DestServer\c$\logs\server1_*.log"
copy "\\server2\c$\data\*.log" "\\DestServer\c$\logs\server2_*.log"
exit

I need the names to look like the following in the destination directory "servername_filename.log" But I'm having no luck finding the correct syntax? Can anyone help?

Thanks! MdaggettQuote from: mdaggett on May 14, 2007, 10:04:34 AM

I'm trying to copy two files from two seperate UNC's to a single directory on a single server, appending the source server name to each file to avoid duplicate file names at the destination.
Are there just 2 files, or 2 SETS of files? And what OS are you RUNNING?

If 2 files, you can do something like:
::copylogs.cmd
Code: [Select]copy "\\server1\c$\data\server.log" "\\DestServer\c$\logs\server1_server.log"
copy "\\server2\c$\data\server.log" "\\DestServer\c$\logs\server2_server.log"
If it is 2 sets of files, then depending on your OS, you can probably accomplish your TASK with a FOR /F loop for each set.
5470.

Solve : enable & disable taskmanager,regedit?

Answer»

how to write in ".BAT" to

enable & disable taskmanager
enable & disable registry editor

izzit use reg ADD? how?
Why do you need this?
What OS are you using?
and Whos computer are you victimizing?Please CHECK his previous posts before assisting this clown.Quote from: GX1_Man on May 11, 2007, 12:48:29 PM

Please check his previous posts before assisting this clown.
Right....YES...I see...my computer been inflected by virus svichosst.exe
it disable my taskmanager and folder options
i alredy CLEAN the virus. but the problem is my task manager still been block, i cannot right click my start bar to open it.

so please help me. i using sp2Perhaps a legal version of Windows will help rectify your situation.
5471.

Solve : how to compare date time??

Answer»

Hi Senior/Guru,

i NEED to compare the DATE time of current date time with the input parameter

Code: [Select]Set end_date_time=%1
set date_tm="%date:~0,10% %time%"

REM Check if current date time >= end time, STOP running, otherwise looping
IF %date_tm% GEQ %end_date_time% GOTO Stop_Run
but it's not working for CERTAIN time as it is compared as String.

thanks for your viewing and appreciate your helps..
have a nice day!

5472.

Solve : store the file path into a variable?

Answer»

@ECHO off
setlocal
set /p FILE="What is the file name (include extension)?"
for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
if exist "%%D:\" DIR %%D:\"%FILE%" /b /s
)

the above mentioned is the code for getting full path of a file which is searched by the user.smbdy please tell me how to STORE the file path into a variable after the dispaly/i am very new to this scripting.please help meThere may be more than one RESULT.

5473.

Solve : File path.?

Answer»

Hi Everybody!!

How could i get FILE path only?? Like if file location is my documents then
C:\Documents and Settings\ibm\My Document

Thanks,
Jay%%~DpI

Mind you, that won't cut off the final character like you seem to want


PROVIDE more info, like how you are getting the path "C:\Documents and Settings\ibm\My Documents" or the rest of your batch file and your OS version and we can provide more help.Example pathshow.bat

Code: [Select]@echo off
for /F "delims==" %%a in (%1) do echo %%~Dpa

Code: [Select]C:\>pathshow "C:\Documents and Settings\Guest\Start Menu\Programs\desktop.ini"
C:\Documents and Settings\Guest\Start Menu\Programs\
Using contrex's code, you can strip the trailing \ like:
Code: [Select]@echo off
setlocal enabledelayedexpansion
for /F "delims==" %%a in (%1) do set PathOnly=%%~Dpa&echo !PathOnly:~,-1!Hey, i want like :
if file ak.dat is in my document then
echo C:\Documents and Settings\ibm\My Documents\ak.dat
Actually i want to find up all the .dat file in PC and want to paste in another PC.
So the dat file location need. if the file is in my documents then and will be able to paste in same location in another pc.
C:\Documents and Settings\ibm\My Documents\ak.dat

Paste in another PC?
Quote from: contrex on May 13, 2007, 04:34:30 AM

Paste in another PC?

copy-pastepaste what? the file? the name of the file?File.
How you do this? network? MAGIC?
hey! funny!!!!
network, Sure will do!
Quote from: Jayanand on May 13, 2007, 04:50:05 AM
hey! funny!!!!
network, Sure will do!

you have to have some KIND of file transfer, like FTP.
5474.

Solve : Spaces in directory names?

Answer»

I'm new to programming, and I require assistance with a minor problem.

what can I use to form a space in a directory name so that cmd will ACCEPT it.

for example:

@start C:\Program Files\Microsoft Office\OFFICE11\WINWORD.exe

But when I attempt to run the command in cmd it says:

Windows cannot find "C:\Program" etc..

What do I use in replace of the space?

Thanks in advance.The best way is probably putting quotes around the path, like:
Code: [Select]@start "C:\Program Files\Microsoft Office\OFFICE11\WINWORD.exe"
You could ALSO use short 8.3 names like:
@start C:\Progra~1\Micros~1\OFFICE11\WINWORD.exe

The CD command does takes spaces, so you could do:
Code: [Select]cd /d C:\Program Files\Microsoft Office\OFFICE11
start WINWORD.exeThanks a bunch I'll try it now.

Also another thing I need to know, what command would I need to tell the computer to shutdown, log off etc?The shutdown code.
-t = time until shutdown (use two or more digits such as 05 or 00 or 200)
-f = forces applications to close
-c = shows a comment while shutting down (i.e. "You are now shutting down. Save your work")

-s = shutdown
-r = restart
-l = log-off


Code: [Select]shutdown -s -t 30 -c "You are now shutting down. Save your work." -f
Note that if you are in a batch file, use shutdown.exe instead of shutdown.Quote from: Dark Blade on May 29, 2007, 12:45:11 AM

Note that if you are in a batch file, use shutdown.exe instead of shutdown.

Using the .exe extension is optional, whether an executable is in the current folder, or on the PATH. The only reason to explicitly add the extension would be if you had a different executable eg shutdown.com shoutdown.bat or shutdown.cmd in either of those places. (Bad practice!) If shutdown.exe is where it should be, ie C:\WINDOWS\system32, then shutdown or shutdown.exe will find it. Or am I missing something?

Code: [Select]c:\>shutdown /?
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 [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)

c:\>shutdown.exe /?
Usage: shutdown.exe [-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 [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)

c:\>echo shutdown /? > ss.bat

c:\>echo shutdown.exe /? >> ss.bat

c:\>ss

c:\>shutdown /?
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 [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)

c:\>shutdown.exe /?
Usage: shutdown.exe [-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 [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)

c:\>

c:\>


Oh, my mistake.

I thought I read somewhere that you had to run shutdown as a program in batch files, because you can't use the shutdown command in batch.

But I guess I must've read wrong.Thanks a lot you guys, you've been a mountain of help.

Now I just need to know one thing (I know I'm probably getting annoying now)

But what would I need to input to tell it OPEN a browser on a certain website?"C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www/google.com"
Quote from: Millenion on May 29, 2007, 02:09:08 PM
Thanks a lot you guys, you've been a mountain of help.

Now I just need to know one thing (I know I'm probably getting annoying now)

But what would I need to input to tell it open a browser on a certain website?
you can just do
Code: [Select]c:\> start "www.google.com"
Actually, you wouldn't need the quotes because all websites are one WORD (they use underscores for spaces).

So,
Code: [Select]start www.google.com
5475.

Solve : How to refocus for the DOS command window?

Answer»

Hi All,

I have a DOS BATCH file which will be EXECUTED for a while. During it is running, other Windows may get the focus and my DOS window may lose the focus. My question is: how can my DOS windows which is runing by my batch file be able to re-gain the focus or to be activated again by my batch file? Are there any specific DOS command executed in my batch file can make this happens?

Thanks in advance.

Jim
If you are running Windows 2000 / XP / 2003 / Vista, you can do something like this:
Code: [Select]echo set WshShell = CreateObject("WScript.Shell") > cmdFocus.vbs
echo WshShell.AppActivate "Command Prompt - %0" >> cmdFocus.vbs
start cscript cmdFocus.vbs
del cmdFocus.vbs
You will need write access to the current directory for this to work. I don't know of any ways to do this in pure batch, so what this does is create a small VBS file that switches focus, runs the script and deletes the temporary script. Will this work?
It works!!! Thanks a lot.

Jim
Good. Glad to help.

5476.

Solve : Installing DOS on a blank drive?

Answer»

I had a problem with my i386 the other DAY which required me to format the machine. However, I did so without foresight. When I boot my computer, it says, "Non-System Disk or Disk Error. Replace and press any key when ready." This is in reference to my C drive. I have the full set of DOS 4.01 and Windows 3.1 installation floppies, but my computer won't look at them. Can anyone help me to reinstall DOS?

My computer: intel 80386 from 1988 with 640k memory, 150mb hd, VGA graphics.Go into bios and make sure floppy is set to first boot device. I really don't know how to do that with my ESDI BIOS. I tried disabling c: and the 5 1/2 floppy, tried switching the drive letters around for the two floppy disks, disabling just one disk, and so on.

With only the floppy disk active on Drive B, it gives this error:

Quote

Diskette configuration error on drive A.

Press [F1] to continue, [f2] to setup.
F1 leads to another error, while f2 leads to the BIOS setup.

Can you tell me how I can set the boot ORDER in my BIOS without disabling other disks?ESDI BIOS??? That's an IBM PS/2 unless I'm mistaken. You may need to boot from a Reference Diskette to set the CMOS it is a PS/2. Do you have a model number?






Although I said it was an Intel on my previous post, it's actually a Chips and Technologies NW386SX-C, if that means anything to you. It says it's a CHIPS SCATsx/PEAKsx v. 105, and uses Parcorp, Inc's ESDI BIOS.

Basically, I need help installing DOS on top of nothing but the BIOS when I can't get it to even see a floppy disk. Any ideas, anyone?How did you do the format ? ?

With a blank HDD you will get this error with no floppy in the drive on boot.

Insert Disk 1 of DOS and re-boot.
5477.

Solve : NEED HELP ?? FOR CREATING A MS-DOS BATCH FILE !!!!?

Answer»

If they just LOOKED at the title of the Command LINE Inerpreter that they are using, they would see if it is Command PROMPT or not.They don't unfortunately.You mean like this?

5478.

Solve : use mouse instead of light pen?

Answer»

Hello everyone

I have a little problem with a MS-dos 6.22 application
The application is using a Light pen (From Fastpoint). Now i want to use a mouse instead of a light pen because the cost is to high. So i installed a mouse driver in dos and it works fine in the editor ( so i know it the driver works) but when i start the application it doesn't.

I'm not sure if they disabled that option (to use a mouse in their application) but i can't REALLY ask anyone because the company that made that DISCONTINUED that product and they don't support it ANYMORE.

When i RUN the application in windows XP (to see if the mouse works) the mouse was working. I COULD hit the buttons and select items. Any ideas how to get the mouse to work?

5479.

Solve : random command?

Answer»

is there a way to make a random word from a list appear? like if i type a list of random nouns and then random VERBS, and a sentance with blanks where the words should go, i could FUNNY stuff lolz.You could do something with this:

:1
@echo off
set /a number="%random%" %%3 + 1 >nul
if /i %number%==1 echo Computer
if /i %number%==2 echo Hope
if /i %number%==3 echo Forums
pause
goto :1

I think it would get too complex though...yeah i could do that but i only need 2 LISTS of random words and how would i make the second?Quote

@echo off
set "list1=dude,programmer,geek,squarehead,cookie monster"
set "list2=eat,hug,destroy,unpimp,crack,hack,hammer"

call:rndselect a "%list1%"
call:rndselect b "%list2%"

echo.The %a% is going to %b% that SERVER. LOL!
pause
GOTO:EOF


:rndselect ret list -- RETURNS a rondomly selected string from a string list
:: -- ret [out] - valref for return value
:: -- list [in] - string list, comma separated
:$source http://www.dostips.com
SETLOCAL ENABLEDELAYEDEXPANSION
set "list=%~2"
set /a "n=0"
for /f "delims=" %%a in ('"echo.%list:,=&echo.%"') do (
set /a i+=1,r=!random! %% i
if !r! LSS 1 set "ret=%%a"
)
ENDLOCAL&IF "%~1" NEQ "" (SET %~1=%ret%) ELSE ECHO.%ret%
EXIT /b %ERRORLEVEL%

What'ya think gamerx365?
DOS IT HELP?

that one definetly works right. i am still working on figuring out how to make it so that I can make more than one random sentence but so that it has different words.If I understand what you mean, you just have to change this
Code: [Select]@echo off
set "list1=dude,programmer,geek,squarehead,cookie monster"
set "list2=eat,hug,destroy,unpimp,crack,hack,hammer"
[b]set "list3=one,two,three,four,five"[/b]

call:rndselect a "%list1%"
call:rndselect b "%list2%"
[b]call:rndselect c "%list3%"[/b]

echo.The %a% is going to %b% that server. LOL!
[b]echo. %c%[/b]
pause
GOTO:EOF

Very nice, DosItHelp.
5480.

Solve : how to created a bootable disc..........?

Answer»

i have windows 3.11 dos ver.5

my COMPUTER have crash.do anyone out there know how to start
the computer up without a disc. or how can i make bootable disc
when the computer is down. i have another computer xp can i use
the xp too help me make a disc for windows 3.11


thank you for your help
johnQuote from: GEECH97 on July 13, 2007, 11:36:04 PM

... or how can i make bootable disc
when the computer is down. i have another computer xp can i use
the xp too help me make a disc for windows 3.11


Check out: www.bootdisk.com

You can download an executable file there. PUT a BLANK FLOPPY disc in the floppy drive, and run the file. It will make the floppy a bootable floppy.

Be SURE to spend some time looking around that site. There is more and better information there.


I hope this helps.


5481.

Solve : check internet access?

Answer»

how to create a BATCH that will actually sniff wheather my pc is currently connect to internet or not Ping a known address - if you get a response, you are connected
Grahamthx for the reply
ok i try it and it work ... so how am i suppose to make a batch that will show a TIME when is my pc is unplug or connected to the internet and save it to a txt

forgot to said that im using window xp sp2
....no reply
zzzzzzzzzzzzz
.
.
.
.
any1 HELP plsssQuote

@echo off
for /l %%a in (,,) do (
ping google.com>NUL&&(
if not defined YES call echo.Connected %%date%% %%time%%
SET "YES=Y"
)||(
if defined YES call echo.Connection lost %%date%% %%time%%
set "YES="
))
:$source http://www.dostips.com

What'ya THINK nwlun? DOS IT HELP?
5482.

Solve : how can i run batch when on a program exit?

Answer»

Hello there,

I need a batch file, that opens a dos program (or any other?) and runs a reg file, ok that's easy to do. But the problem is that I need to know when this program is closed and run another reg file. Can be done in one batch file, and how can I exactly monitor when this program is closed?

THANK you!@echo off
echo starting program 1
program1.exe
echo program 1 has finished
program2.exe
echo program 2 has finished

etc
Thanks but it doesn't help me, also when reg file is started it is asking for confirmation (do you want to add file into the registry...) how can i avoid that.

Thank you
Quote

Thanks but it doesn't help me,

Then please be more clear about this

Quote
But the problem is that I need to know when this program is closed and run another reg file.


Quote
also when reg file is started it is asking for confirmation (do you want to add file into the registry...) how can i avoid that


REG.EXE add adds new keys and VALUES to the Registry. You can add a VALUE to an existing key, add a new key with no values, or create a new key and a value beneath it. If you try to add a key or value that already exists, REG.EXE will warn you.

REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]

*

KeyName [\\Machine\]FullKey

Machine Name of REMOTE machine - omitting defaults to the current machine. Only HKLM and HKU are available on remote machines

FullKey ROOTKEY\SubKey

ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]

SubKey The full name of a registry key under the selected ROOTKEY

*

/v The value name, under the selected Key, to add
*

/ve adds an empty value name for the key
*

/t RegKey data types:

[ REG_SZ, REG_MULTI_SZ, REG_DWORD_BIG_ENDIAN, REG_DWORD, REG_BINARY, REG_DWORD_LITTLE_ENDIAN, REG_NONE, REG_EXPAND_SZ ] If omitted, REG_SZ is assumed

*

/s Specify one charactor that you use as the separator in your data
string for REG_MULTI_SZ. If omitted, use "\0" as the separator
*

/d The data to assign to the registry ValueName being added
*

/f Force overwriting the existing registry entry without prompt

Examples:

REG ADD \\ABC\HKLM\Software\MyCo
Adds a key HKLM\Software\MyCo on remote machine ABC

REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead
Adds a value (name: Data, type: REG_BINARY, data: fe340ead)

REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail
Adds a value (name: MRU, type: REG_MUTLI_SZ, data: fax\0mail\0\0)

REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d %%systemroot%%
Adds a value (name: Path, type: REG_EXPAND_SZ, data: %systemroot%)
Notice: Use the double percentage ( %% ) inside the expand string

I thing he means Import Value from another Reg File (*.reg)
use this:
REG IMPORT "C:\YourRegFile.reg"

Here what you need..
..Untested..
------------------------------------------------------------------
@echo off
set Program=whatever.exe
start %program%
REG IMPORT "C:\YourRegFile.reg"
:loop
tasklist>log.txt
find /i "%Program%" log.txt
if errorlevel 1 (
REG IMPORT "C:\AnotherRegFile.reg"
exit
)
ping localhost -w 1000 -n 2
goto loop
-----------------------------------------------------------------
5483.

Solve : Renaming Files in DOS with *.*?

Answer» HELLO,

I have files named

111-1_001.tif
111-1_002.tif
111-1_003.tif
112-4_001.tif
112-4_002.tif

I need to replace the -1 and -4 with -0001 and -0004 respectively to end up with:

111-0001_001.tif
111-0001_002.tif
111-0001_003.tif
112-0004_001.tif
112-0004-0002.tif

I've tried the following:

Code: [Select]rename 111-1*.* 111-0001*.*
and


Code: [Select]rename *-1* *-0001*

but nothing seems to work.

Anyone have an idea of how I can change these? I have thousands of files in this format.

Ideally I'd like to replace all of the -1 with -0001, or rename all of the 111-1 to 111-0001, etc.

Each of the prefix's (111) will have -1 through -999.

Anyone have a magical DOS command I can do this with? I'm trying to use it in a batch file. A GUI interface just isn't going to fly with my intended user.

Thanks!you got to use a for loop. however i have shown EXAMPLES of this before in vbscript. SEE hereThanks for your script GhostDog. If you wouldn't mind, can you help me with the specifics of your script? I'm not well versed in vbscript.

In my exisitng folder I have the following files;

565-9-0001.tif
565-9-0002.tif
565-9-0003.tf

I would like to replace 565-9- with 565-0009-

Here is a copy of the script from your previous message. I changed as many of the paramaters as I could figure out:

Code: [Select]Dim FSO,NewPrefix, OldPrefix, oDir, objFolder,NewFileName,counter
NewPrefix="565-0009-"
Set FSO = CreateObject("Scripting.FileSystemObject")
sDir = "i:\chavez county\unzipped"
Set objFolder = FSO.GetFolder(sDir)
counter = 1
For Each Files In objFolder.Files
If FSO.GetExtensionName(Files) = "565-9-" Then
NewFileName = NewPrefix & Padding(3,counter) & ".tif"
Files.Name = NewFileName
counter=counter+1
End If
Next

Function Padding(ValueToPad, TheDigits)
theLen = Len(TheDigits)
If theLen < ValueToPad Then
Padding = String(ValueToPad-theLen,"0") & TheDigits
Else
Padding = TheDigits
End If
End Function

Quote from: bmacbmac on July 12, 2007, 11:35:15 PM
Code: [Select]Dim FSO,NewPrefix, OldPrefix, oDir, objFolder,NewFileName,counter
NewPrefix="565-0009-"
Set FSO = CreateObject("Scripting.FileSystemObject")
sDir = "i:\chavez county\unzipped"
Set objFolder = FSO.GetFolder(sDir)
counter = 1
For Each Files In objFolder.Files
If FSO.GetExtensionName(Files) = "tif" Then
NewFileName = NewPrefix & Padding(3,counter) & ".tif"
Files.Name = NewFileName
counter=counter+1
End If
Next

Function Padding(ValueToPad, TheDigits)
theLen = Len(TheDigits)
If theLen < ValueToPad Then
Padding = String(ValueToPad-theLen,"0") & TheDigits
Else
Padding = TheDigits
End If
End Function


just a minor change. You can try the batch one at the link i gave if you are more inclined to batch programming. If you want to learn vbscript, you can download this
5484.

Solve : making a install program from a batch?

Answer»

okay first off, i swear I won't use this information for bad purposes. I do not want this topic to end up like all the others I have started. Okay, so I am making an install program from a batch, and there are a couple things I need to know.
1.How do I create a shortcut using a batch?
2.Can I put this shortcut on all user accounts without having them specified?
3.If I use the C:\> command, will this work in any folder?
Thanks for reading and trying to help I hope you realize that people here may have a DIFFICULT time trusting you.Quote from: gamerx365 on July 10, 2007, 05:49:36 PM

1.How do I create a shortcut using a batch?
search the forum. tick "show results as messages" in Options. Simple?Quote from: CBMatt on July 10, 2007, 10:23:31 PM
I hope you realize that people here may have a difficult time trusting you.
Yes but its not a matter of anything that has to do with them other than helping me out. I am planning on getting into some HEAVY programming pretty soon and I want to be able to make a good homemade install system. I will be using it for part of my senior project at school.

1) yeah, it has to look something like this..

if %4[==[ goto syntax
if not exist %1 if not exist %1\nul goto syntax
for %%? in (%2 %3) do if not exist %%?\nul goto syntax
%5 %0 %1 %2 %3 %4 rem "{newfolder}" InstallHinfSection
echo > %temp%\#path#.bat path %path%
path %1
echo > %temp%\#k#.inf [version]
echo >>%temp%\#k#.inf signature="$CHICAGO$"
echo >>%temp%\#k#.inf [DefaultInstall]
echo >>%temp%\#k#.inf UpdateInis=Addlink
echo >>%temp%\#k#.inf [Addlink]
echo >>%temp%\#k#.inf setup.ini, progman.groups,, "group0=%6"
echo >%temp%\#k#.inf setup.ini, group0,, ""%6""
echo >%temp%\#k#.inf setup.ini, group0,,""%4",""%path%"",,0,"
for %%? in (call DEL) do %%? %temp%\#path#.bat
start/w rundll setupx.dll,%7 DefaultInstall 132 %temp%\#k#.inf
del %temp%\#k#.inf
move "%3\{newfolder}\*.*" %2 >nul
rd "%3\{yourfolder}"


2) without having them specified? , once the shortcut is created have it moved to allusers\desktop directory

3)if you use cd\ at the beginning of a file , @echo off & cd\ & cls , so your program always runs from c:\ it will work in any folder,

thanx your more helpful and trusting than many people who ignore the problem for fear i will misuse it. but thanxtheirs no question you will misuse it ,but since batch is useless.. your virus wont get very far Quote from: Diablo416 on July 12, 2007, 12:05:37 PM
theirs no question you will misuse it ,but since batch is useless.. your virus wont get very far
its not for a virus thanks. i am trying to create an installer for my text editor ive made. i think i found a better way to do it thoughQuote from: Diablo416 on July 12, 2007, 12:05:37 PM
theirs no question you will misuse it ,but since batch is useless.. your virus wont get very far
heh... that's positive reinforcement if i've ever heard it...
where do you get the idea he's going to misuse it?
5485.

Solve : how to??

Answer» QUOTE from: Diablo416 on July 12, 2007, 12:15:42 PM
i UNDERSTAND now ,

Are you SURE?

Quote
so instead of %1% reading "variable" ^%^1^% would READ "%1%..

c:\>echo ^%1^%
%1%

Quote
if i used a ^ in between every letter , could i use this to escape all the LETTERS like an alternative to @echo off?

Nope.


c:\>echo ^h^e^l^l^o
hello


escaping ordinary characters does absolutely nothing.



5486.

Solve : home-made Text Editors?

Answer» NEVERMIND i GUESS a WHOLE bunch of things are messing up THANX for helpsorry i couldn't be of more use
5487.

Solve : Problem with nbtstat command?

Answer»

When I USE the nbstat -A command followed by the ip adress, I don't become the remote machine's name, but: "HOST not found." , although I have a connestion with the remote computer.
Can you HELP me?Either one of TWO things are the case:

1. You screwed up the host name.

2. The host is not hackable.



But this happens with all hosts, which I tried.

By the way is any other way to understand at least the NETBIOS name table using the ip adress of the remote computer?

5488.

Solve : TASKILL?

Answer»

hi all,
i NEED help with the TASKKILL command.
everytime i use it it shows"
ERROR: Invalid argument/option -'safari.exe'.
Type "TASKKILL /?" for usage."
I have Windows Vista, 960 mb of RAM, intel processor.What is the syntax that you are using?

It should be something like this -

TASKKILL /IM safari.exe /F

I think...

The IM specifies the image name of the PROCESS and the /F makes it forcefully terminate the process.taskkill /f /im safari.exe i tryed taskkill /f /im safari.exeis there ACTUALLY a task CALLED safari.exe running? Does it appear in the output of tasklist?

What is the result of this command?

Quote

tasklist /NH /FI "IMAGENAME eq safari.exe"



thanks guys,
jerhiggs was right!
5489.

Solve : set output of dir /b as variables?

Answer»

Ello

so. im doing dir /b on a folder, shaping the output a little with sed and setting each item in the folder as a separately numbered variable like this:


setlocal ENABLEDELAYEDEXPANSION
set LOOP=0

for /f "delims=" %%a in ('dir /b c:\windows\tasks\*.job^|sed -e "s/\(.*\)....$/\1/g"') do (
set TASK_%LOOP%=%%a
set /a LOOP +=1
)


only it doesnt work, and niether does this:

setlocal ENABLEDELAYEDEXPANSION
set LOOP=0

for /f "delims=" %%a in ('dir /b c:\windows\tasks\*.job^|sed -e "s/\(.*\)....$/\1/g"') do (
set TASK_!LOOP!=%%a
set /a LOOP +=1
)

Anyone help me with this?

Cheers
AlastairYou enabled DELAYED expansion, but in the first script you didn't use it (%LOOP%). So %LOOP% is always going to be 0

In the second you got it right (!LOOP!) but, in any case, you need to set the variable in a child PROCESS (because of the way cmd.exe expands variables)

Code: [Select]call set TASK_!LOOP!=%%a
Then your simulated array, the variables TASK_0 through TASK_whatever, will be set and visible to the batch file while it is running.

A small point: your SED one liner appears to strip off the final 3 chars of the extension but leaves the dot. (the dot is considered part of the extension)

If you did not wish this, you could dump SED altogether and just use the FOR variable modifier ~n

(type FOR /? at the PROMPT for full details of all the MODIFIERS and how to use them)

e.g.

Code: [Select]for /f "delims=" %%a in ('dir /b c:\windows\tasks\*.job') do (
call set TASK_!LOOP!=%%~na
set /a LOOP+=1
)

Or if you did want to keep the dot,

Code: [Select]call set TASK_!LOOP!=%%a.
BTW, I am guessing that maybe you are coming to Windows scripting from a *nix background? You may like to know that Windows command stuff is case insensitive, (%LOOP% and %loop% and %LooP% are all considered the same variable)







hey

Am I missing something?

C:\Documents and Settings\Administrator>setlocal ENABLEDELAYEDEXPANSION

C:\Documents and Settings\Administrator>set LOOP=0

C:\Documents and Settings\Administrator>for /F %a in ('dir /b c:\test') do (
call set TASK_!LOOP!=%a
set /a LOOP+=1
)

C:\Documents and Settings\Administrator>(
call set TASK_!LOOP!=test1.txt
set /a LOOP+=1
)

C:\Documents and Settings\Administrator>(
call set TASK_!LOOP!=test2.txt
set /a LOOP+=1
)

C:\Documents and Settings\Administrator>(
call set TASK_!LOOP!=test3.txt
set /a LOOP+=1
)

C:\Documents and Settings\Administrator>echo %TASK_0%
%TASK_0%

C:\Documents and Settings\Administrator>echo %TASK_1%
%TASK_1%

C:\Documents and Settings\Administrator>Quote from: alkjones on March 05, 2009, 02:32:45 PM

hey

Am I missing something?

Looks like you're trying to expand the variables at the prompt after the batch has finished. No can do.

From my post

Quote from: Me
Then your simulated array, the variables TASK_0 through TASK_whatever, will be set and visible to the batch file while it is running.

Code: [Select]@echo off
setlocal ENABLEDELAYEDEXPANSION
set LOOP=0
for /f "delims=" %%a in ('dir /b') do (
call set TASK_!LOOP!=%%a
set /a LOOP+=1
)

echo use SET without args to list variables
set | find "TASK_"
echo.
echo Expand some of them
echo var0=%TASK_0%
echo var1=%TASK_1%
echo var2=%TASK_2%
echo var3=%TASK_3%
echo var4=%TASK_4%


Code: [Select]S:\Test\Batch\After 06-02-09\looptest>looptest3
use SET without args to list variables
TASK_0=looptest1.bat
TASK_1=looptest2.bat
TASK_10=pr.exe
TASK_2=looptest3.bat
TASK_3=mvdir.exe
TASK_4=nl.exe
TASK_5=od.exe
TASK_6=paste.exe
TASK_7=patch.exe
TASK_8=pathchk.exe
TASK_9=pclip.exe

Expand some of them
var0=looptest1.bat
var1=looptest2.bat
var2=looptest3.bat
var3=mvdir.exe
var4=nl.exe
But after it has finished...

Code: [Select]S:\Test\Batch\After 06-02-09\looptest>echo %TASK_0%
%TASK_0%


that - frankly - is extremely sexy.

mate: Beers owed


Alastair.

(re *nix - no, but i like to keep things nice and tidy)You might want to set a variable (e.g. TASK_MAX) equal to the highest suffix number created...
5490.

Solve : Restoring files created by a "Batchfile" backup (Xcopy)?

Answer»

Hey all,

I found and adjusted this batchfile years ago to backup my Emails and Address book.
Now after years of successful usage, I have a NEED to restore these files.

Can anyone assist me please.

Code: [Select]@echo off
:: Var
set drive=c:\BackupEmail
set backupcmd=xcopy /s /c /d /e /H /i /R /y

echo ### Backing up Emails and Address book (Outlook Express)...
%backupcmd% "%USERPROFILE%\APPLICATION Data\Microsoft\Address Book" "%drive%\Address Book"
%backupcmd% "%USERPROFILE%\Local Settings\Application Data\Identities" "%drive%\Outlook Express"

echo Backup Complete!!
@pause

Also, is there a similar batch for Vista anywhere?

THNX guys.
NT
im not aware of any dos programs that can do that and that can run on Vista but i've checked and it seems that you can run that batch program of yours on Vista.

5491.

Solve : error level in batch file?

Answer»

can any one help me about error level in batch file.

I want to check whether the previous command is executed or not?
which errorlevel # returns this ?i have a list of errolevel # but what i want is not present in this list :

errorlevel0 :: No error
errorlevel1 :: Error opening file
errorlevel2 :: error reading file
errorlevel4 :: couldnot send message: SERVER response
errorlevel5 :: could not connect to server
errorlevel6 :: Fields TO(or CC/BCC) and from are requeried
errorlevel7 :: failed to initialize the windows sockets
errorlevel8 :: MFC initilization failed
errorlevel9 :: invalid port # , valid PORTS 0-65535
errorlevel10 :: File:"file specifice" too big to fit in memory
errorlevel16 :: failed to prepare email to sending
errorlevel17 :: could not save EML file to disk
errorlevel18 :: -TO required when using -SPLIT/_TOEACH parameter.the problem is sloved .

if the command executes it returns errorlevel = 0
and if it doesnot executed it returns errorlevel = 1
Quote from: roohi on September 19, 2008, 03:58:46 AM

the problem is sloved .

if the command executes it returns errorlevel = 0
and if it doesnot executed it returns errorlevel = 1


Not quite. Not all programs produce errorlevels. Errorlevels should be checked in reverse sequence and the actual check is for equal or greater than:

Code: [Select]if errorlevel 1 goto error
if errorlevel 0 goto success

There is also a VARIABLE %errorlevel% (cmd extensions must be on) which is treated as any other variable (ie: if %errorlevel%==1)

The errorlevels for MS commands are not standardized. XCOPY returns 0 if successful and anything from 1 to 5 if not successful.

the difference between this

1. IF errorlevel N command

and the Win2k and later alternative:

2. IF %errorlevel% EQU N command

is that 1 means "if errorlevel is N or greater then do command" whereas 2 means "if errorlevel is exactly equal to N then do command"THANKS for the explanation,
i meant by problem is sloved that for now my problem is resolved .
whatever thaks for the knowladge shared by you.
5492.

Solve : Area Of Adventure - Advanced FTP Game Project?

Answer»

Added basic FTP character creation.
Night all.Most Recent Update:
- [FTP] Added Basic PvComp COMBAT Via FTP
See : http://www.youtube.com/watch?v=-8Lz9oRk6CY&fmt=18bump.
- [FTP] Added Flawless Player Logging In.
See : http://www.youtube.com/watch?v=SOxfO_m7_EQ&fmt=18
what about my password coding ?ill intergrate that into the interfaceQuote from: devcom on SEPTEMBER 18, 2008, 02:35:36 PM

what about my password coding ?
i've been busy.
5493.

Solve : file rescue from a 15 years old computer.?

Answer»

Hello,
I am supposed to get files out of an very old computer.
It is an IBM Personal System/2 Model 50. It RUNS with MS DOS 3.3.

The files I need to save are .lib-files (containing the whole meta information of a Library).

It is possible to copy them successfully to a 3 1/2 floppy disk, but when I put the floppy disk into a drive of a more modern computer, the system tells me "there is no disk in drive". I tried with different computers here. They all announce the same message.

I assume a problem with the DOS version. The floppy disks have been formatet under the old system DOS 3.3. The modern computers use much higher versions. Maybe this IST the point. . . .

However. ... I need somehow to copy the data to a modern PC.
Is there a solution?

I am glad for your help,
SPOON123I have done something similar to what you're doing. My intentions weren't recovery, but I managed to get into a ~14 year old computer.

What I did was simply hook the HARD Drive up as a slave on my desktop and access the files within Windows.I had also the idea to connect the hard drive as slave to a modern computer, but it seems the hard drive in this old IBM PC is fixed within the case, furthermore the connection to the the rest of the system is totally different in the old PC.

It is an 20 MB hard drive, IBM, Model: WD-325N

There are several more informations:
P/N 90X6806
Type 30
20 MB
MLC: A07282

How did you manage to connect to your modern system?

With a lot of thanks for your help,
SPOON123Suspect it is an ESDI hard drive (look it up) totally incompatible with modern stuff.

If both computers have serial or parallel ports you can use file transfer software such as LapLink with a link cable



Thank you very much. I will try with the software and the serial connection.ooohh... a PS/2 System...

What happens if you format the floppy in another machine and attempt to use it on the PS/2?

5494.

Solve : Help in batch file?

Answer»

Hi everyone!...and sorry my english..
I'm a new user of this forum, and i need your help, please.

My problem is:

(imagine that i have 10 folder's...folder1, folder2, etc..each one with 2 files: log.txt and prog.exe (prog1.exe, prog2.exe, etc, depending on the folder's name))

I need a batch file that verify that folder1 exists..
If exist then verify if the file log.txt has the string "100%".
If the folder exist and the string is not "100%", then start prog1.exe, but if prog1.exe is allready running, go AHEAD to the next folder.

Also i need to, say hourly, verify is if the log.txt of the running prog.exe has allready the string "100%" in it. If so, close the prog.exe and go on to the next folder.

And so on...looping all the folder's and back to folder1...and so on.

I hope u can help me here...thanks!
This TESTS existence of folder1, folder2, etc.

Code: [Select]if exist folder1 (
(insert code)
)

if exist folder2 (
(insert code)
)

if exist folder3 (
(insert code)
)
this can work:
Code: [Select]setlocal enabledelayedexpansion
set folderArray=folder1 folder2 folder3 folder4 folder5 folder6 folder7 folder8 folder9 folder10

for %%a in (%folderArray%) do (
if exist %%a (
type %%a\log.txt |findstr "100%%"

if !errorlevel! equ 1 (
tasklist /V >nul |findstr "prog1.exe" || prog1.exe
) else (
taskkill /IM prog1.exe
)


)
)
pauseThanks for the help!

I kind of arrange some code that work for me, but i guess its a little mess, take a look please:



Code: [Select]:start

if exist folder1 goto loop1

goto Continue1



:Loop1

find /i "100%%" folder1\unitinfo.txt
if %errorlevel% EQU 0 (goto Continue1)
tasklist.exe /FI "IMAGENAME eq fah1.exe" 2>NUL | find.exe /i "fah1.exe" >NUL || GOTO START1
ping -n 300 127.0.0.1 >NUL
GOTO Loop1
:start1
cd cfolder1
start fah1.exe
GOTO Loop1
:Continue1
TASKKILL /F /IM "fah1.exe"


if exist folder2 goto loop2

goto Continue2


:Loop2
find /i "100%%" folder2\unitinfo.txt
if %errorlevel% EQU 0 (goto Continue2)
tasklist.exe /FI "IMAGENAME eq fah2.exe" 2>NUL | find.exe /i "fah2.exe" >NUL || GOTO START2
ping -n 300 127.0.0.1 >NUL
GOTO Loop1
:start2
cd folder2
start fah2.exe
GOTO Loop2
:Continue2
TASKKILL /F /IM "fah2.exe"

'and so on until folder 10 (folder1, folder2, etc..)

goto start


The only thing i need now is to, at the end, before the last loop (goto start), check in every 10 folder's if all unitinfo.txt has a string with "100%"..if so Exit.

Thanks again!
why you want to make code for each folder ?

try now:

Code: [Select]setlocal enabledelayedexpansion
set folderArray=folder1 folder2 folder3 folder4 folder5 folder6 folder7 folder8 folder9 folder10
set cout=0

for %%a in (%folderArray%) do (
set foldNum=%%a
set foldNum=!foldNum:~-1!
if !foldNum! equ 0 set foldNum=10

if exist %%a (
type %%a\log.txt |findstr "100%%"

if !errorlevel! equ 1 (
tasklist /V >nul | findstr "fah!foldnum!.exe" || %%a\fah!foldnum!.exe
) else (
taskkill /IM fah!foldnum!.exe
)

call :CheckAll

)
)
pause
exit


:CheckAll
for %%a in (%folderArray%) do (
type %%a\log.txt | findstr "100%%" && set /a cout+=1
)
if %cout% equ 10 exit
exit /bHi there!!

Well, is almost perfect!!..
I made the code for earch folder because i'm not used to code...i saw some code samples and try to arrange them at my need...

To work perfectly, i just need two more things:

1- verify in every 30 minutes (for example) the log.txt of the current running aplication "fah!foldnum!.exe", to SEE if has allready the string "100%". (before check the next folder)

Like this Code: [Select]:Loop1

find /i "100%%" folder1\unitinfo.txt
if %errorlevel% EQU 0 (goto Continue1)
tasklist.exe /FI "IMAGENAME eq fah1.exe" 2>NUL | find.exe /i "fah1.exe" >NUL || GOTO START1
ping -n 300 127.0.0.1 >NUL
GOTO Loop1


2- i also need this code in it, to run aplication:

Code: [Select]cd folder1
start fah1.exe

I've tryed to modify your code with this things but wont work..
May i ask one more BIG help with this?
Tanhks


Sorry..
Can anyone help me here, please?
Thanks a lotCode: [Select]@echo off & setlocal enabledelayedexpansion
>sleep.vbs echo wsh.sleep 10000 ^'ms

pushd "c:\program files\[emailprotected]"
for /d %%a in (work*) do (
echo [%time%] %%~dpna

pushd %%a
set f=&for %%b in (*.exe) do set f=%%b

if exist unitinfo.txt if defined f (
find "100%%" unitinfo.txt>nul && (echo taskkill !f! here)||(
tasklist|find "!f!">nul||echo start !f! here)
)
popd
)
popd

for %%a in (cscript//nologo del %0) do %%a sleep.vbs

5495.

Solve : What version is it??

Answer»

Hi all,

New here and will be asking a hand full of questions...but just to start;


DoS version (ver) comes back as 3.11 - is that possible?

What can I do to get more information about this box to know it better and what are the available commands or procedures to look at. Any direction or thread pointing would be appreciated.

All the best,
LynxTech3.11 sounds like a Windows version to me...
Are you working from a command prompt window on this box ? ?
If so at the C: prompt type dir /p and see what directories on this drive come up...
The /p switch is so you can move down the page one line at a time with the spacebar/down arrow...Well, when I interrupt the program that is PATHed to RUN I am at a c prompt. I will get the directory structure today, though I believe I saw a directory just called 'WIN'. I tried to invoke it but nothing happened.


I will post later today with the directories, thanks!there was a 3.1 and a 3.21 of MS-DOS but no 3.11.

additionally how did you try to "invoke" a directory?Quote from: BC_Programmer on March 04, 2009, 05:52:52 AM

there was a 3.1 and a 3.21 of MS-DOS but no 3.11.

additionally how did you try to "invoke" a directory?

I shudder to think.
Slightly off-topic, but did you know this? I didn't. From a blog I found.

Quote
Microsoft's licensing spokesperson "Rich H." told me, on 2-8-00, that ANYONE with a valid license to use any recent version of Microsoft's operating systems (Windows 95/98, NT) is also licensed to use any older version of Microsoft DOS products, and can obtain DOS 6.22 media for nominal cost from their supplemental materials unit.
Interesting...This may mean that although it may be "illegal" to download those DOS 6.22 install sets that we all know about, it may not be illegal to use them.
Quote
supplemental materials unit.

Who would this be ? ?Quote from: patio on March 04, 2009, 05:08:35 PM
Quote
supplemental materials unit.

Who would this be ? ?

The division of Microsoft that produces instruction books, etc, I believe. I think it may now be part of Microsoft Press.
Quote
additionally how did you try to "invoke" a directory?

Quote
I shudder to think.

You folks NEVER used sage, crystals, eye of a knute (newt) or hair of a yak? These are essentials to have around the the TOWER as I bring up the command prompt.


I do not know why I was able to get MS-DOS 6.22 this time. But I am still confused about windows living on there or not. I would think it is there because I see WIN31 when I do DIR on the c:drive. I go into WIN31 and I see . and .. 2files. I do not see any exe and I tried to just type win and win31 with no action. And yet a program lives on there that when 'involked' it have the same gui as windows 3.1. Any thoughts?


Quote
at the C: prompt type dir /p and see what directories on this drive come up...
Some (not all) of the other directories are Autoexec bat & ONS, BACKUP, COMMAND COM, CONFIG SYS, DOS, LAN, NETSYS, PCISYS, POST, QEMM,SIGSYS, TEMP, WIN31, AND, WINSYS

I will want to know how to backup to an external drive and how to image or copy to an external drive. I would like to parallel this system on another box to play with it and to have a copy.

Thanks for all the FEEDBACK!!

Lynx
5496.

Solve : using the '%' in a .bat file as a literal?

Answer»

Hi all,

I am trying to use a '% ' as a literal in a .bat FILE.
As an example I want to runa .bat file with the following command;
2300%20West
The "%20 is the delimiter and I want it to run as a delimiter, but when run in a .bat file, it is DISPLAYED as ;
23000West
is it possible to TREAT the '%20' as a literal ?
any HELP would be greatly appreciated

RbakerjpqCode: [Select]2300%%20West
To sum up, double up the % signs in a BATCH to make them literal

5497.

Solve : How do I delete the extension file on batch program?

Answer»

Hi,

I have a for loop that listed some files on a directory. In the for loop, the files have been saved as variable %%f. How do I filter or remove the extention of the file. For example: %%f = abc.fm I want to remove the .fm. The result should be %%f= abc

I tried to use few methods below but not working. Please see my simple program below:

rem saveasfm2xml.bat
@echo off
:STARTLOOP

rem %1 is directory passing
SET _d="%1"
cd %_d%
if "%1" == "" goto ENDLOOP
for %%f in ("*.fm") do (
echo %%f

SET z=%%f:~0,-3%
ECHO %z%

SET z=%%f:.fm=%
ECHO %z%
)
shift
goto STARTLOOP
:ENDLOOP

Please help.

Thank you
Quote from: txnguy3 on MARCH 04, 2009, 02:53:29 PM

I have a for loop that listed some files on a directory. In the for loop, the files have been saved as variable %%f. How do I filter or remove the extention of the file. For example: %%f = abc.fm I want to remove the .fm. The result should be %%f= abc

You need to study the FOR variable modifiers.

Type FOR /? at the prompt.

The ~n modifier is the one you need. Others will get the drive, path, extension (including DOT), size, date, etc.

e.g. if the file was called abc.fm then Echo %%~nF would echo abc to the console.

Also, your %z% variable which you think is going to hold the last 3 chars of the FILENAME + extension string, won't work in a loop. (Study "delayed EXPANSION".)

Also that string substitution ( SET z=%%f:.fm=% ) would be a problem. For the same reason and others. Anyway you don't need these now.






5498.

Solve : Copy Registry value from one key to another?

Answer»

Hello,
I am facing a simple problem to which I am unable to find a simple answer although I have a strong hunch the solution is simple.

I have a value defined in the registry key

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Parameters]
The value is a variable VAR_1 = -Xmx332m (REG_SZ)

What I wanted to do is read this variable value into this registry key

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]

The WHOLE problem occurs because I have to do this trick from a windows batch file.

Here are the few aprroaches I have in front of me -

1. Export the registry key , do a file string replace and import it back. The con the exported .reg file is not in the same encoding format as a txt file, so I cant search and replace easily. Also, the file search and replace is unnecessarily complex in Windows.

2. Echo the registry value in command prompt and have it in a temp variable and then use that to add a new variable in the registry. Again, this is difficult as when I echo the registry value, windows doesnt give me only the value but also other strings that make it difficult to parse through it.


Does any one have encountered a similar task before. ? I badly need to find out if there is a simple solution for this.

Thanks for the help.
Anand
RegEdit will export in Unicode by default
You can also select Win9x/NT4 export, which I believe is simple ASCII.

I have no experience of REG.EXE, but this may be more suitable for control via a batch script

Regards
Alan
Got the solution.
Here is how you go about -

1. Export reg file to a .reg file.
2. Use Type Command to convert the .reg file into an ASCII File.
3. Replace using any file replacement utility.
4. RENAME the file to reg file.
5. Import the reg file.

This works absolutely fine with a small glitch though. I can very well observe in the registry editor that the Values are being created. HOWEVER , when I try to echo these values on the command prompt, these values do not SHOW up.
the way around is to open Environment Variables manager through My Computer and save from there.
BTW, the registry variables I tried to create above were new environment variables.

Do you know any way to save the imported reg file thus created or to have windows pick up the environment variables created thus from command prompt.?

5499.

Solve : Test to see if Batch File is running?

Answer»

Oh, I was thinking to see if there are to sessions of cmd.exe running. Maybe the batch file could create a file when it starts, and delete it when it completes.

The batch file could then check for the existence of that file when it starts, and if it finds the file, it would exit, or else it would carry on.
That would be a lot of work. Because the only way that you could really quit would to click the exit button in the corner of the SCREEN. Or doing quit. But the person will probably press the X button. Quote from: BatchFileCommand on March 02, 2009, 07:25:47 PM

the only way that you could really quit would to click the exit button in the corner of the screen. Or doing quit.

A batch file will quit when it encounters the EXIT command. I may have misunderstood your requirements, but what I was thinking of was something like this:


@ECHO Off
:: Check if temporary file exists
If Exist %temp%\AlreadyRunning.tmp (
Echo This batch file is already running & Goto :EOF)
:: Else create it
Echo . > %temp%\AlreadyRunning.tmp
:: Carry on with remainder of batch file
Echo.
Echo Do whatever here, then
Echo.
:: Delete temporary file
Del %temp%\AlreadyRunning.tmp

My program. Doesn't really have a beginning and an end. It has a old GUI with options.Quote from: BatchFileCommand on March 03, 2009, 07:57:08 PM
My program. Doesn't really have a beginning and an end. It has a old GUI with options.

all programs have a beginning and an end. instead of exiting the batch file using EXIT, you can REDIRECT to a label that performs the necessary cleanup.Even if it does have a beginning and an end. What if someone doesn't know about the file and clicks the X button in the corner of the screen. Then they would NEVER be able to use it again. This is why I stopped using this method in my batch files/programs early on.
5500.

Solve : Dos Query?

Answer»

Hello Sir,

I am using XP OS.

Please give a SOLUTION for the below mentioned query of mine :-


1)What is the use of AGP Slot ?

2)Is there any command from dos for the following query :-

A) to lock the internet of any pc which is there on networking. But LAN connection should not be disconnected ? B) How to put passsword on any folder ? C) Any command to see all the ip address of all the computer connected to network? D) many times I see that some WINDOWS file get corrupt . So how to recover that file again .

Please give me solution for the above.

Regards,

Anjeep




Homework of a sort?B) You can put a password on a a folder (and/or) the files in it using encryption software.
Google it and I'm sure you will find something.

I don't have a solution for the other questions but I'm sure someone else here will.

Good luck!Quote from: anjeepsolution on November 04, 2008, 04:46:47 AM

D) many times I see that some windows file get corrupt . So how to recover that file again .

Your troubles could easily escalate.

If you password protect or encrypt folders etc, they will be lost for ever if the next corruption happens to a file holding the password or encryption key.

I think you should fix your computer so that file corruption is no longer its life style, otherwise after encryption etc. you could be locked out for ever.

Regards
Alan
Quote from: Carbon Dudeoxide on November 04, 2008, 05:08:55 AM
Homework of a sort?
Quote from: anjeepsolution on November 04, 2008, 04:46:47 AM
C) Any command to see all the ip address of all the computer connected to network?

If it's a network with a routher then the router should give you a list of IP's/computer names on the network, try to put this in your browser... 192.168.1.254

FBQuote from: anjeepsolution on November 04, 2008, 04:46:47 AM

1)What is the use of AGP Slot ?

What do you think?
i Downloaded Migo digital Vault from google.
So i WOULD like to know will this software help me to put password to my folder.

Please inform me because i have this sofware in my pen drive. And till now i have not
installed in my pc. So if you suggest that it is safe to use it . Then i will download it.

Regards.

anjeep