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.

7351.

Solve : How to delay a scipt until the previous command has completed.?

Answer» HI

Is it possible to be able to pause a script I run until the previous command has completed?

I need to stop a windows service which is easy enough, but I need to wait until the service has STOPPED before the script can continue, what's the easiest way of doing this - please note this script RUNS at 01:00 and I won't be around to press a key like the "pause" command :^)

MANY thanks in advance

Simbaafter issuing the service stop command, enter a loop and only exit when you DETECT the service has stopped.

http://www.mkssoftware.com/docs/man1/service.1.asp



7352.

Solve : .bat to run at startup I STILL NEED HELP 9/16/07?

Answer»

Ok iv looked through pages 1-172 so if this has already been covered i apologize

I need to figure out if there is a way to GET a .bat file to run at startup with out editing the autoexec.bat or sysconfig.exe files in other words is there a way to put a COMMAND line in my script to do so. If not what is the closest thing i could do?Im running windows XP home

Thankyou you can either , put in in startup folder, or put it in a scheduled task to run after computer starts up using
Code: [Select]schtasks /create /?
Quote from: ghostdog74 on September 15, 2007, 07:20:58 PM

you can either , put in in startup folder, or put it in a scheduled task to run after computer starts up using
Code: [Select]schtasks /create /?
that helps greatly but is that all the code i need?Quote from: PHREKER on September 15, 2007, 07:28:00 PM
Quote from: ghostdog74 on September 15, 2007, 07:20:58 PM
you can either , put in in startup folder, or put it in a scheduled task to run after computer starts up using
Code: [Select]schtasks /create /?
that helps greatly but is that all the code i need?
No, he means that you should look at schtasks /create /?, and from there you should be able to see all the commands available; these commands will let you do what you are trying to achieve.Quote from: Dark Blade on September 15, 2007, 07:45:45 PM
Quote from: PHREKER on September 15, 2007, 07:28:00 PM
Quote from: ghostdog74 on September 15, 2007, 07:20:58 PM
you can either , put in in startup folder, or put it in a scheduled task to run after computer starts up using
Code: [Select]schtasks /create /?
that helps greatly but is that all the code i need?
No, he means that you should look at schtasks /create /?, and from there you should be able to see all the commands available; these commands will let you do what you are trying to achieve.
ok thank you very much
i tried doing tat but all i get is "not recognized as ......"What do you TYPE in?Quote from: Dark Blade on September 15, 2007, 08:26:39 PM
What do you type in?
iv tried all of the following
schtasks/?
create?
schtasks/create/?
(i feel like a retard)What's your OS?

From this site, I think that only the following platforms include SCHTASKS:
• Microsoft Windows Server 2003, Datacenter Edition (32-bit x86)
• Microsoft Windows Server 2003, Enterprise Edition (32-bit x86)
• Microsoft Windows Server 2003, Standard Edition (32-bit x86)
• Microsoft Windows Server 2003, Web Edition
• Microsoft Windows XP Professional for Itanium-based systems
• Microsoft Windows Small Business Server 2003 Standard Edition
• Microsoft Windows Small Business Server 2003 Premium Edition
Quote from: Dark Blade on September 15, 2007, 08:45:11 PM
What's your OS?
windows XP homeWell, it's a possibility that you don't have schtasks on your computer, so you can DOWNLOAD it from here. From there, just place it in system32, and then try the commands again.schtasks is not in XP home. sorry about that.Quote from: Dark Blade on September 15, 2007, 08:50:41 PM
Well, it's a possibility that you don't have schtasks on your computer, so you can download it from here. From there, just place it in system32, and then try the commands again.
ok i got it but how do i make it so that the bat file runs on start up
(whats the code) should i use the run cmd lineanother way to run script at startup is "Registry Entry"
------------------------------------------------------------------------
create new "REG_SZ" value in :
HKLM\software\Microsoft\Windows\CurrentVersion\Run

name : anything
data : path to your batchfile (ie c:\startup.bat)
------------------------------------------------------------------------
or from command line to add registry value :
REG ADD "HKLM\software\Microsoft\Windows\CurrentVersion\Run" /v Anything /t REG_SZ /d "c:\startup.bat"

Quote from: Fen_Li on September 17, 2007, 03:16:27 PM
another way to run script at startup is "Registry Entry"
------------------------------------------------------------------------
create new "REG_SZ" value in :
HKLM\software\Microsoft\Windows\CurrentVersion\Run

name : anything
data : path to your batchfile (ie c:\startup.bat)
------------------------------------------------------------------------
or from command line to add registry value :
REG ADD "HKLM\software\Microsoft\Windows\CurrentVersion\Run" /v Anything /t REG_SZ /d "c:\startup.bat"


REG ADD "HKLM\software\Microsoft\Windows\CurrentVersion\Run" /v Proxy /t REG_SZ /d "c:\Proxy.bat" ... is exactly what i typed in my DOS box. It says "ERROR: Invalid key name" but this seems to work just need to fix the script....
7353.

Solve : can get out from dos?

Answer»

it shows me this ERROR when i type any command

The following file is missing or corrupted : " here he shows the command which i type "
Type the name of the Command Interpreter (e.g. , C:\WINDOWS\COMMAND.COM )

indeed everything on the laptop is DELETED SOMEONE can help me :? More info...
What happened PRIOR to this?
What windows are you using?
What error messages are you getting?

7354.

Solve : batch file question?

Answer»

I have a batch file question.

is it possible to COUNT the number of characters in a string? I am wanting to set a minimum number of characters in a string.

thank you,
wayne brost


Quote from: wbrost on April 12, 2008, 11:07:38 PM

I have a batch file question.

is it possible to count the number of characters in a string? I am wanting to set a minimum number of characters in a string.

thank you,
wayne brost




yes. depends on whether you need a pure batch solution or not.
in vbscript
Code: [Select]Set arg = WScript.Arguments
StrString = arg(0)
WScript.Echo Len(StrString)
save the code as script.vbs and on command LINE, type
Code: [Select]C:\test>cscript /nologo script.vbs "test"
4
you can use a for loop in batch to catch the result. Although you can do everything in vbscript.

you can also use *nix tools like wc for windows

example:
Code: [Select]C:\test>echo "test"|wc -m
8
the length is shown as "8" because wc treats "\r\n" as 2 chars.

for just batch solution, you can certainly google for it on the web.
If you have write access, you can echo the string to a text file, then get the file size, subtracting 2 bytes for the CR+LF at the end

All in one line!

Code: [Select]echo %string%>%temp%\sizeme.txt&for %%F in ("%temp%\sizeme.txt") do set /a stringlen=%%~zF-2&del "%temp%\sizeme.txt"thank you both. I now have the batch file working with the advice you gave. but, now I have ran into a new problem with the batch file.

:problem
have you ever tried to add numbers that STARTED with a leading 0?

example: if you type the following you get some odd results.

set test=01234
set /a add=%test%+50
echo %add%

it works but give you an incorrect answer. Have you seen this before?


:question
is it possable (with out lots of code) to figure out if a string contains numbers or letters?

thanks,
WayneQuote from: wbrost on April 15, 2008, 02:03:18 PM
have you ever tried to add numbers that started with a leading 0?

example: if you type the following you get some odd results.

set test=01234
set /a add=%test%+50
echo %add%

it works but give you an incorrect answer. Have you seen this before?

Yes.

The set /a command reads numeric values as decimal numbers, unless prefixed by 0x for hexadecimal numbers, and 0 for octal numbers. So 0x12 is the same as 18 is the same as 022. The octal notation can be confusing: 08 and 09 are not valid numbers because 8 and 9 are not valid octal digits.

Type set /a at the prompt for details of usage.

Quote
is it possible (with out lots of code) to figure out if a string contains numbers or letters?

I corrected your spelling of "possible". I do not know what your definition of "lots of code" is. I don't think 2 lines is lots of code.

You can pipe the string to FINDSTR using the /R switch and a regex (regular expression) and check the errorlevel. When an item is not found FINDSTR will return an errorlevel >0

Code: [Select]Echo 12G6 | FindStr /R "[0-9]"
If %ERRORLEVEL% EQU 0 echo The string contains one or more numeric characters

Echo 12G6 | FindStr /R "[^0-9]"
If %ERRORLEVEL% EQU 0 echo The string contains one or more non numeric characters







its easier in vbscript
Code: [Select]s="123"
If IsNumeric(s) Then
WScript.Echo "Numeric"
End If
7355.

Solve : Creating a Batch file to remove files in a folder?

Answer» QUOTE from: Quintin on April 10, 2008, 03:13:52 PM
I would like to create a batch file that executes on the first of the MONTH to remove files in a folder older than 30 days. These files are log files.

Thanks,

Quintin
here's a vbscript
Code: [Select]Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\temp")
For Each efile in objFolder.Files
'Wscript.Echo "file is " & efile
'WScript.Echo eFile.DateLastModified
If DateDiff("d",eFile.DateLastModified,Now) >= 30 Then
WScript.Echo "file FOUND that is 1 month old: " & efile
WScript.Echo eFile.DateLastModified
objFSO.DeleteFile(eFile)
End If
Next

save it as script.vbs and on command line
Code: [Select]c:\test> cscript /nologo script.vbs
Deleting files more than 30 days old means that on the 1st of every month following a 31-day month, (the majority of months) the files from the 1st of the previous month vanish too. If the objective is merely to save space, this may not matter, but if ***all*** of the previous month's files ***must*** be kept, then this might be a problem.

The VB script worked perfectly. I have it scheduled to run nightly. The only problem will be with the password. Whenever I CHANGE my network credentials I'll have to go to the server and reset the password.

Thank you very much for your script.

Quintin
7356.

Solve : Advanced Batch File?

Answer»

anyone knows how to launch a window like this ('see the pic') by a batch file or vbs ??
and STORE the output to variable ??..




any HELPS would be appreciated..


Edit : Picture have been Uploadedyou can USE sendkeys with vbscript, if i get you correctthanx for reply, but I mean how to launch that window by script ?
and then if I choose 1 folder location (ex : c:\selected_folder), then I click "OK"
the cmd will echoing that path :

ilustration like this :
C:>call launchwindow.bat or cscript "launchwindow.vbs"
....
....wait from USER input
....(ex : i choose "c:\selected_folder" then "OK")
....
C:>you have select "c:\selected_folder"

7357.

Solve : Can I capture and/or view a malicious batch file in action??

Answer»

I posted this in the windows forum, but now I'm thinking it should have been in here....

I have a piece of malicious software on my computer... each time it runs I suspect it's running a batch file to do malicious things. Is there any way to have my system monitor what the batch file does? Or to capture it? I've looked everywhere for a tool that would facilitate this and have come up empty.

It's running on Windows XPwhat do you mean you THINK?? do you see a CMD screen pop up and then CLOSE fast? if you do (or you don't) open task manager and watch to see if a little command prompt screen comes up when you run the program. also, what is this malcious program? you MIGHT of been googleing the wrong thing. instead of google-ing something to monitor your computer, google the program and its rating and comments. if might just give you your solution.A) I say I SUSPECT it's running a batch file because in the memory strings for this malware (it starts as an executable) it lists a batch file. That said, I never see a command prompt pop up.

B) I didn't accidentally get this malware. You might say it's part of my job to find out how these little buggers work.

C) I've watched the processes and never see cmd.exe come up. Does that automatically mean that the batch file didn't run? Forgive me for being ignorant about batch files....

Even with this specific piece of malware aside, I'd still like an answer to the question at hand. In the past my technique for CAPTURING a batch file has been much more "basic". To make a long story short, in the past I've found the temp file it pops up in and copied it quickly before it deletes. But my assumption is that it's sometimes more difficult than that.

So... in summary.... I just need to know if there is a way, or a program, to monitor or capture batch files that are automatically (in this case maliciously) executed.no.just because you didn't see a batch file come up in the Task Manager doesn't mean it didn't happen. but i don't see why anyone would go to all that trouble to make a batch file run invisibly, unless they were using it to place a trojan (even still, why would they use a batch file for that?
o and yes it is possible, even using anti-virus will work. in some anti virus settings you can have them catch batch files and other types of files ex. .exe .com ( i use AVG anti-spyware and it can search for them)
and im just curious, but what is this for, a job, school?
It's part of my job.

The problem with anti-virus is that it stops the whole works. If I'm going to test malware and see what it does, I can't have anti-virus running.

Right now I have a cache of tools that I use to analyze these things. By analyze I mean observe, not stop.

So, I need a tool to observe and capture batch files in action.... I'm sure it's possible.its like soap said, the batch file if used with a .vbs file to make it run invisible in Windows XP it will pop up for a second before it becomes invisible, but in windows vista it wont.. one way to tell though is there will be a new instance of rundll32.exe in task manager after it does, but if its an executable file running a batch file its likely a coverted batch file.. bat-exe converters just add a header to the top of a batch file that can interprate the commands. To see whats in the suspected converted batch file, wait till you think its running.. open your %temp% folder, (it will be easyer if you clear it before it runs) and look for an out of the ordinary .tmp file or any file , open them up in notepad.. the one you are looking for will contain a header and then underneith of it the original batch file, oh and if they did use a converter and its really a batch file, it wont use rundll32.exe or a script to make it invisible so you probably wont be able to tell that way, hope this helps.
Well... I APPRECIATE the advice. Unfortunately this is the method I've been using. I was hoping for something a little more automated. Surely someone makes a tool that can monitor just for command line activity or batch files... maybe I'm naive though.

7358.

Solve : Batch Issue - Opening files by date in filename?

Answer»

First off, this is the first batch file I've ever made, so use dummy-speak around me

I'm trying to write a batch file for work, and I need it to open an excel file.

However, the exact file that needs to be opened varies, according to what day it is.

For EXAMPLE -

On January 1, 2008 I would want it to open up file 01012008.xls
On March 23, 2005, I would want it to open up file 03232005.xls
(Not the actual file names, but the same basic idea.)

I don't want to do anything with the file, I just want the batch to open it.

I'm not quite sure how to make the batch file automatically update to open up the PROPER file for the date it's being USED, or even if it's possible in a batch file.

If it helps, I'm also opening up Excel first, and then opening up the particular file, since I need separate windows for each, and the Excel PROGRAM at work tends to open up new books in the same program.

I'm not sure if this is enough information, I can give more if needed.
Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("WScript.Shell")
y=Year(Now)
d=Day(Now)
m=Month(Now)
If Len(m) <= 1 Then
m = "0" & m
End If
strFile = m & d & y & ".xls"
If objFS.FileExists(strFile) Then
Return = WshShell.Run("excel " & strFile, 1, true)
End If
save as script.vbs and on command line
C:\test> cscript /nologo script.vbs

7359.

Solve : MOVE Command Syntax Errors - Very Frustrating, Help!!?

Answer»

Hello Everyone,

My apologies upfront for what is probably a ridiculously simple question, but I am not at all understanding why i'm getting syntax errors when I attempt to move files via the MOVE command. I'm following every single example that i've seen ONLINE and in books - still no luck. If i'm not mistaken, the syntax for MOVE should be:

C:\&GT;MOVE file.txt C:\File Folder

Correct?

What i'm trying to do is move some individual MP3 files from a folder named MISCELLANEOUS to folders named with their respective band names - both the files and folders are on my D: drive. So according to various examples i've seen online, in this case the syntax should be:

D:\>Music\Miscellaneous>MOVE SongTitle.mp3 D:\BandFolder


However, the above returns a syntax error. I then did the following:

D:\>Music\Miscellaneous>MOVE SongTitle.mp3 D:\Music\BandFolder


This returns the same error which is irritatingly frustrating. Believe it or not, I transfer mp3 files often enough that using the MOVE command would be tremendously helpful - I just need it to work correctly!!!

Can someone just give me the answer so that I can learn and know?

Thanks!!!


Quote from: Avenue on September 16, 2007, 06:03:34 AM

If i'm not mistaken, the syntax for MOVE should be:

C:\>MOVE file.txt C:\File Folder

Correct?

Partly correct. File and/or folder names with SPACES in them need to be enclosed in quotes "like this".

Quote
However, the above returns a syntax error.

Which you do not describe. So helpful! Try the quotes.


Quote from: contrex on September 16, 2007, 06:43:50 AM

Quote from: contrex
Which you do not describe. So helpful! Try the quotes.

I know better than to not include the error messages - my mistake. However, I do not think I deserved your sarcasm - especially since SYNTAX ERROR generally means that a computer statement is not written correctly. On the command line you do not get volumes of error-handling explanations, afterall.

Verbatim from the CMD: "The Syntax Of The Command Is Incorrect".

I mean really here, what else CAN you get from a CMD syntax error?

The quotes worked.
Quote
I do not think I deserved your sarcasm

SUCK it up.

Quote
I mean really here, what else CAN you get from a CMD syntax error?

Lots, and some of it potentially informative and diagnostic.



I just found this site and forum this evening and from what I can tell it's oriented to computer NEWBIES as well as seasoned folk. Although I certainly did know better than to not include the error message, a lot of very inexperienced computer folk who might post on this forum for help will not know.

Thanks for the assistance, I learned. As well as being helpful on here, we can also at times be cranky and humorous... don't be discouraged...

Quote from: contrex on September 16, 2007, 07:48:30 AM
Quote
I do not think I deserved your sarcasm

Suck it up.

Ah yes, I see that you changed your original reply. Well, you are the one who needs to "suck it up" - if you are going to get cranky over newbies asking questions then why do you answer questions on this forum?

And no - command line just doensn't have many error-handling options when there is a syntax error - a seasoned computer pro such as yourself should have known this. Instead, you decided to cry and go PMS.

People are going to post on here with questions and not supply all info (AGAIN - because they may not know). If you are going to reply and provide help here, then take your own adive and suck it up.
7360.

Solve : bios beeps?

Answer»

i have just built a pc (belive it or not lol) booted up fine LASTNIGHT but today my son decided to help (o joy), now i'm getting a Base 64K RAM failure, can i solve this, the pc is for the WIFE More info would be nice.
System specs.
What did your son do?

A Base 64K RAM failure indicates a PROBLEM with the first RAM block. If you got more than one in the machine, try removing the first one. If you only got one, try swapping it with one from another machine.sorry without booting it up i don't know thespec, it was GIVEN to me, all i know is it's a asrock motherboard, i have 1 stick of 512 ddr, i am very new @ building this is only my 3 build.
chrisThank you for your help pc booting now
Chris

7361.

Solve : How do I get the most recent file?

Answer»

How do i code a batch script to GET the most recent file from a folder. Also, I want to move this file to another location?

THANKS for the help.If you do a dir list, you can order it in reverse date order (newest at the top) - thus
DIR /O-D > filelist.txt

This command puts the first line of a file (the newest filename) into the environment variable

SET /P NewestFile=
Now you can do whatever you need with the filename

GrahamThanks for the reply.

didn't seem to work for me...


The contents in the filelist.txt are


Volume in drive C has no label.
Volume Serial Number is 18C1-0B4A

Directory of c:\Copy1

03/25/2008 01:00 PM 0 3.dat
03/25/2008 10:08 AM 4 2.dat
2 File(s) 4 bytes
0 Dir(s) 52,907,216,896 bytes free


It is sorted by the date, but when I try to get the first file using "SET /P RecentFile=I fixed it..

I added the dir search with /b /s (dir /b /s /O-D *.dat >filelist.txt).

Thanks for the help again..Sorry, forgot the /B

well spotted !!
GrahamCan you give the detailed code.Here is the tweaked version that ignores directory entries (and puts the temporary file in the TEMP directory)

Code: [Select]DIR /B /O-D /A-D>%TEMP%\filelist.txt
SET /P NewestFile=<%TEMP%\filelist.txt
ECHO %NewestFile%
DEL %TEMP%\filelist.txt
GrahamQuote from: cbvidya on March 25, 2008, 10:31:52 AM

How do i code a batch script to get the most recent file from a folder. Also, I want to move this file to another location?

Thanks for the help.

Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = "c:\test"
Set objFolder = objFS.GetFolder(strFolder)
strLatestFile = 0
For Each F In objFolder.Files
d = F.DateLastModified
diff= DateDiff("d",Now,d)
If diff >= temp Then
strLatestFile = F.Name
End If
Next
WScript.Echo "Latest file is : " & strLatestFile
' move file
objFS.MoveFile strLatestFile, "C:\temp\" & strLatestFile
save as script.vbs and on command line
c:\test> cscript /nologo script.vbs
7362.

Solve : Continuous looop?

Answer» FRIENDS how to RUN a piece f CODE continuously in loop in batch filewhy?
@ECHO OFF
:START
DIR
GOTO START
7363.

Solve : Select latest three files and delete rest of them.?

Answer» QUOTE from: ankush on APRIL 18, 2008, 03:37:03 PM
what are those CHAGES?
THANK you.

before (wrong)

for /F "delims=" %%D in ("%temp%\delfolders.txt") do (

after (corrected)

for /f "delims=" %%D in (%temp%\delfolders.txt) do (
7364.

Solve : Yes/No Command??

Answer»

Im sorry im a noob here and i didn't look at the date i know... Next time i will look at the date ok.Quote from: PHREKER on September 15, 2007, 07:07:58 PM

Im sorry im a noob here and i didn't look at the date i know... Next time i will look at the date ok.
How did you find this in the FIRST place??Quote from: Dark BLADE on September 15, 2007, 07:46:29 PM
Quote from: PHREKER on September 15, 2007, 07:07:58 PM
Im sorry im a noob here and i didn't look at the date i know... Next time i will look at the date ok.
How did you find this in the first place??
find what?Quote from: PHREKER on September 15, 2007, 07:53:48 PM
Quote from: Dark Blade on September 15, 2007, 07:46:29 PM
Quote from: PHREKER on September 15, 2007, 07:07:58 PM
Im sorry im a noob here and i didn't look at the date i know... Next time i will look at the date ok.
How did you find this in the first place??
find what?
This thread.Quote from: Dark Blade on September 15, 2007, 08:13:57 PM
Quote from: PHREKER on September 15, 2007, 07:53:48 PM
Quote from: Dark Blade on September 15, 2007, 07:46:29 PM
Quote from: PHREKER on September 15, 2007, 07:07:58 PM
Im sorry im a noob here and i didn't look at the date i know... Next time i will look at the date ok.
How did you find this in the first place??
find what?
This thread.
i atualy did my homework before ASKING tha same QUESTION
7365.

Solve : systems repair?

Answer»

i just wanna FIND out if there is such a WAY at all cos at times windows can be a pain in the neck...LOL!It greatly depends on what version of Windows and DOS you're working with.

7366.

Solve : Show all files?

Answer»

How do you GET it to show All Files I KNOW you have to do DIR A\S or somting like that?Try DIR /? and look at all the options for the DIR command.
dir c: /a /p displays all files and directories in C: root a page at a time.

Including set dircmd=/a /p in AUTOEXEC.BAT will make all files and page-at-a-time defaults with DIR.my friend try to TYPE in command line (tree)QUOTE from: jgar on September 15, 2007, 01:59:09 PM

my friend try to type in command line (tree)
First posted on: AUGUST 04, 2004, 10:12:55 AM.........
7367.

Solve : BIG SMILE Please LK Question about file name change in DOS?

Answer»

I have had this problem with a Compaq ARMADA With windows 95. I got BAD advice on another forum that actually pretains to windows 98. Now I have this brick because I tried the original INSTALLATION CD but it is schratched. I tried finding this file before but could not remeber which file or where it was located. But after much time looking I have found it.;

I found it!!!!!

C:\>Windows\System\Iosuwrong <<<<<<< WRONG !!!!

Should be C:\>Windows\System\Iosubsys


How can we change this file name? That is all I have to do and then it will work again!?

I will be staying up for any advice. Thanks to everyone that has helped with this so far.

Okay I found on this site the rename function avalible in MS-DOS windows 95

But I want to make sure I wll not lose my files in the FOLDER to be renamed and I want to make sure the "code looks good"


RENAME [drive:][path][directoryname1 | filename1] [directoryname2 | filename2]


Rendame [c][system][Iosuwron~1] [Iosubsys]You could just copy the file -

CD /D C:\Windows\System
Copy Iosuwrong Iosubsys

are you sure the file doesnt have an extension ??
GrahamSuccess I changed to the directory that the file was located in and used the ren funtion (I found instructions on this site).

This was all good but Win95 wouldn't run any of the adapters I had to connect to the internet. So I took an old copy of windows 98 and tried to install it from windows 95 it worked for a while but my windows 98 cd is scratched and I can only get the COMPUTER to boot in safe mode now. Back to square one

7368.

Solve : how to login to other pc in my network using dos command??

Answer»

can somebody GIVE me a KNOWLEDGE, using dos command how can i LOGIN to other COMPUTER on my own home NETWORK?
thanxs:

7369.

Solve : Boot Disk/CD not working?

Answer»

A friend of mine seems to have a corrupted Windows XP - "Boot record not found".
Before she proceed with a reinstallation or recovery, she would like to check whether there is anything important on C: drive that she would like to backup.
While she is not competent enough to take out the harddisk and do the backup at ANOTHER computer, I tried to make her a boot disk so that she can do it under DOS.
So I created a boot disk from my XP running PC. But when I test it on my own PC, I get the error "Invalid drive specification" as I tried to go from A: to C: or D:.
So I created a bootable CD using Nero instead. This time, I got "Invalid directory specified" as I tried to do the same.

Any idea?

Thanks. Quote

A friend of mine seems to have a corrupted Windows XP ..... I tried to make her a boot disk so that she can do it under DOS.

Your friend and you are probably using the NTFS file system which cannot be accessed in DOS.

Try downloading the UBCD (Ultimate Boot CD) and USE one of its many utilities. But be careful which utility is selected, it's a powerful tool. Or there's NTFS4DOS.

Good luckHi DUSTY, thanks for the information. That is a great software that I've never knew
However, my friend seems to have a dying harddisk, because her MASTER harddisk is not shown in the explorer in UBCD.
So she has GIVEN up and will bring her harddisk to shop for backup.

Thanks.
7370.

Solve : How do you change Static IP for Windows XP Pro from Command Shell???

Answer»

Hello,

I am trying to find a way to change my servers static ip from the command shell of windows xp... Its easy in the gui to do this, but the command will be added to a batch routine, so it has to happen from the command shell.

This is probably simple, but I FORGOT the tool and command switches etc.

Thanksyou can TRY this vbscript
Code: [Select]strIPAddress = Array("10.0.1.101")
strSubnetMask = Array("255.0.0.0")
strGateway = Array("10.0.1.1")
strGatewayMetric = Array(1)
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set adapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each ADAPTER in adapters
errIP = adapter.EnableStatic(strIPAddress, strSubnetMask)
errGateways = adapter.SetGateways(strGateway, strGatewaymetric)
If errIP = 0 Then
WScript.Echo "Success! The IP address has been changed."
Else
WScript.Echo "Error! The IP address could not be changed."
End If
Next
or you can USE the netsh tool, eg
Code: [Select]netsh interface ip set address "Local Area CONNECTION" static 192.168.0.50 255.255.255.0

7371.

Solve : Is DOS scripting same as batch file scripting?

Answer»

Dear all,
please let me know whether DOS scripting same as Batch file Scripting? Please reply SOON, and if possible with some useful links.
take care
bye
Well I may be wrong but DOS is the command prompt. Batch files are scripts that the command prompt can run.DOS is an operating system.
The cmd in 2000/XP/Vista is a command line interpreter also known as a shell. Besides from similarities in looks and syntax it has nothing to do with DOS.

batch processing is a generic term for an automated series of JOBS or program executions that can run without human intervention. This is usually accomplished by scripting.
DOS supports scripting, so YES, DOS scripting and batch scripting (the correct term would actually be a batch job) is in that sense two different terms for the same THING.

7372.

Solve : Is there a way to delete an empty folder??

Answer»

I'm creating a batch file to copy over files. It works well, except when it deletes the old files it leaves empty folders, from copying over empty files. This causes the hard drive to fill up and is not what I WANT to happen.

Is there a command in DOS that will delete the empty folders so this doesn't keep happening?

Realized I needed to clarify. I am copying a shared drive folder from 1 server to another. Both folders are shared and have security settings. I already know about the RMDIR command, but don't want to do that because I will lose all the setting for sharing the folder.

So was wondering if there is a way to delete empty folders with out getting rid of my share/security settings.

ThanksSorry Laxalife, Im confused

You want to delete folders, but not delete them because they would lose their shared settings.


Can you explain what it is that you want to remove ?

Grahamyes you can delete empty folders, you need to open windows expplorer, show all files in folders and then delete the folder then change it back to the old settings.Hey Graham ,

I have a backup folder that is shared, and people can access the folder through IP and logging in. Backup in case main server ever goes down, the content on the backup is up to date and usable.

I need to update the data in the backup folder, but I don't want to RMDIR D:\folder name because I want to keep the sharing and security settings. SO I need to remove the folders and files inside. looks like this:

Backup folder(has sharing and security permissions)
Folder A
Content in A
Folder B
Content in B
Folder C

I need to delete folder A, B, and C, so when I copy over, it doesn't leave any "non-up to date data". I know DOS can remove files...but what about the empty folders that the delete command creates.

In other words, I run the DEL command and I'll be left with Folders A, B, and C with no files/content inside of the folder. I want to know is there any DOS command prompt to delete these empty left over folders?

Hope that helps explain it better.





and b1tch, I'm in the DOS forums. I know how to do it in Windows, I want to do it with a batch file using DOS script.Right, thats a lot clearer(and what I thought it might be)

you can RD or RMDIR the Folder A / B / C

RD "Folder A"

In fact, INSTEAD of deleting the files, do this to remove the lot ! (assumes Backup folder is the current one)

RD /S /Q "Folder A"
RD /S /Q "Folder B"
RD /S /Q "Folder C"
Del /Q *.*

You could of course make it even shorter and more flexible

FOR /D %a in (*.*) DO RD /S /Q "%a"
DEL /Q *.*

which gets rid of everything apart from the shared directory

note .... if you put the above 2 lines into a batch file, you will need to replace both occurrences of % with %%

Good luck
Graham

I figured the 1st way was what I would have to do...which sucks. But I see your 2 line code and I'll use that

Just not 100% sure I understand correctly. I'm not a wiz a DOS, so u think you could explain the 2 line code. Not sure what %a means and how that would limit it to running the command RMDIR for the all the subfolders. Also, how do I define it for the specific folder?

Thanks ALOT Graham. Thats twice you've helped me How do empty folders "fill up" a drive?
when he clarified what he wanted he said he just didn't want to leave all these empty folders in there (im assuming he updates this folder a lot)yes, once i get the batch up and running. It will run everyday. So I would have alot of useless folders in there.Laxalife

You definitely need to know the HELP command
HELP FOR

would tell you that FOR is a looping command, the /D parameter means to only look at directories (without /D, it would look at all files).

Essentially, the %a is a variable that in each iteration of the loop, holds the name of a directory (thats what the *.* means in the brackets, you could limit the search to just Folder* to find any directory whose name starts with Folder.

The DO keyword tells the loop that what follows is a command line to be executed for every iteration, referencing %a means that the directory name can be supplied as a parameter, so each time it would execute the command:
RD /S /Q "%a"

In a batch file, the % symbol is special and you have to 'escape' it by prefixing it with another % symbol.


So assuming your backup folder lives off the root of the C: drive, your batch file would look something like this

Code: [SELECT]@Echo Off
CD /D "C:\Backup folder"
FOR /D %%a in (*.*) DO RD /S /Q "%%a"
DEL /Q *.*
Because the last line deletes all of the files in the backup folder, you wouldnt want the batch file to sit there, so you store it somewhere safe (and out of the way of inquisitive users) and execute it when you need it.

The 2nd line makes sure the backup folder is the current one, so that no accidental unwanted deletions occur (you need to make sure that this drive and path is the correct one for you. The path is in quotes as the folder name contains spaces.

And thats it

Graham
Graham,

Once again, thank you very much for your help.Quote from: Dias de verano on April 16, 2008, 12:56:23 PM

How do empty folders "fill up" a drive?

A folder is allocated to one cluster even when there is no data in the folder. A lot of empty folders adds up to a lot of clusters wasted. This is true in FAT & FAT32 for sure.

I'm not sure how NTFS handles empty folders, but even the empty names would certainly be a nuisance.
Yes I was thinking of NTFS I guess. I had forgotten about FAT32
7373.

Solve : Launching/Stopping services with a batch file.?

Answer»

Hello all. On my pc, I am running Apache/PHP/Mysql. I have made two bat files.One to start the Apache/Mysql services and launch their associated tray icons(used for monitoring and other options), and another one to stop these services and terminate the tray icon interfaces.

I was wondering if it is possible to merge those two bats in one, so that when I launch it,it will start up all needed services etc, and when I launch it again,stop them.
My code is included below:

start.bat
_______

@START C:\AppServ\Apache2.2\bin\ApacheMonitor.exe
@START C:\AppServ\MySQL\MYSQLT~1.0\MYSQLS~1.EXE
@START C:\AppServ\Apache2.2\bin\httpd.exe -k start -n Apache2.2
@net start MySQL

stop.bat
_______

@START C:\AppServ\Apache2.2\bin\httpd.exe -k stop -n Apache2.2
@net stop MySQL
@taskkill /f /im ApacheMonitor.exe
@taskkill /f /im MySQLSystemTrayMonitor.exe

Best Regards,
George

virox
There are (at least) 2 ways of approaching this ..

Create a file called (for example) ApacheStarted.txt and use it as a flag

When you RUN your batch, test for the presence of this file ... if found, you know the service is running, so delete the file and run the stop service code.

If it wasnt found, the servide isnt running, so run the start service code and create the file so you know next time that its already running.



The other method that comes to mind is to use TaskList, which spews out a list of the tasks currently running; capture this and see if your Apache task is in it (you could use findstr) - if it is, you know you need to stop it (and vice versa)

Grahamwhy not try something like this (if you find a bug please tell me)?:

@echo off
:MENU
echo.
echo 1. Start service
echo 2. Stop service
echo 3. Exit
echo.
set /p num= Please enter a number...
if %num% GEQ 4 cls & goto MENU
if %num% EQU 0 cls & goto MENU
if %num% EQU 1 cls & goto START
if %num% EQU 2 cls & goto STOP
if %num% EQU 3 cls & exit

:START
@START C:\AppServ\Apache2.2\bin\ApacheMonitor.exe
@START C:\AppServ\MySQL\MYSQLT~1.0\MYSQLS~1.EXE
@START C:\AppServ\Apache2.2\bin\httpd.exe -k start -n Apache2.2
@net start MySQL

:STOP
@START C:\AppServ\Apache2.2\bin\httpd.exe -k stop -n Apache2.2
@net stop MySQL
@taskkill /f /im ApacheMonitor.exe
@taskkill /f /im MySQLSystemTrayMonitor.exe

Thanks for your suggestions:)

@SOAP
When I select "1" to start the service,it starts up everything properly,and after a few seconds terminates everything as well. Any idea why that happens?
Thanks for the suggestion however:D It could be useful to me for some other situation.

@gpl
This is what I ended up with. Works quite nicely

IF EXIST C:\apachestarted.txt (
@START C:\AppServ\Apache2.2\bin\httpd.exe -k stop -n Apache2.2
@net stop MySQL
@taskkill /f /im ApacheMonitor.exe
@taskkill /f /im MySQLSystemTrayMonitor.exe
DEL C:\apachestarted.txt
) ELSE (
@START C:\AppServ\Apache2.2\bin\ApacheMonitor.exe
@START C:\AppServ\MySQL\MYSQLT~1.0\MYSQLS~1.EXE
@START C:\AppServ\Apache2.2\bin\httpd.exe -k start -n Apache2.2
@net start MySQL
type C:\apachestarted.txt REM > C:\apachestarted.txt
)
>NULL

Is there any way to make it so,that the file will only be created if all services are started properly,and delete only if all services are terminated? I know it's overkill, it would be interesting to know though

Again, thanks for your suggestions.
Best Regards,
George
oh! oops! i forgot to add exit at the end of both of them, so when it started, it finished and then kept going into the commands to stop the server, here is the RIGHT code:

@echo off
:MENU
echo.
echo 1. Start service
echo 2. Stop service
echo 3. Exit
echo.
set /p num= Please enter a number...
if %num% GEQ 4 cls & goto MENU
if %num% EQU 0 cls & goto MENU
if %num% EQU 1 cls & goto START
if %num% EQU 2 cls & goto STOP
if %num% EQU 3 cls & exit

:START
@START C:\AppServ\Apache2.2\bin\ApacheMonitor.exe
@START C:\AppServ\MySQL\MYSQLT~1.0\MYSQLS~1.EXE
@START C:\AppServ\Apache2.2\bin\httpd.exe -k start -n Apache2.2
@net start MySQL
exit

:STOP
@START C:\AppServ\Apache2.2\bin\httpd.exe -k stop -n Apache2.2
@net stop MySQL
@taskkill /f /im ApacheMonitor.exe
@taskkill /f /im MySQLSystemTrayMonitor.exe
exitGeorge

Hmm - not impossible; I mentioned in my earlier post using TaskList to show what is running, so in your section that starts up the services, you could check that each of them are running; if any arent, display an error and jump back to the stop service section to close the others down

Grahamhmmm.... i'm thinking out loud but would errorlevel work in this situation?George,

I didn't take the time to adapt the following code to your application, but here is a batchfile that tests to see if notepad is running and then acts accordingly. (It is a working example of what gpl suggested.)

The key lines are the following, but you should try the test file to see how it works, so you can understand how to adapt it to your use.

Code: [Select]tasklist | findstr notepad.exe && goto Close_N_Pad
tasklist | findstr notepad.exe || goto Start_N_Pad

If notepad is running, the first statement is true, so the goto is executed. If notepad is not running, the statement is false, so the goto is not executed.
If notepad is not running, the second statement is true.
The lines prefaced by :: are remarks, explaining what will occur in that section.

Copy/Paste the code into a text file and rename it to: Test_N_Pad.bat
Then run the file with and without notepad running to see what it does.

Code: [Select]@echo off

: Test_N_Pad
:: Check the tasklist to see if "Notepad.exe" is running
:: Goto Close_N_Pad if "Notepad.exe" is running.
tasklist | findstr notepad.exe && goto Close_N_Pad
cls

:: Goto Start_N_Pad if N_Pad is not running.
tasklist | findstr notepad.exe || goto Start_N_Pad
cls

:Close_N_Pad
:: This is an Error message that tells you to close "Notepad" and then loops
:: back to the starting POINT, forcing you to close "Notepad" before continuing.
cls
echo.&echo.&echo.&echo.&echo.
echo It appears that "Notepad" is still running!
echo.&echo.
echo Please save your work and close "Notepad" before continuing.
echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
echo Press [Enter] to continue,
echo.&echo.&echo.&echo.
pause >nul
cls
goto Test_N_Pad

:Start_N_Pad
:: Message CONFIRMS that "Notepad.exe is not running, then starts "Notepad.exe"
cls
echo.&echo.&echo.&echo.&echo.
echo Made it to Start_N_Pad.
echo.&echo.
echo "Notepad" is NOT currently running.
echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.&echo.
echo Press [Enter] to continue,
echo.&echo.&echo.&echo.
pause >nul
cls
start "" "notepad.exe"

:End
exit

There is no need to create a text file to test for. Simply test for one of the 4 processes using tasklist | findstr. Then goto the appropriate LABEL and start or end all 4 processes.

Or you could get really fancy and test for all four processes one at a time and start or stop the processes individually. (Ideally that would be the best way, but the other way should work as well.)

The goto label command in either of the tasklist lines can be replaced with any other command like you taskkill line if you want.

7374.

Solve : another type of batch file ...?

Answer» HELO its my again , i ask for help making this file
Code: [Select]@echo off

COLOR 0A


>"C:\Windows\system32\drivers\etc\hosts" echo 127.0.0.1
>>"C:\Windows\system32\drivers\etc\hosts" echo 89.149.200.219 l2authd.lineage2.com
>>"C:\Windows\system32\drivers\etc\hosts" echo 89.149.200.219 l2testauthd.lineage2.com
echo Configuration to your hosts are changed successful.
echo.
pause
, now i need help with making similiar to this...
is there anyway that .bat file automaticly find file CALLED "realmlist.*censored*" in whole computer , and than insert new lines in it?Code: [Select]@echo off

COLOR 0A

for /f "delims=" %%i in ('dir "C:\realmlist.*censored*" /b /s') do (
SET file="%%~FI"
)
>"%file%" echo 127.0.0.1
>>"%file%" echo 89.149.200.219 l2authd.lineage2.com
>>"%file%" echo 89.149.200.219 l2testauthd.lineage2.com
echo Configuration to your hosts are changed successful.
echo.
pause

Hopefully, that should work.sorry i think i didnt put this the right way... forget about all that. what i need is command that will find file called "realmlist.*censored*" in whole computer, and than in it insert linesdid you mean empty line ??
----------------------------------
echo. >realmlist.*censored*no.. i mean this line Code: [Select]set realmlist burningwow.servegame.com
but the thing is that,bat file automaticle find that file in computer, and than insert this line and delete all others...TRY this :
FOR /R C:\ %%a in (realmlist.*censored*) do (
echo.set realmlist burningwow.servegame.com>"%%~fa"
)

this code will insert "set realmlist burningwow.servegame.com" to all realmlist.*censored* on drive c:\ nice, thanks a lot , and i wonder is there option to insert in whole computer?
7375.

Solve : Batch file debugging?

Answer»

Here is a batch file that we wanted to run to copy files to our server. However, only the intial files from the directory got copies and no susequent files. .log files are created daily. We set the batch file to run in WinXp scheduler to run every 10 minutes. CAn someone help us with this?

@echo off
if =="" goto error1
if "r:\test\"=="" goto error2
xcopy "c:\program files\test\*.log" "r:\test\" /y/s/e/h
goto endofprogram
:error1
echo you must provide source
echo Syntax:
echo % source destination
goto endofprogram
:error2
echo You must provide destination
echo Syntax:
echo %0 source destination
goto endofprogram
:endofprogram

Thanks

RicharddHey,

Having looked at your batch file it seems a little complex for just copying files.....

If you know the source and destination of these files then something like this should do the trick;

Code: [Select]@echo off

:start

xcopy "c:\program files\test\*.log" "r:\test\*.log" /y/s/e/h

if i/ "%errorlevel%" GTR "0" goto error

echo.
echo.
echo Copying Complete
echo.
echo Pressing a key will close the script
pause&GT;nul
exit

:error

echo.
echo.
echo.
echo Unable to Copying files, please check network connections.
echo.
echo Pressing a key will start the copying process again
pause>nul
goto start


I should point out that this is untested. Please make any changes that are needed, or post back I'll amend it.

Hope it helps.
It seems to have got mangled, or copied by some unusual method, because it is seriously broken.

Below is my guess at how it was intended to look.

It seems to be a front end for xcopy that checks for source and destination. However, in the line that invokes xcopy, some literal folder names seem to have got substituted for the passed parameters that are plainly visible elsewhere, so the source & destination folders are now fixed, whatever parameters are supplied.

Perhaps it has been edited by an inexpert person? It certainly LOOKS that way.

How did you copy the batch file to post it on here?

@echo off
if "%1"=="" goto error1
if "%2"=="" goto error2
xcopy "%1" "%2" /y/s/e/h
goto endofprogram
:error1
echo you must provide source
echo Syntax:
echo %0 source destination
goto endofprogram
:error2
echo You must provide destination
echo Syntax:
echo %0 source destination
goto endofprogram
:endofprogram

Sorry people, in my haste I retyped the script wrong. Here is what is actually reads:
@echo off
if "c:\program files\test\*.log" == "" goto error1
if "r:\test\"=="" goto error2
xcopy "c:\program files\test\*.log" "r:\test\" /y/s/e/h
goto endofprogram
:error1
echo you must provide source
echo Syntax:
echo % source destination
goto endofprogram
:error2
echo You must provide destination
echo Syntax:
echo %0 source destination
goto endofprogram
:endofprogram

I was trysing to do this in the BACKGROUND of XP without user input. LET me mess with your suggestions. OBTW - EXPERT I am not. In fact I know just enough to be dangerous, but little enough to be harmless.

Thanks for the help.

RicharddIs the intention to copy every file with the extension .log in the folder c:\program files\test to the folder r:\test?
Yes, that is the intention. Copy all *.log files from one directory to another. I tried using /d so that only the most recent file would be copied ...but I could not get it to work. So I put in the /y to overwrite any files.

Thanks again,

Richard

7376.

Solve : How do I use same log file for the batch file?

Answer»

yeah, i know....
I'm indonesian , my english is very limited
different with you, you use english daily..
if my english better, i SURE give more lesson...I am sorry if i was rude. I think I had very bad MANNERS before, and I apologise.

No problem, I apologise too.
my posting was more rude than you...forget it

nobody in the WORLD is perfect and surely have FREQUENT mistake..
;)peace..

7377.

Solve : DOS Scripting immediate help needed?

Answer»

hi,
I want to know what is DOS scripting, how we transfer DATA through DOS scripting, how we can resolve the following thing:
Existing Dos scripts need re-vamping to convert CAD data to .cgr format.

please reply with helpful links as it is immediately needed. i m underpressure from my boss.
take care
byeA lot more info REQUIRED. Please read this..

ThanksWhen I see "immediately needed" or "Help me NOW" I always think, "I'll post an answer in a couple of days or maybe I'll wait a week or so"... Shouting for instant service in that way is very bad manners, Seenan.

If this is for your work, maybe you should earn your salary instead of asking US to do it for you?

Quote from: contrex on September 11, 2007, 11:46:42 PM

When I see "immediately needed" or "Help me NOW" I always think, "I'll post an answer in a couple of days or maybe I'll wait a week or so"... Shouting for instant service in that way is very bad manners, Seenan.

If this is for your work, maybe you should earn your salary instead of asking us to do it for you?



Sorry for asking u for help, I thought like other forums this forums is to help people in need, i didnt know that people on job cannot ASK questions, second sorry i didnt know that i cannot ask for immediate help even the MATTER may be of immediate attention, When i will resign or lose my job then i will ask you again.
any way thanks very much for ur help. keep it upI'm thinking if your boss expects you to know how to do something that you have no clue how to do then your not meeting your job description.Quote from: Kirbya on September 14, 2007, 02:26:36 PM
I'm thinking if your boss expects you to know how to do something that you have no clue how to do then your not meeting your job description.

Exactly.

If you talk the talk, you must walk the walk.


7378.

Solve : Modifying attibutes through batch file?

Answer»

I have a file: IPC.log in my C: drive.
In command prompt attrib IPC.log SHOWS
SHR C:\IPC.log
(S-System, H-Hidden, R-ReadOnly)

Now I want to create a batch file which on double click
1. CHANGES the attirbutes of this file then
2. Copies this file to my D:\ drive
3. Then again changes the files attibute as original.

Is it possible ?
I tried writing simple commands in notepad and save it as a batch files, but on double click NOTHING happens.
My batch file was:

attrib IPC.log -s -h -r
copy IPC.log D:\
attrib IPC.log +s +h +r

Can any one help ??.....Thanks in advance...Put the switches before the file name.

attrib -s -h -r ipc.log
copy c:\ipc.log d:\
attrib +s +h +r ipc.log


Hi Dude,

Try out this,

xcopy /K /I c:\ipc.log d:\ipc.log


This commad will copy the file without making a check for the attributes and the destined filed will also have the same attribute as the source file.
Thanks Contrex you made my BASICS correct and thanks HITESH you told me exactly I m wishing to do.....

7379.

Solve : Changing program icon of a batch file???

Answer»

Is this POSSIBLE? and if not, is it possible with executables?No, I do not think that is possible. However, you can change the icon of a memory stick or CD by using an AUTORUN FILE.Quote

Changing PROGRAM icon of a batch file ??
u can just change the default icon on registry value :
------------------------------------------------------------------
"HKCR\batfile\DefaultIcon"
Default:%SYSTEMROOT%\System32\shell32.dll,-153
------------------------------------------------------------------
change default value to your icon location ..
i.e : Default:D:\Icon\MyOwnBatchIcon.ico
7380.

Solve : UNPARTITION AN EXTERNAL USB HARD DRIVE?

Answer»

How do you unpartition an External USB hard drive? It shows two drive letters in windows explorer. "J" and "K". I have formatted both of these drives, but I can't figure out how to unpartition them and get them back to only one drive letter.FDISK is the partition and volume manager; you may be able to use that (I do not know if it works on removable drives)

Let us know how you get on
GrahamQuote from: gpl on April 17, 2008, 02:00:39 AM

FDISK is the partition and volume manager; you may be able to use that (I do not know if it works on removable drives)

Let us know how you get on
Graham
The two partitions have drive names of J & K. If I type FDISK at a Dos prompt with K or J the system states that this is not a correct entry. There must me a command somewhere that says "combine" two drives into one.
Thanks for your help. BTW-Computer is Dell 8400-1 Gig Ram-1Ghz in a network (router) with 4 other computers. It is interesting in that this computer can backup to an external hard drive that is on another computer in the network. The External hard drive I was trying to unpartition is attached to this (main) computer. I was going to give this external hard drive to my mother in law and wanted to unpartition it. The HD has 164 GB with each partition having about 80 GB.
Both the J drive and the K drive have been formated and are clean. When I hook it up to her computer, I would assume it will be still partitioned. I think it can work well for her with the two partitions. She can alternate backups to each. That might be better than doing an unpartition. I bought a new 500 GB external HD and attached it to the same USB plug and it assigned a letter H.
Again, Thanks for the answer.
Joe

Joe Graham & Joe,

YES, Fdisk will work on a removeable drive. (It even works on a USB drive.)

FDISK is a DOS utility. See the following for a thorough explanation.

http://support.microsoft.com/support/kb/articles/Q255/8/67.ASP
http://support.microsoft.com/kb/q255867/#

Most of us use a Windows98 boot disk with key dos utilities on it. With Fdisk you would FIRST delete both of the partitions. (all of the data on that hard disk is permanently deleted.) Then create a new partition. After the new partition is created you need to reboot the system so that it reads the new partition table. Then format the drive.

It's not a very friendly program, but does the job for FAT & FAT32. If you need NTFS, you will need something else. I use Partition Magic. It is able to do a lot more including NTFS and able to do it without any data loss, if that is a problem.



Thanks for the info. I think I will just use this on my Mother-in-law's computer and leave the partition as it is. She can have two backup drives. Thanks again.
JoeRight click My Computer / choose Manage / choose Disk MANAGEMENT / REPARTITION the drives here.

Alan <><
7381.

Solve : Want .bat file to close all open folders.?

Answer»

Is there a way to close all open folders in windows? Microsoft.com says the shortcut "CTRL + ALT + SHIFT + F4" does just that. But I can't get it to work.

how did you "open" the folders in the first place? describe.Quote from: ghostdog74 on September 11, 2007, 10:28:55 PM

how did you "open" the folders in the first place? describe.
I'd use the explorer COMMAND. Below is an example.

Code: [Select]EXPLORER "D:\Erik's Documents\Photographs"TRY this vbscript which will kill all explorer.exe processes, ONLY as a last resort.
Code: [Select]Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("Select * from Win32_Process Where Name = 'explorer.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
Thank you ghostdog. That works nicely, but...

I wish for only folders to be closed. What if I know exactly which folders I have open? Depending on what I'm doing I'll always have the same 3-5 folders open.

That script closes down my toolbars, which I do not like.Quote from: And 1 on September 12, 2007, 01:28:07 AM
Thank you ghostdog. That works nicely, but...

I wish for only folders to be closed. What if I know exactly which folders I have open? Depending on what I'm doing I'll always have the same 3-5 folders open.

That script closes down my toolbars, which I do not like.
that's why i said use as last resort. there are ways to do it, albeit more complex.
1) using tools like handle.exe. List open processes, get the PIDs , use taskkill
2) using tools like vbscript, run the explorer within vbscript , get the PIDs of each opened explorer and store them somewhere. Then when you want to close them, execute another part of the script to close all of them...
3) others.....
However, I am sure you can just close it manually, since its only 3-5 folders?The PID's change each time right?

Also, is there a way to modify that VBS you have to not close down toolbars?Code: [Select]Option Explicit
Dim shell,oWindows,j
Set shell = CreateObject("Shell.Application")
set oWindows = shell.windows
for j = 0 to oWindows.count - 1
oWindows.item(j).quit
next
set shell = nothing
set oWindows = nothing
The above demonstratoin clears all open windows you have. That gives an error for two or more folders opened. It works PERFECTLY for only one folder.

Exact same error every time:
Code: [Select]Script: C:\Documents and Settings\Erik\Desktop\test.vbs
Line: 6
Char: 4
Error: OBJECT required: 'item(...)'
Code: 800A01A8
Source: Microsoft VBScript runtime error
If I have 4 folders open it will close 2, then give error. If I have 9 folders open it will close 5, then give error. 12, 6.....18, 9

Using Win XP Pro SP2
7382.

Solve : Need to create a back-up batch file?

Answer»

Forgive me if this is in the wrong place. I didn't see a forum for something like this.

What I need to do is make a batch file (I think) that will run every time my computer shuts down. What I need this file to do is make a backup of the files I changed during the course of the day, and copy them to the server.

On my computer, I want everything thats in the folder called c:\drawings\>jobname<\design to be copied to h:\TC JOB Folders\>jobname<\Design

Now there are hundreds of different >jobname< folders and each has a 'design' folder, so I need >jobname< to match >jobname<

If possible, I would like it to only overwrite files that have been changed and leave those with the same date alone.

Can this be done?

Obviously the problem I am having is that people who don't always have access to my computer sometimes need access to my work and I don't want an old version of a drawing SENT out by mistake. I try to remember to do backups daily, but sometimes it doesnt get done, or I change 20 files during the course of the day and don't back them all up to the server.why dont just keep re-writing them over. much easier to make.
Code: [Select]@echo off
copy "c:\drawings\>jobname here<\design" "H:\TC Job Folders\>job name here<\Designhope this helpsAre there other DIRECTORIES in C:\drawings that you do not want to copy? Assuming that you want everything under C:\drawings, I think this will do exactly what you want:

Code: [Select]xcopy C:\drawings\ "H:\TC Job Folders\" /s /c /d /y
This will only copy updated files or NEW files from C:\drawings to H:\TC Job Folders. If the same file exists it will just ignore it.

If you only want what is in C:\drawings\[jobnumber]\design without the other stuff, then it can still be done, but with a little bit of extra code in a for /f loop like:

Code: [Select]@echo off
for /f "delims=" %%a in ('dir C:\drawings /ad /b') do xcopy "C:\drawings\%%a\design\ "H:\TC Job Folders\%%a\Design\" /s /c /d /y

7383.

Solve : HELP... Please? :]?

Answer»

Pies, please don't take this the wrong way, I'm very happy to help if I can, but I'm kind of surprised that you evidently have a java compiler, which you use, presumably for compiling code that you have written, which suggests a reasonable amount of intelligence and willingness to peek under the hood, yet you SEEM to have absolutely no idea at all how your computer or OS works, where files might be located, whether and when and how many times you installed Java or whether God put it there while your back was turned (or you are not very forthcoming about that.)

Or that you did not think of performing the action that WOULD have led you to this

http://www.google.co.uk/search?num=100&hl=en&safe=off&q=java%2Flang%2Fobject+not+found&btnG=Search&meta=

presumably your java compiler worked once upon a time, and you did some things, and now it doesn't? Is that right? or has it ever worked at all?



Sorry but I'm really struggling with the downloadQuote from: Pies on September 07, 2007, 02:09:00 PM

Sorry but I'm really struggling with the download

Tell me more...

I can't find how to do it.

It's tell me to install jclMax and I can't find out to install that (that's the first problem)


Help please? (Sorry)Can't find out how to do what?

Why are you giving NO information? To get help you must say what you want to do. You have said nothing. You are asking for help about... what?

No more help from me until then.

check also your CLASSPATH environment variable. If you do not have it, try define one, or else give the full path of the classes you need to compile on the command line. Also compile only one Java program at a time to narrow down your error. if you have got your path correct, this should be the SYNTAX..
Code: [SELECT]javac -cp <classpath> javaprog.java
show here how your environment looks like
Code: [Select]c:\> set
also, if possible, show your java program.
7384.

Solve : ms dos command for inet history?

Answer»

Does anyone knows if there is a command that shows you the internet history, after you deleted ( VIA internet OPTIONS ) is still viewable through dos ?If you delete your internet history, it is most likely gone. You could try looking in the Recycle Bin but I DOUBT it would be there.you can use
1) system restore
2) search for all index.dat in your system USING the GUI search , or use dir /S index.dat. then use some tools that can view index.dat.
3) you can also try registry keys like HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs and others...

7385.

Solve : Creating a batch file that renames a file?

Answer» RENAMING is the easy part. The problem is that I want to rename a file and overide an EXISTING file. So there will be two FILES: backup.bkf and backup_store.bkf

How can I create a batch file to rename backup.bkf to backup_store.bkf without first deleting backup_store.bkf

Thanks for any asistance
Hello?? First rename backup_store.bkf to something else.



Thanks contrex for your insight into the INCREDIBLY obvious. Perhaps it was my bad that I didn't explain that this would run nightly and that renaming the existing destination file was not an option. FORTUNATELY I found 'xcopy', which does exactly what I need.

T
7386.

Solve : Need a code?

Answer»

I am righting a new .bat command to put on end user desktops.
basically it is
Net Stop Spooler
Net Start Spooler

Basically it restarts the spooler.

However within this command they NEED to have administrator rights.
if I add

login administrator

to the beginning of the script it does not work.

Any ideas? start the .bat with the following:

net use \\computername /USER:administratorname passwordyou might want to also get it wait a few seconds before restarting. (form experience)

something like;

ping LOCALHOST >nulNice,

Now one more question.
from command prompt, how do I see all logins and what machine they logged into over the last 24 HRS?

This has been a stumper for a while

Thanks Again!!why not put this at the end of the batch file:
Code: [Select]echo %computername% %logonserver% %userdomain% %username% logged in at %date% %time% >> "C:\Documents and Settings\somefile.txt"
this will put all of that info into a TEXT file on the hard DRIVE. to make it go to your server you will have to change the output file Code: [Select]"C:\Documents and Settings\somefile.txt" to where ever your server is.

7387.

Solve : how to read ORACLE_HOME and ORACLE_BASE from registry?

Answer»

Hey, Dos MASTERS out there
Please help me to find out ORACLE_HOME and ORACLE_BASE VARIABLES from registry

If some one have SAMPLE code it would be very useful

Thanks in advance

7388.

Solve : Help creating a batch file?

Answer»

Sometimes it happens that the icon for safe removal of hardware disappears
from the Windows task bar.

The way to RESTORE it is to run the following command:

"RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll"

Now I would like to WRITE a BAT file that does this, so I could simply click
on an icon to restore the safe removal function. Would anybody like to help
me with this?

If I recall, just put your code (RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll) into a batch file (a text file and save as file.bat), and then just put that batch file onto your desktop.

Voila.Oh well... was it that simple?

It does seem to work! THANKS!Just an addition: With this command in the batch file, the command prompt window stays open behind the Safe removal window until that is closed. Is there a way to write the batch file so that the command prompt window closes automatically?Well, I'm not too sure about this, but try adding exit at the end of the file.Well, I had already added the EXIT command - but that does not help...QUOTE from: Hans_N on SEPTEMBER 07, 2007, 11:03:31 AM

Well, I had already added the EXIT command - but that does not help...

You need something like this. When you open something in that way the batch file will wait until it is finished before continuing, like 'calling' it. You need to 'start' it.

This works for me.

Quote
@echo off
start RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll
exit
Yes - that did the trick - thanks!

(And BTW in other batch files I have created, I have the START command, so I should have thought of that.)
7389.

Solve : deleting files in startup?

Answer»

Quote from: patio on September 03, 2007, 07:58:09 AM

services.msc is a better choice...sometimes msconfig does not always apply and or RETAIN the changes. This can lead to boot issues.

Also it won't prompt you for that restart as msconfig does.
Quote from: Deerpark on September 03, 2007, 09:04:33 AM
You can only configure programs that are registered as services in services.msc, not programs that have placed a registry key in Run or a shortcut in the startup folder.
Patio your XP install is the only in the world with a services.msc that can configure items STARTED from Run in the registry or the startup folder.

Windows Services are different from other programs executed at startup in two ways:
1) Any executable can be executed through the Startup folder/Run, while a Windows service is a specially created background application AKIN to Unix daemons.
2) Services are started at boot time while items in Run/Startup are executed at user login.
7390.

Solve : reading register entry?

Answer» HI friends
HOW CAN I READ REGISTER ENTRY AND THEN EXTRACT SOME OF THE REGISTER ENTRY TO MY VARIABLE.
first use the REG /query command type reg /query /? to see a list of supported options, once you figure that out, use a for array

for example:

@ECHO off
set idx=0
for /F "tokens=1*" %%a in ('reg query HKCU /f OF /d /t Reg_Binary') do (
call set /a idx=%%idx%%+1
call set e.%%idx%%=%%a
)


the variables set, would be %e.1% and %e.2% ectthanks u very much
7391.

Solve : want to copy/rename a particular file to desires name using batch file while run?

Answer»

Dear sir,

I am a accountant, while running my account package to display any desired information, a temporary file with the name data.rtf automatically created in background. The contants of data.rtf varies with every NEW display. I want to save this data.rtf file with my desires name using BATCH file command, please help me.

thank's
raviQuote from: ravi.ravi on July 04, 2010, 10:45:33 AM


A temporary file with the name data.rtf automatically created in background. The contants of data.rtf varies with every new display. I want to save this data.rtf file with my desires name using batch file command

C:\test>type ravi.bat
@echo off

copy c:\temp\data.rtf c:\test\desirename.rtf


Output:

C:\test>ravi.bat
1 file(s) copied.
C:\test>dir desire* | findstr "desire"
07/04/2010 12:14 PM 9 desirename.rtf

C:\test>Quote from: marvinengland on July 04, 2010, 11:20:50 AM
C:\test>type ravi.bat
@echo off

copy c:\temp\data.rtf c:\test\desirename.rtf


question: in this batch file it seems you would have to enter the desired name into the batch file while you are creating the batch file, i.e. before loading the display that you will want to save the temp file from.
How could one program interaction into he batch file instead, whereby each time a display was finished, the temp file would be saved with a new name that you would decide and enter while the batch file itself is running?Quote from: KB5cmd on July 05, 2010, 06:00:53 PM
question: in this batch file it seems you would have to enter the desired name into the batch file while you are creating the batch file, i.e. before loading the display that you will want to save the temp file from.
How could one program interaction into he batch file instead, whereby each time a display was finished, the temp file would be saved with a new name that you would decide and enter while the batch file itself is running?

With a commandline argument or prompt the user for the name.

I will show an EXAMPLE of each shortly.


C:\test>type ravi.bat
@echo off

copy c:\temp\data.rtf c:\test\%1.rtf

Output:

C:\test> ravi.bat newname
1 file(s) copied.
C:\test>dir *.rtf | findstr "newname"
07/04/2010 12:14 PM 9 newname.rtf

C:\test>
_________________________________


C:\test>type ravi2.bat
@echo off
set /p name=Enter name:

copy c:\temp\data.rtf c:\test\%name%.rtf




C:\test>ravi2.bat
Enter name: ravname
1 file(s) copied.
C:\test>dir /tc ravname.rtf | findstr "ravname"
07/05/2010 08:31 PM 9 ravname.rtf

C:\test>
7392.

Solve : Checking laptop configuration using DOS?

Answer»

Hi,

I am going to buy a LENOVO laptop which comes with only DOS. I am not PURCHASING any OS. Can someone tell me how to check the system configuration (PROCESSOR, RAM, HDD etc) using DOS command. This will help me to VERIFY the product correctly before purchasing.

Appreciate all your help.

Thanks,

Anirban will you buy it online?
http://www.lenovo.com/us/en/
or you can see the manual provided within.
as far as i know you did not have take that much pain. If you know the model number, you can search online and see what the specs are.

7393.

Solve : How do i create an bootable CD of DOS??

Answer» HI,

How do i take the 3 FLOPPY files of MS-DOS 6.22 and create an bootable CD? I know many of years ago in my first PC it had an floppy drive so that was easier but this PC does not have a floppy drive. If i make DOS on a CD do i need to create it as 3 CD's just like floppies? Would it PROMPT me for all 3 CD's? I know it prompts for all 3 floppies.Everything You Need and more...DOS6.2 is 4 floppies...are you missing one ? ?I still don't know how to create a bootable and where can i download all 4? How do i join them?You can't DLoad MSDOS 6.2 for free...at least not legally.
However the link i provided explains every step in creating a boot CD with DOS 6.2I have been looking at that site and still don't know how to create itQuote from: php111 on September 09, 2007, 05:25:39 AM
I have been looking at that site and still don't know how to create it

download an ISO from here

http://www.allbootdisks.com/iso.html

and burn it

I TRIED that didn't go so well. all it does is boots from the CD. *CENSORED* i don't want that. I want to actually install it. That's why i want to use the 3 floppies.This option might be easier. I have the following.

disk1.ima
disk2.ima
disk3.ima

How do i burn .ima files with Nero?
7394.

Solve : ms dos program how set autobackup??

Answer»

i got ms-dos program... and want to set AUTO backup.
so how to set it?

last time i got ONE auto back up at k: drive but now my handy drive change to G: drive..
so how to change the autobackup K: to G:?first, you don't have to talk liek dis (don't leave out words and stuff). second, do you mean you have a batch file (if it is, a copy of the file you are using would be great (copy and paste the text))? are you using xp or a diffrent OS? i using vista basic..
ya i have a batch file.
how to cope the text? does the batch file say have .BAT at the end of its name? if so just RENAME the .bat part .txt then GO into it and copy the text. paste it in a reply. if you don't see .bat at the end of its name right click and see if their is an option called 'edit'. if there is then click it and then do the copy and paste thing i told you about above.

7395.

Solve : Automate the scheduling of the batch file?

Answer»

Hi Friends,

I have created a batch file in DOS, Backup.batch, which takes the backup of our PROJECT documents on a remote location.
Now everytime, its somebody who has to start this batch file.
IS i possible that i can automate this batch file, LIKE it automatically executes on certain defined timings on it's own, even though the system is not logged in by any user, but is POWERED on.

Another would be, still running automatically with say any user logged into the system, and this batch file running at the backend.

Can somebody HELP me with this?

Thanks in advance

Hitesh ShettyCheck the AT command, however I dont know about the user SCENARIO, I have always used the windows scheduler
Graham

7396.

Solve : how do i ???

Answer»

Hello,

I want to do the following in DOS

1. In a given directory select the OLDEST file from a list of files..call it file X
2. COPY the CONTENTS of file X to File Y which is in another directory
3. Change file X so it BECOMES the newest file

That way I cycle thru the files to provide the contents of file Y

Ideally REPEAT this process each time I send an email....or if not possible, each time I startup

cheers

7397.

Solve : How to get the total number of row records from a csv file??

Answer»

How to get the total NUMBER of row records from a csv file by a BATCH file METHOD?

For example, the total number of rows in a csv file is 320 and i WANT to get the number and PUT it into a variable.

thanks!Assuming that there are no blank rows, try

find /c /v "" MyFile.csv | sort /R >findcount.txt

This will output a line like this
---------- MYFILE.CSV: 190
Which you can then pull into a variable and parse with
Set /P MyCount=
The sort is necessary as the output from the FIND has a leading blank line, which messes up the set statement.

The find statement searches for all lines that do not contain a blank string (the /v means not contains) and the /c means just provide the count of returned rows.

Hope this sorts you out
Grahamyeah! it helps a lot!
thanks!

7398.

Solve : reading from a file in DOS?

Answer»

I have a W2K OPERATING system and have written a DOS BATCH file to copy files held in different folders (all in the same location) to another location. Occasionally, the folders change, as new ONES are added. The batch file then needs to be updated. If I write the list of folders to a text file, is it possible to read the name of each folder from the file, a line at a TIME, so that the main batch file can then use the text file to check every folder for files that need to be copied?u can use the for command like this

for /f %%i in (filename) do ECHO %%i

where i will be the lines u put inside the file

7399.

Solve : Basic question.... please help?

Answer»

currently my DOS is sitting at

C:\>

how can i change it so its

C:\ WINDOWS


Sorry if this is ridiculously simplesorry...

i think it MIGHT have to look like

1: C:\ WINDOWS



TYPE cd\windows and hit Enter...

CD is the change directory command.it says:
the command is not recognised type help for a list of supported commands

i typed:

cd\windowsanyone?Type dir /P and hit Enter...this will show you a list of current directorys....spacebar moves the page down one line at a time...
Does it list a Windows directory ? ?

By the WAY what OS is this ? ?xp

i just did that and it came BACK with:

directory of C:\p

an error occured during directory enumeration


just to let you know... ive got a recovery disk in my machine cos im trying to fix my compAt the C: prompt type dir /p and hit Enter.
There is a space between dir and the /...
If it is showing no directories you will definitely need that restore CD.
What happened prior to this ? ?or try with this: C:\>CD WINDOWS

there is a space between CD and WINDOWS.

regards,
chinnahI,

Just Type cd c:\windows

There's a space between cd and c:\windows

Regards,

7400.

Solve : batch to open pdf files with different pdf viewer?

Answer»

I couldn't get it to not work when I changed the paths to PROGRAMS on my system.

You can remove "START", since it's ABSOLUTELY useless in this context.

Code: [SELECT]if (%1)==() goto bad
if "%~dp1"=="D:\My documents\ebooks catalog\" goto book
goto pdf
:book
C:\Program Files\PDF Annotator\PDFAnnotator.exe %1
exit
:pdf
C:\Program Files\Foxit Software\Foxit Reader.exe %1
exit



try this

if (%1)==() goto bad
if "%~dp1"=="D:\My documents\ebooks catalog\" goto book
goto pdf
:book
"C:\Program Files\PDF Annotator\PDFAnnotator.exe" %1
exit
:pdf
"C:\Program Files\Foxit Software\Foxit Reader\Foxit Reader.exe" %1
exitNope, Keeps flashing, Starts, and exits, and starts again.
The only way to get out is to restart my PC.

Thanks guys for your help.
Maybe I am trying to do something impossible.f (%1)==() goto bad
if "%~dp1"=="D:\My documents\ebooks catalog\" goto book
goto pdf
:book
echo ebook %1
pause
exit
:pdf
echo pdf %1
pause
exit

tell me the result of regular pdf and pdf in ebook folder
and no its not immpossipble i got it to work on my computerYep this WORKS perfectly.
Thanks a lot mat123, I appreciate your help and determination.

All the best