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.

5901.

Solve : disconnect command?

Answer»

Hi is there a command to disconnect/connect from the internet in dos?I think you can type "ipconfig /release" to disconnect your IP settings, and "ipconfig /renew" to renew them.Quote

I think you can type "ipconfig /release" to disconnect your IP settings, and "ipconfig /renew" to renew them.
No that won't disconnect me I'm on a broadband connection.
I can do ipconfig /flushdns but when I try ipconfig /release and ipconfig /renew I get an OPERATION failed as no adapter is in the STATE of permissible for this operation.Quote
No that won't disconnect me I'm on a broadband connection.
I'm on a broadband connection too, do you mean you have the broadband modem plugged DIRECTLY into the back of your computer?Quote
Quote
No that won't disconnect me I'm on a broadband connection.
I'm on a broadband connection too, do you mean you have the broadband modem plugged directly into the back of your computer?

No I have it GOING to a hub than the two pc's
thanks for your help btw An alternative is to use a fire wall such as Zone Alarm, which has the capability of locking down the internet. The Internet Lock feature prevents all traffic to/from the internet for the computer on which it is installed.
5902.

Solve : xcopy ignoring same name files??

Answer»

i'm trying to move files from one folder to another. however the distination folder share the same files (updated) and as such same filenames as some i'm trying to move

i WANT all files moved across, except those that share a name, these can be ignored. i can only find help which will move the files and OVERWRITE the same name files, not IGNORE them
ie /y and /-y

and help would be gratefully RECIEVED

fyi using Windows 2k, writing using notepad, RUNNING as a .bat file


i have just found the /u command which only moves same name files....looking for the opposite of this!
I usually use the XCOPY /s/d/y switch combination to replicate ( only new files or edited files ) The newest Date/Time Stamped Files and only new files that dont already exist will copy over to the destination.

This command will replac ethe same file name at the destination if there is a file there of an older date/time STAMP. If the date/time stamps are the same it will not touch the same file name file.

You can also add a SAFETY net routine to backup files to be replaced in a archive folder, so that you can fall back on the prior file if needed vs having it stomped out via the newest date/time stamp of a same filename and extenstion file.

Hope this helps.

By XCOPY/? you can see the help with all commands...

5903.

Solve : help with the "RD" command in a .bat?

Answer»

I work at a school and every time a student logs on a PC it creates a profile folder in C:\Documents and Settings. I WOULD like to run a script to delete them all. Eventually there are hundreds of profile folders taking up 4 or more GB of space. If I leave the path as above it will try to delete Administrator, and All Users, then get an error. Can I delete everything in a directory except certain path names, or are there any other idea's for me to try???That would be relatively simple, HERES an outline
Assuming you are in C:\Documents and Settings

Code: [Select]:: iterate through each directory in the directory
For /D %%a in (*.*) do call :KillUser %%a
Goto :EOF

:KillUser
:: %1 holds the name of a folder

:: skip wanted profiles
If "%1"=="Administrator" GoTo :EOF
If "%1"=="All Users" GoTo :EOF

:: etc for all profiles you want to keep

:: now remove the profile
RD /S /Q "%1"
Sorry but there is a bit more to do on this, I dont have time to investigate further
Make sure you check it on a MACHINE where it doesnt matter if you break it!!

It might be that by removing a folder from the list it gets confused, in which case, output the folder list to a file, then use another loop to read the file and delete the profiles from there.

Graham
gpl, this is what I was going to post...

Right. You work in a school. OK. Like we believe you, but what if you're a student planning a prank? (You would not be the first one on here!)

Dias de verano- Why would you even waist your time in the forums on this site when it is meant to ask these kind of questons. Do you get on every post and say "no your not legit....To bad... not gonna help you".??


Every PC whether your at a school, a business, or at home you still have "C:\Documents and Settings" with profiles in it. I'm not asking how you hack a server... I'm simply asking for pointers about a RD script in a MS Dos forum.You sure spell bad for someone who "works in a school", and you show the sort of attitude you expect from a 14 year old.
This doesn't look like a question a hacker might ask, more like how to put something in a start up folder.I'm not an English teacher... I'm in the tech department. Sorry for any spelling errors. I'm not trying to have an attitude of any sort. I'm simply trying to get this figured out to make my job easier. So far I have to two ideas, which I'm not really happy with either.

Idea #1

@echo off
title HS list- local users
rd /s /q "c:\Documents and Settings\user1"
rd /s /q "c:\Documents and Settings\user2"
rd /s /q "c:\Documents and Settings\user3"
rd /s /q "c:\Documents and Settings\user4"
pause
exit

This would work, but it just isn't practical. Our district is very small but still have around 1,150 students. I can copy paste very quickly and would just have to delete Seniors and add 6Th graders every year. Also We have PCs ranging form Dell GX280's all the way down to Dell GX150's, which perform the long task way to slow because it is checking for every student even though the average PC only has between 2 and 3 hundred profiles.

Idea #2

@echo off
md "C:\Move_Here"
pause
rd /s /q "C:\Move_Here"
pause
exit

This idea is slightly more practical. Basically you run the script it creates the "move_Here" folder. You would then have to manually move all the user folders to it. Moving isn't all that slow compared to copying. Then it removes the "Move_Here" folder. Leaving my couple of folders that I need to keep. The biggest problem with this is having to manually move them witch I'm trying to reduce my interaction time with the script.

I should also add we used to just highlight the profiles we wanted to get rid of, then hit delete. Then we would have to empty the recycle bin which took an additional 10 minutes.

As you can see I have some scripting knowledge, but it's not advanced as I'd like. Also know that if I didn't have admin privileges, and I ran a script of this sort, it wouldn't let me delete them. It would say access denied. Once again, thanks for any help I get.It might be better to use VBScript to do that.

Here's one i found by googling...

http://www.wisesoft.co.uk/Scripts/display_script.aspx?id=14

I personally recommend vbscript over batch files for this kind of procedure. It's more healthy.You should look at gpl's idea / code. It looks like it should be pretty efficient and work pretty well.

Or try this:
Code: [Select]@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir "C:\Documents and Settings" /ad-h /b') do (
set deluser=%%a
if "%%a"=="Administrator" set deluser=
if "%%a"=="All Users" set deluser=
if not "!deluser!"=="" echo rd "%%a" /q /s)That should delete everybody except "Administrator", "All Users" and any hidden profiles which are probably system profiles.Use delprof /Q /C:\\

This tool is part of the WindowsServer2003-AdministrationToolsPack.exe, or you can download delprof.exe from the Microsoft web site

5904.

Solve : How can?

Answer»

How can i BLOCK the property for desktop BACKGROUND chanching ? (If i can)
Whitch COMMANDS of msdos.
Thanks

5905.

Solve : Set help?

Answer»

Hey

im trying to make its so that when you are given a choice in a set /P command
you can only do numbers. Is there an EASIER way to do this other than
going thru and putting "if equ a, if equ b...etc"

ex.

set /p a=Pick a number
if %a% equ a exit
if %a% equ b exit
...

making a only equal a number

There are a few ways to do this, here's one:

Code: [Select]set /p a=Pick a number
if %a% GEQ 0 if %a% LEQ 9 goto numeric
goto :eof
:numeric
.
.
.
and is it possible to set the number of digits for %random% ?Sort of.

one zero, single digit random number:

@ECHO off
set /a rnd=%random% / (32767 / 10)
echo %rnd%

two zeroes, double digit random number:

@echo off
set /a rnd=%random% / (32767 / 100)
echo %rnd%

three zeroes, three digit random number:

@echo off
set /a rnd=%random% / (32767 / 1000)
echo %rnd%


You can decide if this information has any value.


5906.

Solve : boot dos cd and access files outside of img?

Answer»

is it possible to boot a dos cd and access files outside of img on the same cd? if not, how can i use my files when in dos boot cd mode? i hope you get this QUESTION...Quote

is it possible to boot a dos cd and access files outside of img on the same cd?

I've never done it with DOS with a CD, but I've done it zillions of times with a floppy.
That is - boot from a floppy, and access and use files on the hard drive.
I would expect to be able to get the same results, booting from either floppy or CD.

It is possible, but not guaranteed. For example, the hard drive may be malfunctioning. Booting from floppy won't help that.



Quote
if not, how can i use my files when in dos boot cd mode? i hope you get this question...

Not to complicate the issue, but I have booted from CD, with linux, and accessed and used the hard drive.


We don't know what it is that you are trying to accomplish yet - beyond booting to DOS from CD. Maybe it would be better if you described whatever it is that you are working on, and what you want to do.


I just want to run some dos games at prime, and the reason i cannot access the hard drive is because it isn't the correct file system.Quote
I just want to run some dos games at prime, and the reason i cannot access the hard drive is because it isn't the correct file system.


So your DOS CD boots fine?

But after you boot, you cannot access files on your hard drive, and that is because DOS doesn't recognize whatever file system your hard drives uses? Is that it?

What file system does your hard drive use?
I don't know if what you want to do will be possible at all, but anyone reading along here will need this info to help you.


When you boot to Dos, at the command line EXECUTE this command
ver
and post back here what it responds with.

How would you auto boot a Batch file from a floppy please tell!! It would save me a lot of time been a sys-admin

Thanks!!Quote
How would you auto boot a Batch file from a floppy please tell!! It would save me a lot of time been a sys-admin

Thanks!!


1.) Best to start a new thread, rather than RIDE on the bottom of an older ONE. That way your question gets more exposure and the attention it deserves, and you get a better chance of getting more help.


2.) Need you to re-phrase and perhaps explain what you mean.
I think the answer will be to run your batch file from the last
line in autoexec.bat - but again, am not sure now.
Start a new thread, ask your question, and it might be best
to describe an example of what you want to do.



5907.

Solve : command line argument in Batch file?

Answer»

how can i call/use the command line arguments inside a batch file ?
eg:
myfile.kit wrap commandlineargumentI'm not exactly sure what your example means. But I'll make an attempt to answer.

Use a variable.

Here is a example batch file. Silly as it MAY be, it illustrates how command line VARIABLES are used. Save it as a batch file and PLAY with it, and you'll quickly get the idea of how to use them with your commands.

Code: [Select]@ECHO off
@cls
echo.

echo Here is the first command line arg %1

echo.

echo And here is the second command line arg %2

echo.

Let's assume you saved that as test.bat .

If you run it like this:
test first second

You'll get:

Here is the first command line arg first

And here is the second command line arg second



Run it again - type WHATEVER you like as the first and second command line parameters, and they will passed into the batch file.

I hope this helps.

5908.

Solve : Yes or No reply?

Answer»

Hi

Ive done a batch job to perform some tasks, one being to delete FILES in a folder. I did this with "DEL *.*" however it ASK "Are you sure (Y/N)"

So my question is: What is the command to use to if I need my reply to be Y averytime.

Regards
Sounds abit SUSS... Anyway this is how you do it

Code: [Select]Echo y | del PATH\file
Hope this helps!Hi Twiceborn

It worked ok, thanks for the help and quick reply.

Regardsdel has the /Q (quiet) mode
see hereCool thanks, i NEVER knew of the /Q para cheers!

5909.

Solve : Help with bat file for Vista reboot-Update-SOLVED?

Answer»

I like the dual boot walkthroughs.. Would have been nice to have as I was copying partitions and setting up 2 XP and 2 Vista loads on my multiple HD's. Never fear it all WORKED out.


When I installed XP originally, it naturally chose to install itself to the C:\ drive.

Strangely enough... When I installed Vista it named its install drive C:\ as well. Fine by me.

Now when I'm in XP it see the Vista drive as E:\.
Vista sees XP as E:\

Conveniently enough they just swap drive designations upon boot. So I never have to deal with the issue of my OS being on a "strange" drive letter.
Note: Vistaboot pro does show a different drive letter for XP. HOWEVER this doesn't seem to phase XP at all, bootloader says one things, XP does another...

Is this COMMON? or am I special?
As this is somewhat on a related topic I will post this link:

http://www.goodells.net/

It may look unrelated at first but scroll down to see the links of interest which sheds light on all sorts of booting issues on different computer setups.

For me these articles were a goldmine.Quote

Any preference vs. Easy BCD ?

Whatever works and STAYS the heck outta my way is my motto....

Quote from: patio on February 05, 2008, 08:46:47 AM
Quote
Any preference vs. Easy BCD ?

Whatever works and stays the heck outta my way is my motto....




Cool.
Was hoping that maybe you'd tried both, and would have an opinion to share. Vista bootPro won't automatically change your default with just one click as well as force reboot..... should read the entire post...thanks anyway.Quote from: matnat on February 22, 2008, 12:42:20 PM
Vista bootPro won't automatically change your default with just one click as well as force reboot..... should read the entire post...thanks anyway.

I'm not sure what your saying here...
5910.

Solve : Current file name generation .bat?

Answer»

Good afternoon.

WinRAR and WinZip have the options in the context menu called:
"Extract to here"
and
"Extract to nameofthearchive\"

I'm making this for all images, using the program called MagicISO which has an extra inbuild exe for command line extracting.
This is the line:
"C:\Program Files\Magic ISO\miso.exe" "example.iso" -x "C:\example destination"

What is the code to retrieve the orginal file name except for the extension and paste it in the destination PART, just like WinRAR and WinZip so that if I make an extra context menu OPTION named "Extract to filenamewithoutextension" for example "Extract to *censored* Number Two\", it will extract in the folder which name is the same as the archive/image.
Something like this:
MD "%nameofthefile%"
So that it RETRIEVES his name from the file!

Thanks in advance!

Greetz RUBEN

5911.

Solve : shutdown from batch file in xp limited account??

Answer»

Hi,

I tried shutdown -s in a batch file from my limited account but it's telling me a required privilege is not held by the client. Is there a way I can elevate my privileges specifically for this batch so it will shutdown the computer without having to drag the batch file into a privileged command prompt. Obviously, if I were GOING to do that I could more EASILY go to start > turn off computer.

Thanks for your time.

chin

Quote from: chin on February 22, 2008, 01:10:39 PM

without having to drag the batch file into a privileged command prompt.

How did you CREATE this privileged command prompt? You can use the runas command to run a JOB using more privileged credentials. Note: you cannot supply the password on the command line and the password must not be blank.

runas /? at the command prompt will give you all the gory details.

5912.

Solve : Searching for specific folder?

Answer»

Hi,

Is there a command that I can use that will allow me to search specific folders? I NEED to search for specific folders on the server. I was thinking of using the tree command to get a list of the entire directory, then output it to a file and just search for the folders, but I thought there must be ANOTHER, easier way to do this. The FIND or findstr command seem to only search files, but I want to search one level up.

Thanks.
the dir command should be sufficient for your needs. please check dir /?, especially the /S SWITCH.
For example, if you want to search for files called "test.txt", starting from c: drive
Code: [Select]C:\TEMP>dir /S c:\ | findstr "test.txt"
09/03/2007 10:08 PM 466 test.txt.lnk
09/03/2007 10:04 PM 88 test.txt

5913.

Solve : how to make bat file that is a text editor?

Answer»

help. im trying to make a bat file that lets me type in what ever i want and doesnt respond to the text. like they have on the old MS-Dos Edit.you can type edit for "old ms-dos edit"
or you can type copy con >>%tmp%\h.txt , were %tmp%\h.txt is the stored file , PRESS ctrl+Z to save iti have a quite interesting one saved somewhere around here that i made. I'll SEE if i can look it up for you. Well not EXACTLY the one i was looking for but this one is cool too. You can name the file also.

[file cleanup - saving space - attachment deleted by admin]thanks this was exactly what i was looking 4.
thanks!yupp ;-) FEEL free to edit it to fit your needs

5914.

Solve : Delete Directories by Date?

Answer»

Ok, I am trying to set up a back-up BATCH file...

XCOPY C:\tmp \\server\tmp /E /V /Y

No problem, right? Ok, but now I want to delete all folder with a modify date of 30 days or older from the back-up destination (target) before doing the xcopy...

RD /Q \\server\tmp
XCOPY C:\tmp \\server\tmp /E /V /Y

This deletes all directories in \\server\tmp. How do I limit it to deleting directories with modify dates < CURRENT date -30 days?

5915.

Solve : xcopy problem...?

Answer»

I recently made a BATCH file that would copy and replace a file on a floppy (i USED the same file a lot). It saved me some time and it works great. I decided to switch to a usb stick, but when i changed that command to copy it to my usb stick it cam up with a message saying 'ACCESS DENIED'. Any help?
Also, when i manually went to my computer and copied it over it sayed something 'like to copy this over you will lose your encryption'. Is there some protection that Microsoft made that doesn't let you do that?Googled? Lots of info on the WWW. Does the usb stick work on another pc? Is the stick FORMATTED? etc... See >>here<<

Good luck.

some memory sticks do have a protection lock on the side or back end, the lock is just like the lock that you see on a stiffy diskSorry i should have clarified more. The usb drive works on other computers and i was able to copy the files manually over but it came up with a message saying ' if you copy this over your encryption will be lost pess ok to copy' (or something like that).
Any help?

Also, Dusty thanks for t he link but it is exactly the opposite. I can access my usb drive in explorer but not in cmd.Did the memory stick come with any utilities already on it?
no. I think it has something to do with my specific computer. But to be sure i'm going to try the xcopy command on a diffrent one.Will be interesting to see what happensIs this under Windows XP? It sounds like you may have said "Yes" to the question "Do you want to make this folder private" OPTION which encrypts your files under Windows XP. The encryption can by carried between NTFS volumes, but USB drives are usually FAT or FAT32 which does not support encryption. Try disabling encryption on your "My Documents" (right-click -> Properties).I am using xcopy to backup some local file to a NETWORK drive. I would like to use the "Exclude" switch of xcopy, but so far have been unsuccessful. Must be a syntax problem, I'd guess. Ideally, I would like to exclude an entire folder, but excluding a list of file types would be my second solution choice.
This is my command line (in a batch file):

xcopy "C:\Documents and Settings\ken.DWDOMAIN\*.*" "G:\FORMS\ken\Kens Bkup from Local\DocsAndSettings-KenDWDOMAIN\" /e/y/EXCLUDE:\My Music\Try XXCopy from http://www.xxcopy.com/index.htm

Good luck.

5916.

Solve : does the compare command, compare 2 files line by line?

Answer»

does the COMPARE command compare 2 files(that are specified) line by line
if so this command can be USEFUL if U want to make an Anti-Virus software in batch programmming.You could generate some test files by hand and try it out, then you'd know.

type fc /? at the prompt to find out the switches.
thanks

5917.

Solve : Ask In Batch File Code ..?

Answer»

Hello ..

I want to make many programes silent INSTALL >> and I want to make it AUTOMATIC .. using batch file .. but I do not want to install there in the same TIME ..

I want to make silent insatll for program 1 then when it installed ok and finish install

install the next program >>

How ..!!??


And can I make refresh ( not for web page ) by batch file code ??

ThanksYour question is too generic for an accurate answer. Which programs do you want to install, and why do you need a "silent" install?Quote from: GuruGary on February 23, 2008, 02:11:10 AM

why do you need a "silent" install?

Yes, why?
First .. Thank You

I The programes I need I have there .. and ready to use ..

They ready to install silent install >>

My problerm is how to make there Automatically .. but not all in the same time ..

when the 1st program finish install .. 2nd program install .........

Thankswhy do you want silent install?
because after format I take many time for install an important programs

and I want to save this timeMany times silent installs are done over a network where the installation files live.

Quote
They ready to install silent install >>

If in fact you have all the COMMAND line arguments set up, your batch file needs to run each of these commands sequentially (that's the SIMPLE part).

Quote
because after format I take many time for install an important programs

Where does this batch file reside? After a format there is nothing on the disk, including but not limited to an operating system.

If this is for just one workstation, I don't see the point. You'll still need to insert CD's for the install. If this is over a network, your silent install file will need to know where the installation files reside and the responses to any questions the install might need to answer.

Perhaps you could give us more specific information. Not all applications can be silently installed.

5918.

Solve : Two var into One?

Answer»

how can i make that if i have that code
Code: [Select]set var1=b
set VAR2=7
set b7=O
if %var1%%var2%==O goto A
echo B
:A
echo A
pauseto make a variable CHECK from another TWO...?
i want to chceck if b7 equ O but making this var from var1 and var2
sory if you cant know what im seying mabey you understandYou cannot do this. You are confusing variable names and variable values.

u can only do that if u store value of "%var1%%var2%" into valid variable name.
so, your code should be like this :
Code: [Select]set var1=b
set var2=7
set b7=o
call set temp_var=%%%var1%%var2%%%
if "%temp_var%"=="o" goto A
echo B
:A
echo A
pause
Worked!
Thanks!Quote from: Fen_Li on FEBRUARY 23, 2008, 10:27:22 AM

u can only do that if u store value of "%var1%%var2%" into valid variable name.

Sorry, but not true!

Quote

@echo off
set var1=b
set var2=7
set b7=0
echo var1=%var1%
echo var2=%var2%
echo b7=%b7%
echo var1var2=%var1%%var2%
if "%var1%%var2%"=="b7" echo BINGO


Quote

var1=b
var2=7
b7=0
var1var2=b7
BINGO


5919.

Solve : W.2K batch scripting help please.?

Answer»

I want to execute multiple programs in sequence. The programs are stored in a directory named D:\Progfils. I also want to ensure that a second and SUBSEQUENT PROGRAM is not started before the previous one has ended. Can this be done?

My code so far:
Code: [Select]@echo off
cls

: Set variable for Progfils directory
Set progfils=d:\Progfils\

: Create program file names list in alpha sequence..
DIR /on/b %progfils% > d:\temp\filename.txt

: Start program sequence..
FOR /F %%a in (d:\temp\filename.txt) do start %progfils%\a%%

At this point I need some coding to ensure that the second and subsequent program does not start before the previous one has completed. PLEASE indicate what command will achieve this.

Thanks.in a sequence like such in such file 1st and so in so file 2nd
or just all of the programs togther?Sorry, I really don't understand your question.

The programs are to be run in alpha sequence from A to Z but program B must not be started before program A has finished, program C must not be started before program B has finished etc... Only one program is to run at any time.
ThanksTry adding the /WAIT to your START command. Like this:
Code: [Select]FOR /F %%a in (d:\temp\filename.txt) do start /WAIT %progfils%\a%%Thank you, that looks like what I need.

Edit: Yes, worked like the PROVERBIAL charm, thanks again.

Alf.

5920.

Solve : SOME QUESTION????????

Answer»

I am trying to master msdos .But is it necessary to learn EDLIN because i find it really annoying.And can anybodey tell me wahats the difference between ANSI and BINARY FILE .
when i open my msdos by default the working diorectory is
c:\>documents and settings\RITUL (ritul is my NICKNAME)
how to make d drive my working diorectory i am typing chdir d:\ but for a moment the dos windows display
d:\>
then again it retuns TOC:\>documents and settings\ritul
THANKS IN ADVANCEWelcome to the CH forums.

Which operating system are you using?

It is definitely not necessary to learn EDLIN, lots of other editors are available.

An ANSI file will contain only characters which appear in the ANSII CODE which is shown here. ASCII stands for American Standard Code for Information Interchange.

Binary files contain entries which lie outside the ANSII code although some may be interpreted as ANSII codes.

Chdir (or simply cd) means change directory. D: is a drive and to get to it you simply enter D:

I think you are possibly using the Command Prompt in XP (cmd.exe) in which case you are not using MS-Dos but a Dos emulator. The permitted COMMANDS for cmd.exe are listed here.

Good luck

Yeah, you are absolutely right dusty I am using windows XP(SP2).Thanks for your quick rply .I wil be really happy if you tell me what is a dos emulator
.If the dos which i am using is not a actual msdos(operating system) then where can i find the actual msdos.
Plzz correct me if i go wrong anywhere as far as the technical terms are concerned.Quote from: bodhi2016 on February 09, 2008, 04:38:25 AM

I wil be really happy if you tell me what is a dos emulator
Emulator
The command prompt in XP isn't MS-DOS. It is an application written for Windows.

Quote from: bodhi2016 on February 09, 2008, 04:38:25 AM
then where can i find the actual msdos.
MS-DOS isn't freeware. So if you want the real deal you will have to buy it.
There are alternatives though.
DOSBox is another DOS emulator that does a much better job than the emulator XP ships with.

If you want the full DOS operating system experience then something like DR-DOS might suit you. Note that DR-DOS cannot run from within Windows, you will need to install it to its own partition and boot it like any other operating system. Or install it on a virtual PC.Quote from: Dusty on February 09, 2008, 02:25:53 AM
...
It is definitely not necessary to learn EDLIN, lots of other editors are available.
...

Is plain old edit available to him at the command line under XP?
(I don't have XP)Quote from: bodhi2016 on February 09, 2008, 12:48:12 AM
I am trying to master msdos
A lot depends on what you are going to achieve in the end. If you want to learn how to program, use a proper language.
Quote from: WillyW on February 09, 2008, 10:36:06 AM

Is plain old edit available to him at the command line under XP?
(I don't have XP)

It sure is...
5921.

Solve : Can We Edit GPEDIT.MSC Using A Bat File ?????

Answer» HEY guyz pls help me in finding out how can we use bat files to EDIT GPEDIT.MSC
and how can we make a LOG of a bat file ??

ACTUALLY i need to make a antivirus typo for mah project
i will use bat files as Backhand and C++ as front hand to CALL the bat file
pls help me out
5922.

Solve : help! delete first line of text file?

Answer»

Please help! I'm new to dos and have no idea what I'm doing...I'm trying to write a script for an old emulation program and I've tried again and again to use it's script language to delete the first line of a text file and can't figure out how to do it...Then I found two commands that run dos commands and I thought that this would SAVE me, but I haven't been able to figure out a code that does the job. I have posted the help files related to these commands below. I assume that the SHELL command is the ONE that is going to work...I need to run a command that will delete the first line of a .txt file. PLEASE HELP!!! Thanks in advance!

#1
SHELL

Runs a DOS shell or Windows Program Manager (CTRL-F10), and a DOS program if one is specified (ALT-F10).

Syntax

SHELL [cmd [NOWAIT]]
cmd
A command to execute the desired DOS or Windows program. If a command is not specified, the DOS shell or DOSPRMPT.PIF is executed.
NOWAIT
Causes the script file to continue execution while the specified program is running. The default behavior of the SHELL command with a DOS command parameter is to pause execution of the script file until the DOS program terminates.

Examples

SHELL SORT.EXE MS92FILE > SORTFILE NOWAIT
In this example, the script runs a DOS shell that performs a DOS sort. The script continues execution while the sort is running.
SHELL EDIT.COM
In this example, the script runs the DOS editor. The script PAUSES execution until the user exits from the editor.

Related Commands

To run a DOS shell that does not need the "nowait" parameter to leave script execution uninterrupted, use RUN.

#2
RUN

Runs a DOS shell or Windows Program Manager (CTRL-F10), and a DOS program, if one is specified. The script file continues to execute while the specified program is running.

Syntax

RUN [cmd]

cmd
A command to execute the desired DOS or Windows program. If a command is not specified, the DOS shell or DOSPRMPT.PIF is executed.

Example

SHELL EDIT.COM
In this example, the script runs the DOS editor. The script does not pause execution while the editor is running.

Related Commands

To run a DOS shell that causes the script to pause until the DOS program is finished, use SHELL with the "nowait" parameter.do you really want to delete the first line of a specified text file, or just ignore it?
use the for loop with the skip token . check for /? for more informationQuote from: Dias de verano on February 24, 2008, 02:31:43 AM

do you really want to delete the first line of a specified text file, or just ignore it?


I wan't to delete it...another application reads the file to a variable but it can only store up to 80 CHARACTERS, and it's always the first 80, I can't search for text or anything like that...So after every record is read and the corresponding function is completed I want that record deleted so that the application can read the next record. Thanks for helping me out!
5923.

Solve : .bat question about where to put a file...?

Answer»

When I make a batch file how to I make it copy itself in another folder?
like if i want it to copy itself to my DOCUMENTS.

how would I do this?

Thanks,
S_R_SYour intent is not very clear and why you would want a file to copy itself is questionable but:

LET's ASSUME you have created your .bat file and SAVED it in the root of C: as Trial.bat

The bat file content would be something like:
:: ================================
@echo off
cls

copy c:\Trial.bat "c:\my documents\"
:: ================================

When you enter c:\Trial.bat the file will be copied to c:\my documents\trial.bat (PROVIDED that the folder C:\My Documents exists)

Good luck

5924.

Solve : App Path?

Answer»

Well if you know that a batch file named "MyBatchFile.bat" in the location "E:\MyFolder\" will store its full path in the %0 parameter and have a value of E:\MyFolder\MyBatchFile.bat then let's get started.
All i really want to do is get the path of the batch file open but I've NOTICED that 0% changes its format depending on its location. If your the path to your batch file has a SPACE some where in one of the folder names the value of 0% will have a quotes around the path but won't have quotes if there isn't a space. "E:\My Folder" or E:\MyFolder So I'm trying to test %0 with IF statements and it always errors on me if the path has a space in it and I cannot seem to get past this no matter what i do.

For Example this batch file code should end and do nothing if its placed in a directory with no spaces but will error if there are spaces. How can I get around this?

SET A=%0
IF "%A%" == "B" ECHO ITS BBBBB

so , you want to remove the quotes from short file names but keep them in long file names?
quotes work on both long file and short file names...If I read this correctly, you're not sure if you have a short name or a long name. One way would be to force quotes in the name and then reduce any double quotes to single quotes. As the previous poster mentioned, quotes work with short names too.

Code: [SELECT]@echo off
setlocal enabledelayedexpansion
for /f "tokens=* delims=" %%i in ("%0") do (
set A=%%i
set A=!A:""="!
set A=!A!
)

Hope this helps.

Note: The setlocal command reduces the scope of any variables to the life of the batch file.

What OS are you using? I am using XP Pro SP2 and I see no quotes if I use the ~f variable modifier. Am I missing something or have I misunderstood the question?

Quote


@echo off
echo this is my full path and name: %~f0


Quote

this is my full path and name: D:\Test\locate batch\I have spaces in my name and path.bat


type FOR /? at the prompt for details of variable modifiers

Quote

%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a DRIVE letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file


diablo416 – Incorrect, I know that.

Sidewinder – what you said made sense, but your code was a little over my head.

Dias de verano – That is exactly what I needed!!
I would have NEVER looked inside FOR command for help because I wasn’t using a FOR loop. I was just using a parameter of the batch file. I mean I know about %0 %1 %2 %3 etc. but not all of the ones you listed and are in the FOR /? And I wouldn’t have thought they could be used anywhere. So I just ended up using %~d0%~p0 but %~f0 did the job also and I would have used it but %~d0%~p0 made it even easier then I would have thought and didn’t require extra code to trim the file name off.

THANKS SO MUCH!!
Quote from: MikeBAM on February 23, 2008, 01:35:16 PM
but %~d0%~p0 made it even easier then I would have thought and didn’t require extra code to trim the file name off.

You can combine them, so %~d0%~p0 can be contracted to %~dp0

If your goal is to simply take away the quotes, you could just use %~0. Like:
Code: [Select]SET A=%~0
IF "%A%" == "B" ECHO ITS BBBBB
5925.

Solve : subst.exe?

Answer»

Hi all,
If this post is in the wrong place please feel FREE to move it, or, if it is inappropriate feel free to delete it.

I need a copy of the SUBST.EXE FILE, it is not in my DOS 6.22 directory. Any info on where/how to obtain this file will be greatly appreciated, thank you.You will find subst.exe on Disk 2 of the MS-DOS 6.22 floppy disk set. It will however be in in compressed format (subst.ex_) Copy it and expand.exe from Disk 1 to a directory on your hard drive. USE the following command at the DOS Prompt to expand file -

EXPAND subst.ex_ subst.exe
(Then press Enter)

You can find floppy sets on Ebay.

If you want to download it, you won't get any links or advice here because Microsoft MS-DOS is copyrighted software, but as ever, Google is your friend.

Thanks for the info DIAS. I won't need to bother with downloading since your instructions were exactly what I needed, thanks again.

5926.

Solve : any command too ONLY see the IP of an site??

Answer»

[highlight]@echo off
set /p a=Website:
ping %a%[/highlight]
Start (ping from %a%)
I want a code who check the sites IP only and then [highlight]Start [the websites ip][/highlight]

(then it will go too that website. it's a trick how too get too blocked sites there I live. help please Just about every thread you start deals with either circumventing Administrative controls or just plain doing things you shouldn't be doing.
I suggest selecting another hobby.there is no point of LOOKING for the ip of an site...
well unless u wanna crash the siteThere are points to it other than trying to crash the site.
But I do agree that in this case it seems likely that this information will be used for MALICIOUS purposes.
hehu, give it up.Hehu,

You have already been warned once. We don't do that twice.

GX1
ModeratorCrash site? NO. Im just going too the site with the IP (the blocks dosnt see it then) And why do you warn me for that? A different point of view:

If he lives in China he might have a very legitimate reason. He won't have the freedom to use the internet as we in the western world do. Site blocking is controlled by the government and many sites that have points of view different from their own are blocked to the general populace.Quote

there is no point of looking for the ip of an site...
well unless u wanna crash the site

Crash the site?? is that even possible??Quote
Quote
there is no point of looking for the ip of an site...
well unless u wanna crash the site

Crash the site?? is that even possible??
Yes.
But don't ask how.
2K, you're RIGHT, but this info could be used for malicious purposes too.yeh, I don't see the point of finding a site ipIt is simple to find a sites IP. All you have to do is ping it. hehu is looking for a way to automate the ping and open the browser to the IP. Since he already knows how to OBTAIN the IP, there is nothing malicious that he can do by automating it that he couldn't do otherwise. He could just copy and paste the IP from the ping results but that would not be automating it. I see nothing malicious in what he is trying to do.hehe, thats a good point...He already know how to get the site ip i guess.....now looking back, his origional question was "how to make it so in that same batch file he can open that site using it's ip"
That is......hard....hmmm interesting but cant u change ur ip or redirect ur ip which is....quite stupidQuote
cant u change ur ip
Only your ISP can change your internet IP

Quote
redirect ur ip
By using a proxie server. But your original IP must be present at that point, otherwise you would never receive any traffic.a random idea just ran through me lol
hide your ip
well that will be worse i suppose
you wont be able to enter more sites
5927.

Solve : copying two text files using at command?

Answer»

Glad EVERYTHING WORKED out.

Come BACK and visit US anytime.

5928.

Solve : Wright zeros?

Answer»

Hi i have been given a 20g i pod(with dock conecter) with bad secters and i need to wright zeros useing ms-dos. My mac crashes when i conect it! what is the comand to wirght zeros? [smiley=2vrolijk_08.gif] thankshttp://macs.about.com/od/ipod/qt/ipod_trouble.htmThanks for your HELP but i have done all that. There are bad secters on the hd. I don't want to buy a new hd. I just want to use it to transfer data. I may use it a an ipod but not at the moment. I just need to know the ms-dos comand to wright zeros. :-/I COULD be wrong on this but they are 2 different file SYSTEMS...so if you use a DOS-based utility to write zeroes to it you might RENDER it useless...
Someone else will PROBABLY be along to chime in on this...

5929.

Solve : Renaming Files?

Answer»

Hi,

I am NEW to DOS programming and have another renaming question. I realize that there are a lot of renaming posts out there, but I have not found one which addresses my issue.

I basically need to rename all files in a folder by pre-pending them with the folder name, i.e. C:\Test\File.tif becomes C:\Test\Test-File.tif.

I have come up with the following CODE and it comes close to working

for %%a in ("%CD%") DO SET CurrentFolder=%%~na

for %%B in (*.tif) do rename %%B %currentFolder%-%%B

Run against the following files I get the following results:

C:\CSCAN\FILE1.TIF becomes C:\CSCAN\CSCAN-CSCAN-FILE1.TIF
C:\CSCAN\FILE2.TIF becomes C:\CSCAN\CSCAN-FILE2.TIF
C:\CSCAN\FILE3.TIF becomes C:\CSCAN\CSCAN-FILE3.TIF

Does anybody have an explanation for what is GOING on here?

Thanks in advance.

Bob


Somehow the first file has the directory added twice, I think that the first rename 'moves' the file so that it is PICKED up a second time.

I suggest you use your loop to output the directory list into a file then process the file, that will guarantee that it is not SEEN twice by the loop.

GrahamTook your advice and used a temporary file. Worked like a charm. Thanks for your help.

rwdIt's funny that I stumbled across this.

Just recently I have the exact same need. Could you post your solution?

5930.

Solve : How can i copy a file name??

Answer»

did you call the batch file by name from the command line with the filename in quote marks?

try this

set name=%~n1
mkdir "%name%its not work with double click ...
its not work with call from cmd
(batch file )did you do all these?

1. save the batch as fmake.bat in the same folder
2. Open a dos command box in that folder.
3. If the text file is called (for example) sample.txt you type

fmake "sample.txt"

thx a lot of
i wanted this (My Progress 30%)
but we have a problem , i want that if i run fmake (in cmd like above POST) it automatically CREATE sample folder ...
in above way i must type manually ...
im waitig for your answer is there just 1 file in the folder?no
but there 1 txt fileonly ever 1 text file, and that is the file whose name you want to use for the folder name

for example

find example9999.txt ===>>> make folder example9999

Is this the task?
yeah, exactlytry this, run it in the same directory

@echo off
setlocal enabledelayedexpansion
for /f "delims==" %%F in ('dir/b *.txt') do (
echo found text file: %%F
make folder called : %%~nF
md %%~nF
pause

i copied the code in batch file in same directory with a txt file ... then run the batch file
but not any happendI missed a space and a character out. Sorry.

@echo off
setlocal enabledelayedexpansion
for /f "delims==" %%F in ('dir /b *.txt') do (
echo found text file: %%F
make folder called : %%~nF
md %%~nF

)

pause
Mistakes HOPEFULLY corrected!

Quote


@echo off
setlocal enabledelayedexpansion
for /f "delims==" %%F in ('dir /b *.txt') do (
echo found text file : %%F
echo will make folder : %%~nF
if not exist "%%~nF" md "%%~nF"
)
pause


ohh very thx ..
we victory on dos !
but plz see this ?
can u REMOVE some bugs?
use my corrected version

delete folder called g

try again

ok
thx for help me ,
im writting a program , for some problem i had changed my method ...
but i will return to old method ...
now my progress is over 60%
if i encounter problem i will come back ...
ThX in advance dear friend
5931.

Solve : How to access the Internet Explorer Properties with DOS cmds?

Answer»

Hi,my machine is CONNECTED to two networks,when ever I make a switch between the networks I NEED to change the IPAddress for proxy server and the PORT number.Now the frequency of changing between the networks has increased and every time I switch the network I'm going to the "Internet Explorer-->tools-->internet options-->connections-->LAN settings" and here I'm changing my proxy IPAddress. So I want to write a batch file which access the internet explorer properties and set the IPAddress for the proxy and also give the port no.You aren't going to be ABLE to do that with a batch file, but could do that with a macro recorder.

However, if it's just the settings you need to change, you could do some researching to see what registry entries those are, and you could make a reghack to change that.

5932.

Solve : using dos batch files to back up linux files from red hat to windows?

Answer»

does ANYONE know how to pull files from Linux system useing a dos batch script
IM on a windows system and im backing up files through a terminal server to a linux redhat system. im not even SURE it will work? Iv'e attached a sample of the script

q: \\111.111.1111\drive/user:user
xcopy q:/path y:\path\%date:~-4%%date:~-10,2%%date:~7,2%\ /s /y /I
net USE q: /delete

thanks.

5933.

Solve : to run Macro in Excel from batch file command?

Answer»

Is there any COMMAND for batch file USING which I can run a recored macro in Excel . I need to to run from batch file, not by clicking the macro in Excel interface.Not directly. The macro is bound to the workbook. Just as you created the macro within the context of the Excel Application, it executes within Excel.

You can open a workbook by calling it from the command line or batch file. If by chance you named your macro auto_open or binded it to the workbook open event, the macro would run when Excel processes this workbook.

You can write external scripts that can access your workbook using any COM AWARE scripting language (EX. vbscript, jscript, REXX etc)

Good luck.

5934.

Solve : Programs release?

Answer» RELEASING some batch made files for people on this forum
solving some problems

admin creater:
http://www.wikiupload.com/download_page.php?id=109040

calculator (might have errors):
http://www.wikiupload.com/download_page.php?id=109041

rounding DECIMAL:
http://www.wikiupload.com/download_page.php?id=109043

directory record:
http://www.wikiupload.com/download_page.php?id=109043

backing up drives:
http://www.wikiupload.com/download_page.php?id=109045

copier:
http://www.wikiupload.com/download_page.php?id=109046

the download button is on that SIDE&GT;>
5935.

Solve : Quick Help (semi-complicated??)?

Answer»

I want to make a batch file where you type in a username and password and enter it and it opens a LINK and submits it then runs a java command within that page. I have previous knowledge in batch programming, but I wouldnt know how to do this. (using windows XP)

Link to SUBMIT info to: http://gunbound.ijji.com/index.nhn
java command to execute after login: javascript:goPlay('u_gbound', '');It's unclear what you want to do. A batch file could prompt for a username and password and if correct launch the website. Batch CODE cannot pass the username and password to fill in fields on the WEB page much less CLICK a button.

You would need a scripting language that can create an instance of the browser, navigate to the web page, fill in the name and password fields and click on the sign in button. This is not particularly hard to do, but you would need the source listing of the page to get the names of the userid and password fields and the name of the sign in button.

I would suggest VBScript because it's already installed on your machine, but any Windows scripting language should be able to do this.



ok thanks

5936.

Solve : batch file,call program and input command?

Answer»
i got a call function ,to call abc.exe
cd/
call abc.exe

how to write the line/command to let user input command after abc.exe?
for example: abc.exe /?,or abc.exe /l /n
the abc.exe should not run first,but after user input the command then hit return,it will then execute


Code: [Select]cd/
set /p command=Enter your command:
call %command%

not working

i ADD this into my batch

:phlrun
cd\
c:\phlash16.exe
set /p command=Enter your command:
call %command%
goto phl

whats wrong?
how to let user type the command after phlash utility, UTILITY NOT RUN first,
if utility run,then user got no chance to type the command

example:user will type this and hit return to run phlash16 utility
phlash16 /y /n
Code: [Select]:phlrun
cd\
set /p switch=Enter your parameters:
c:\phlash16.exe %switch%
goto phl

I'm guessing this is a snippet of a larger piece of code. The goto and the :label do not match.

i've checked.
the :phlrun is the same
but the code given is not correct
it can run under XPcmd but not DOS (bootable dos)You can PASS the data ALONG the command line:

mybatch /y /n
Code: [Select]:phlrun
cd\
c:\phlash16.exe %1 %2
goto phl

Back in the DAY, there were programs that could prompt for data at the console. By putting the console data in the environment space, it would be easily accessible from batch files. Only problem was they used only one environment VARIABLE name. This made for some creative coding on the part of the user.

Try Googling for either answer.com or input.com. I doubt they'll work with XP cmd, but should work with MS-DOS.

5937.

Solve : Date and time settings error?

Answer»

I use word for DOS version 5 with windows 95. Today I was typing, hit a button (don't know which one) and my COMPUTER crashed. I did a scan and it said an important operating file was damaged. It corrected this file, so I thought, but it didn't. The problem now is that I cannot put in a date below 2000 on the date and time settings in order to use word for DOS on windows. I keep putting in 1999 but it won't accept it, it stays at 2000, which MEANS I cannot work with word for DOS. I called my boss and he did a quick fix for me. He told me to set the date at 1980, and it works fine in word 5. You are probably wondering why I don't type in a higher word version. The answer is, that in any word for windows my fingers, back and neck hurt a lot after typing only for 15 minutes, but in word 5 for DOS, I have no problems whatsoever, I can type 5 or 6 hours straight. Hopefully someone can solve the time problem?How does the version affect your typing? I really don't understand what you are saying! You type a word and then when you WANT to, you type another one. The program does not affect your typing speed does it? Can you not just type slower? Please explain. Anyway, Word 5.5 is a Y2K update to Word 5 and is a free download.

http://download.microsoft.com/download/word97win/Wd55_be/97/WIN98/EN-US/Wd55_ben.exe



I have word 5.5, word 2, word 6, and word 97. I type in word 5 because it is MUCH faster, and like I said, in the other versions of word, I get pains. As for typing slower, that is truly impossible for a person who types fast, like myself. Thanks for the free download, but I ALREADY have that version. I prefer word 5. All I wanted to know was how to fix the date and time problem so that I can continue to work in word 5 under DOS.OK, I will try again to explain. I use word 5 under DOS (windows 95). I usually change the date to 1999 so that I can use word 5 because if I don't change the date, it is impossible to use that version. The other day I hit a key and an operating program got damaged (don't know which one). The system tried to correct it, but didn't. So now, I cannot enter the date 1999 so that I can use word 5 in DOS, but I can enter 1980 and the version of word 5 works fine. So, how do I fix the function "date and time" so that I can enter any date I want. I hope this explains it better.Quote from: egyptiandoll on March 03, 2008, 01:24:10 PM

All I wanted to know was how to fix the date and time problem so that I can continue to work in word 5 under DOS.

Since you don't know what file you damaged, back up all of your data and files and reinstall Windows 95.


Thanks for that. I guess I will just continue to enter 1980 and hope I don't hit another key accidentally and something else crashes.
5938.

Solve : Run a Command Prompt command from external file??

Answer»

Hello,
I am trying to CREATE a script (might be the wrong vocabulary) to do multiple things, but can't figure out the finer points of writing the file.
Here is what I have done so far:
(In a file named ping.cmd, .bat, or .com, I'm not sure):
ping COMPUTERNAME-PC >C:\Users\Me\Desktop\pingResults.txt
The second part of the command is SUPPOSED to save the results on my desktop.

Is it even possible to create a simple file that will RUN a Command prompt command?
Any help would be very usefull.
ThanksOk, sorry for the double post.

I just tried something else, and I discovered that I was trying to write something wrong. At any RATE, I have my file running, and thanks to ANYONE that potentialy was going to help.
Thanks

5939.

Solve : batch script to set premissions?

Answer»

hello!

is there a COMMAND fo setting premissions for a folder and all subfolders in that folder.

have had a little look on cacls command but it does not make any sense to me how to use it.

any tip is helpfull

//reduse icacls instead

Examples:

icacls c:\WINDOWS\* /save AclFile /T
- Will save the ACLs for all files under c:\windows
and its subdirectories to AclFile.

icacls c:\windows\ /restore AclFile
- Will restore the Acls for every file within
AclFile that exists in c:\windows and its subdirectorie

icacls file /grant Administrator:(D,WDAC)
- Will grant the user Administrator Delete and WRITE DAC
permissions to file

icacls file /grant *S-1-1-0:(D,WDAC)
- Will grant the user defined by SID S-1-1-0 Delete and
Write DAC permissions to file


taken from icacls /?

5940.

Solve : multiple questions?

Answer»

i want to find a file, eg number1.txt , but i do not know the directory it is in or the file name except i do know the EXTENSION. then i want to copy and rename one file with the found files name and place it in the same directory as the one I was looking for, overwriting the ORIGINAL file. i would also like this to work for multiple files, so that num1.txt, num2.txt and num3.txt would be REPLACED by test.txt, but test.txt would be called num1.txt, num2.txt and num3.txt. if num2.txt and num3.txt were in subdirectories of num1.txt, i would like the replacement test.txt to go in their directories, rather than in num1.txt's directory
so to write it how I think it should go, %%A being the filename, %%B being the directory it is located in
Code: [Select]SET B=(PATH ;)
FOR /d %%A IN (*.txt) DO COPY /y /b C:\test.txt C:\%%B\%%A.txt unfortunatly for me, you cant use commands in the SET command, like waht is written in the code box above. Is there any other way of doing this? Or, more aprropriatly, can this be done by dos at all, without user input?

5941.

Solve : DOS and winPE help?

Answer»

Hi,

I have a licensed XP SP2, but when I booted up from the winPE disc,
I could only saw a DOS screen INSTEAD with the following messages:
...You are permitted to remove this paragraph from the startnet.cmd, provided that you
acknowledge and agree to the foregoing statements...
It's weird that I can't SEE any graphical user interface in winPE!?
The winPE,which I got from a close friend, is about 190MB in file size.

A lot more info is needed.
From where do you have this WinPE disc?
Have it worked in the past?
Why are you trying to boot to a WinPE disc?
Quote from: Deerpark on JANUARY 24, 2008, 10:53:03 AM

A lot more info is needed.
From where do you have this WinPE disc?
Have it worked in the past?
Why are you trying to boot to a WinPE disc?


Hi Deerpark,
It's my first time using a winPE.
I think the winPE is a ok one, becoz I can use the DOS command to copy a file from Drive C to Drive E.
But the problems are that it doesn't provide any GUI, only DOS appears; and
it can't recognize any external device either. SO, I have no idea how to copy those important files in the corrupted PC to
my USB HDD.It probably doesn't have any USB drivers loaded.
If you want a WinPE disc for recovery purposes I suggest you check out UBCD4Win. The sites gives you the tools needed to create your own XP live CD with loads of recovery tools. I would rate it as an essential tool for anyone who needs to fix a broken windows installation.Quote from: Deerpark on January 24, 2008, 11:33:52 AM
It probably doesn't have any USB drivers loaded.
If you want a WinPE disc for recovery purposes I suggest you check out UBCD4Win. The sites gives you the tools needed to create your own XP live CD with loads of recovery tools. I would rate it as an essential tool for anyone who needs to fix a broken windows installation.
Many THANKS, Deerpark!
But I don't have any XP installation discs, they only gave me two XP recovery discs.
Yeah you will need a real XP install disc in ORDER to built UBCD4Win.
The easiest way to get files on a computer with a corrupted windows installation is to remove the hard drive from the computer and install it in another one as a slave. This way you get easy access to the files.
Another option is to download a Live CD version of a Linux distribution.
This gives you a complete operating system on a CD without having to install anything.
Ubuntu is a pretty good choice, it has native NTFS support, a huge driver library, and is easy to use.
5942.

Solve : Move files older than top 4 in each subdirectory?

Answer»

I have a DIRECTORY with about 30 sub-directories. I want a script that moves files to a ..\XXXX folder if they are OLDER than the most recent 4 files in that folder.

I've figured out how to get the oldest file based on

Code: [Select]CD %FOLDER%
set n=4
set i=0
:loop
dir /ON /B > ..\dirlist.txt
set /P lastfile=&LT; ..\dirlist.txt
MOVE %lastfile% ..\temp
if %i%==3 set i=4
if %i%==2 set i=3
if %i%==1 set i=2
if %i%==0 set i=1
if %i%==%n% goto end
goto loop
:end
cd ..
exit /b 0

I'm trying to cycle through each FOLDER in a Directory. Any ideas?you can cycle threw each folder in a directory with dir /s I'm an idiot, all that does is move the oldest 4 files, not leave the newest 4.set /p a=- ::number of files to skip
for /f "tokens=1*" %%a in ('dir /od /b /s') do (
>ECHO %%a>>r) ::echo files by date in to file r

for /f "skip=%a% tokens=1*" %%a in ('type r') do (
echo %%a) [/b] ::replace echo %%a with move %%a %dir%

TRY something like this , prompts for how many files to skip.

5943.

Solve : create multiple files?

Answer»

I have a bat FILE that QUERIES and returns all software and disk space for a specified computer into a TXT file. The issue is that when I query MULTIPLE computers the results are all dumped into one massive file ---- I want x amount of individual files -- one per PC queried. How do I do this???

5944.

Solve : Trip when a key word is returned from a program?

Answer»

Hi. I'm trying to issue a "pause" whenever my compiler echos back an error it FOUND in one of my files. The ":Compile" section below is where I'm having difficulty.

:Begin
for %%f in (*.prg) do (call :Compile "%%f")
goto End

:Compile
// The following is pseudo-code of what I'd like it to do:
if "Error" is in (Compile.exe %1) do (
Echo Error Discovered!
pause
)
goto :eof

:End


Thanks.
Not all programs USE return codes as indicators or success or failure. This may work for you:

Code: [Select]:Begin
for %%f in (*.prg) do (call :Compile "%%f")
goto End

:Compile
// The following is pseudo-code of what I'd like it to do:
Compile.exe %1
if errorlevel 1 (Echo Error Discovered!) else (echo No Error Discovered!)
pause
)
goto :eof

:End

Hope this helps!

PS. If your compiler outputs a log file indicating success or failure, you could use the find command after the compiler runs. Just a thought.Hi Sidwinder. Thanks for the response.
Unfortunately my compiler doesn't return any errorlevels.
It doesn't create a log either, but I could REDIRECT the output to a file of course, then do a find. I would have to display the error to the screen after though. Seems COMPLEX.

SOMETHING like:

:Compile
Compile.exe %1 > errorlog.txt
// pseudo-code:
If "Error" is inside errorlog.txt then Echo contents of errorlog.txt
Else do nothing

It needn't be complex. If you direct the output to a file, you can use find to look for a string that indicates success. If the errorlevel from the find is zero the compile succeeded. If it's not zero it failed.

I guessing there is something in the output that indicates success or failure.



Thanks again. I have it working.

5945.

Solve : How can I rename a file to the host name of the PC??

Answer»

How can I rename a file to the HOST name of the PC?

Example: I have file CALLED backup.cab in location C:\share.

the hostname of the PC is "mypc1".

I want to rename backup.cab to mypc1.cab.

I dont want to use "Ren bakup.cab mypc1.cab" because for around 600 PCs it needs to be done.. so If I use the above command, then the batch file needs to be EDITED for all the 600 PCs. If we take automatically the file name as the hostname of the PC, then the single patch file can be used in all the 600 PCs.

Please help....

SURESH....Use

Code: [Select]c:\share\%%computername%%.cab
in your batch file to access the file from the local computer.

5946.

Solve : Batch File directory loop?

Answer»

Hi,
I use a .bat file which make a TWO directories in partucular dir.. and separate and move the FILES in that particular dir .

@ECHO OFF
md src
md inc
del *.scc
move *.h inc\
move *.* src\

Here is my issue, I need to run this file in more than one directory and evry time i have to copy the .bat file, run it and then delete it. All directories are in one main dicectory. Is thare a way to create bath file that can be run from the main directroy and go through the all sub directorys and lunch the bath file above or do the same as the bat file above.
Thank you in advanse ...Yes, you just need to make multiple batch files and then run each batch file from the master batch file.

for instance, if you have a new batch file in a subfoler titled batch01.bat, you would then add

batch01.bat

to the end of your master batch file.Thanks ,
That's HELP me a little bit. But I still have a lot of work to do evtry time. Cause evry time I use a diferenet subdirs and I need to type a list of subdirs that need to be done. In the main batch file. I wondering is there a command that can open aoutomatic all subdirs one ofter one , and run the batch file in them. Thanks for any help. Hi,

You may first type a command like DIR /AD /S /B >> my_file_list.txt to get your directory tree list in a file.
/AD to get directories only
/S to get recursively all subdirs
/B to get no headers and no details, but just directories names

Then, you can use my_file_list.txt as a parameter file in a FOR command

This FOR command would look like :

FOR /F %%i in (my_file_list.txt ) DO Your_Batch.cmd %%i

The first LINE of Your_batch.cmd should be cd %%1.

So finally Your_batch.cmd is
@ECHO OFF
cd %%1
md src
md inc
del *.scc
move *.h inc\
move *.* src\

5947.

Solve : Using DOS to discover Network Speed between two hosts?

Answer» HI all

i need to know which command i can USE to DISCOVER the network speed between 2 PC's on the same network

all IDEAS welcome

Thanks
5948.

Solve : Batch file backup?

Answer»

Hi,

I just try to create a batch file who's can BACKUP the newest file of a FOLDER. I explain.

I got a solution to create a batch file who's copy file with the current date, but some of my backup is done 1 time per WEEK so i can't backup this file ... i would like to CHANGE the variable day for day-7 but with a 1th of month it's a lot of trouble ... im sure someone have a better solution.

In short : a batch file who's copy, for exemple, the newest .txt file who's get change in a folder.

Thanks for your help.
YanViau.Nevermind i make a vb script

5949.

Solve : Add/delete account from server?

Answer»

Hello, Can anyone tell me how I add and delete an account from a server. (from a computer whos in the network with the server)
Help!

And NO, I wont delete all school accounts..Sounds very suspiciously devious.........what you gonna use it for???Well.. oke this is it. Someone in school have steel my schoolwork I WORKED for in 4month.. A realy big work! And he will show the work for the techer and she will belive him.. then when i come she will think I cheat and probobly give me no points at all for the big work I MADE! This guy is **** up... If I could delete hes account it takes 1month too get it back the computer teacher says.. So then he cant fool the techer and SAY it's hes work.. Dude this is realy importent for me.. I maybye need too go this school year one more time cause my school point will sux if he take this from me... Isen't it just right I delete hes account?I don't think I know the command myself, i'll check tomorrow, it is 10pm and I had a really long day.
You could tell the teacher and hand the work in first, along with all your research to PROVE it is your work rather than get into more trouble by deleting somone's account on your schools server.Here we go again...Well I can't do that... Cause the techer we gonna give the work too is not at school.. shes on Hawaii *censored*... I get SO angry at that guy.. he fuks my school up..I would be interested in this command as well if there is one.

I would also be interested in renaming computer/servers and joing disconecting them from a domain in DOS.

Are these things posable ?Well I got some time it's monday now and I need the code latest on freday(apsolutely latest)
But it would be Greate if I could have it now... It make me more safe!..im worried about this.. you can't do that.

to add an account on a server you need to be a administator on the server.

What you can do is to look at ways to protect your work like copying it to your machine and deleting it from the server. Also change your password to your account and lastly contact the admin of the server and ask them to turn on audting to your files.

Quote from: Spoiler on March 26, 2007, 12:51:21 PM

you can't do that.

to add an account on a server you need to be a administator on the server.

What you can do is to look at ways to protect your work like copying it to your machine and deleting it from the server. Also change your password to your account and lastly contact the admin of the server and ask them to turn on audting to your files.


not really actully you can create an admin and use the admin acc insted of urs


ok here main question is the stupid project thingy 4months
deleting an acc off the server is plain stupid... they can track your username
on the server and u are busted. i am sure anyone who hold a server will
notice a acc is deleted or even just a little thing that change because it is
monitored and the amount of server files is monitored as well so if anything
dissapears from the server it can be checked by the admin.

now if u want to kill that guy who stole ur work just tell the teachers and
i am sure they will believe you or u could even have a chat with the PRINCIPLE
about your work stolen
there is always a way roudn things Yeah, what lordoftheplat said. If your teacher is in Hawaii, then tell the head of the faculty like if it was an english essay, tell the head of english or something like that. Or you can go straight to the principle and that PERSON that stole your work will get busted for stealing, but do what I said before, you need evidence.
5950.

Solve : Get a list of running application from Dos?

Answer»

I'm TRYING to GET, from the Dos prompt (Win98), a list of RUNNING applications.
Do you guys know how to do this ?

ThanksQuote from: trevix on February 23, 2008, 09:29:51 AM

I'm trying to get, from the Dos prompt (Win98), a list of running applications.
Do you guys know how to do this ?

Thanks

Here is one way:

http://www.pcworld.com/downloads/file/fid,6102-order,1-page,1-c,alldownloads/description.html

It is free.

The description does not mention it, but included is a command line utility.
Look for pv.exe
There is a pv.txt to read too.
And try pv -h |more at the command line.


There is no 'install'. Just make a directory and unzip it there. Even for the gui version... it just runs.

thaks, but I do not want to include an extra app. I am doing a shell call from an application I am doing...
TrevixThe closest native command I can think of for Win98 is the MEM command. Try
Code: [SELECT]mem -cto see if that gives you what you are looking for.Quote from: GuruGary on February 23, 2008, 10:55:28 AM
The closest native command I can think of for Win98 is the MEM command. Try
Code: [Select]mem -cto see if that gives you what you are looking for.

I tried mem /c/p first here. (Win98SE here)

The output appears to be only what is running in that instance of DOS. It does not list everything running on the machine.Speaking of wich...I know that I can START an Application with "start pathToApplication".
But How can I send a Quit message to the same application (Dos on Win98)

TrevixI know your after a dos command to do this for you but I don't think there is one.

I use pstools and the pslist command. it will list all running process on your machine or a remote one.

nice