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.

401.

Solve : Delete by date modified?

Answer»

What is the command to delete files by date modified?

Specifically, I want to delete all files in a folder with a modified date older than 5 days. TIAC:\test>type  mdel.bat
echo off


forfiles /s /m *.bat /d -5 /c "cmd /c dir  /tw  file" |  findstr  ".bat" 
rem  forfiles  /?

OUTPUT:

C:\test> mdel.bat

.
.
.



10/11/2010  03:34 PM               171 shiftarg.bat
10/11/2010  10:19 PM               161 bc.bat
10/12/2010  02:01 PM               269 lori.bat
10/13/2010  07:30 AM               343 not.bat
10/13/2010  07:41 AM               292 not2.bat
10/13/2010  09:36 AM               405 not3.bat
10/21/2010  03:20 PM                87 datetime.bat
10/26/2010  03:29 PM                85 st1026.bat
10/26/2010  03:49 PM                50 replace.bat
10/28/2010  06:58 PM                99 st102810.bat
10/28/2010  08:06 PM               135 down.bat
10/29/2010  08:21 AM               653 st1029.bat
10/31/2010  09:23 PM                 0 cpfld.bat
11/03/2010  09:56 PM               161 bccmp.bat
11/04/2010  11:54 AM                75 dosout.bat
11/05/2010  05:52 PM               255 ken11510.bat
11/07/2010  05:12 PM               198 larry11710.bat
11/07/2010  06:33 PM               163 cntbytes.bat
11/07/2010  07:41 PM               263 cntbites.bat
11/09/2010  06:31 PM               280 wh.bat
11/11/2010  09:50 PM               340 thirydays.bat
11/11/2010  10:13 PM               414 sam.bat
11/12/2010  05:58 PM               370 paul.bat
11/13/2010  10:47 AM               308 mp.bat
11/14/2010  06:25 AM                29 deuce.bat
11/15/2010  09:05 AM               265 err.bat
11/16/2010  02:24 PM               146 slim.bat
11/16/2010  03:49 PM               277 thin.bat
11/16/2010  07:11 PM               315 adh.bat
11/16/2010  07:48 PM                31 pair1.bat
11/16/2010  07:49 PM                31 pair2.bat
11/16/2010  08:12 PM               217 killnote.bat
11/16/2010  10:29 AM               154 file_or_Dir.bat
11/17/2010  03:52 PM               189 greg.bat
11/18/2010  01:47 PM                 0 skr.bat
11/18/2010  02:11 PM               510 slow.bat
11/18/2010  09:27 PM               311 prem.bat
11/19/2010  01:41 PM               223 adhold.bat
11/19/2010  02:11 PM               328 killtwo.bat
11/19/2010  02:40 PM               328 killpair.bat
11/19/2010  09:07 PM               130 jp.bat
11/19/2010  10:19 AM             2,217 sidew.bat
11/19/2010  10:22 AM             1,748 sw1119110.bat
11/20/2010  05:03 PM               503 dusty.bat
11/20/2010  05:53 PM                36 ser.bat
11/20/2010  08:19 PM               188 killit.bat
11/23/2010  06:26 PM             2,913 yarosav.bat
11/23/2010  06:44 PM             1,826 yaro.bat
11/24/2010  03:21 AM               209 greater.bat
11/24/2010  03:49 AM               235 len.bat
11/24/2010  05:06 PM               508 dusty2.bat
11/24/2010  08:09 PM               487 shan.bat
11/24/2010  08:13 PM               433 len2.bat
11/25/2010  02:17 PM                 0 tab.bat
11/25/2010  02:29 AM               629 swlen.bat
11/25/2010  03:50 PM               134 starttitle.bat
11/25/2010  04:03 PM               180 killtitle.bat
11/25/2010  04:06 PM               151 killme.bat
11/25/2010  04:59 PM               857 killyahoo.bat
11/26/2010  01:00 PM               196 whatever.bat
11/26/2010  03:40 PM               215 yar.bat
11/26/2010  12:08 PM               405 killchrome.bat
11/27/2010  03:45 PM                60 test2.bat
11/27/2010  03:46 PM                58 test3.bat
11/27/2010  04:12 PM               381 backg.bat
11/29/2010  07:25 PM               421 conif.bat
11/30/2010  07:45 PM               134 dave.bat
11/30/2010  08:18 PM               243 dave2.bat
12/01/2010  09:27 PM               298 ran2.bat
12/02/2010  07:47 PM               591 st120210.bat
12/02/2010  07:57 PM               662 ran20.bat
12/03/2010  03:30 PM               707 stran12310.bat
12/04/2010  10:43 AM               577 ransw.bat
12/04/2010  11:13 AM               516 ran2sw.bat
12/04/2010  11:50 AM                 0 sorit.bat
12/05/2010  07:19 PM               320 swrdn5.bat
12/05/2010  08:28 PM               399 brand.bat
12/05/2010  11:57 PM               777 brian.bat
12/06/2010  05:46 PM               734 realmenu.bat
12/07/2010  04:39 PM                46 cleanup.bat
12/07/2010  04:43 PM               309 bb.bat
12/10/2010  07:34 PM                96 bobt.bat
12/10/2010  10:44 PM                20 crest.bat
12/11/2010  06:57 PM               480 brand2.bat
12/12/2010  08:33 AM               413 chat.bat
12/12/2010  11:12 PM               998 vox2.bat
12/12/2010  11:39 PM                89 vox.bat

C:\test>Reply #1  will find the files older than five days.

redirect the output to a text file and delete all files older than five days  with a for loop. Quote from: donald99 on December 18, 2010, 10:57:42 PM

Reply #1  will find the files older than five days.

redirect the output to a text file and delete all files older than five days  with a for loop.

Why not just tell forfiles to delete the files older than 5 days? I know you like redirecting, Bill, but it is not necessary in this case.

I suspect Bill just found out about forfiles and logged in as a DIFFERENT user to ask a "question" that he could proceed to "answer" as donald99, who therefore won't complain that his question was not answered properly.

The original question asked how to delete all files in a folder older than 5 days. Bill showed how to use forfiles to make a file containing a list of .bat files in a folder and all subfolders under it, that were older than 4 days. He then issued a vague suggestion to "use a for loop" to delete those files. Ah the "for loop" - forever beyond Bill's comprehension.

However it may be that somebody sometime might really want to know how to use the forfiles command to delete files older than a certain age (Google please index here!). This can be done all in one line so a script may not even be necessary.

Let's build the command...

1. We type forfiles and a space (which you can't see yet, but it's there. Trust me.)

FORFILES

2. Next we add the /M switch with a file mask to show what files to delete - "all files" was asked for so we use *.* and another space.

FORFILES /M *.*

3. Next we add the date switch /D with a space and then a negative number and then another space. This number tells forfiles to select files with a modified date less than or equal to today's date minus that number of days. This means that if you put /D -5 you will select all those files which were modified more than 4 days ago. So take care here. Since the OP asked how to delete files "with a modified date older than 5 days", the correct number would be -6.

FORFILES /M *.* /D -6

4. Now we add the /C switch and a space to tell forfiles that what is coming next is a command string.

FORFILES /M *.* /D -6 /C

5. At last we can specify the command which we want to perform on these selected files. To delete the file we specify CMD with the /C switch, followed by a space then DEL and a space and finally FILE and we put the whole lot in double quotes.

FORFILES /M *.* /D -6 /C "CMD /C DEL FILE"

There you are. Finished. Although I have used upper case in fact you can use lower case, or a mixture.







Quote from: Salmon Trout on December 19, 2010, 01:52:11 AM
Why not just tell forfiles to delete the files older than 5 days? I know you like redirecting but it is not necessary in this case.

I was unable to test the delete function of forfiles. But it should work.

Thanks for the suggestion

p.s The for loop is an option. Quote from: donald99 on December 19, 2010, 04:13:46 AM
I was unable to test the delete function of forfiles. But it should work.

Thanks for the suggestion

p.s The for loop is an option.

Oh right! It should work. That is reassuring. Did Bill Gates tell you that himself?

You don't mind me calling you Bill, do you?


Quote from: Salmon Trout on December 19, 2010, 04:14:47 AM

Salmon Trout,

Please show us the CODE and an output  sample for the "delete by date modified" forfiles code.

Thanks for your help.

p.s.  forfiles /? Quote from: donald99 on December 19, 2010, 04:21:09 AM
Salmon Trout,

Please show us the code and an output  sample for the "delete by date modified" forfiles code.

Thanks for your help.

p.s.  forfiles /?

I already showed the one line of code. There is no "output". Maybe time to lock this thread, prior to banning Bill again?


Quote from: Salmon Trout on December 19, 2010, 04:07:57 AM
The original question asked how to delete all files in a folder older than 5 days.

However it may be that somebody sometime might really want to know how to use the forfiles command to delete files older than a certain age (Google please index here!). This can be done all in one line so a script may not even be necessary.

Let's build the command...

1. We type forfiles and a space (which you can't see yet, but it's there. Trust me.)

FORFILES

2. Next we add the /M switch with a file mask to show what files to delete - "all files" was asked for so we use *.* and another space.

FORFILES /M *.*

3. Next we add the date switch /D with a space and then a negative number and then another space. This number tells forfiles to select files with a modified date less than or equal to today's date minus that number of days. This means that if you put /D -5 you will select all those files which were modified more than 4 days ago. So take care here. Since the OP asked how to delete files "with a modified date older than 5 days", the correct number would be -6.

FORFILES /M *.* /D -6

4. Now we add the /C switch and a space to tell forfiles that what is coming next is a command string.

FORFILES /M *.* /D -6 /C

5. At last we can specify the command which we want to perform on these selected files. To delete the file we specify CMD with the /C switch, followed by a space then DEL and a space and finally FILE and we put the whole lot in double quotes.

FORFILES /M *.* /D -6 /C "CMD /C DEL FILE"

There you are. Finished. Although I have used upper case in fact you can use lower case, or a mixture.

Salmon Trout,

Where is a sample of FORFILES /M *.* /D -6 /C "CMD /C DEL FILE"
output? Quote from: donald99 on December 19, 2010, 04:33:00 AM
Salmon Trout,

Where is a sample of FORFILES /M *.* /D -6 /C "CMD /C DEL FILE"
output?

There isn't any. The "output" is the deletion of the files. Please quit trolling.
ST  wrote:

"There isn't any. The "output" is the deletion of the files."


Maybe a notice from the OS that the files were deleted successfully?

p.s.  OS means Operating System Quote from: donald99 on December 19, 2010, 04:51:41 AM

Maybe a notice from the OS that the files were deleted successly?

p.s.  OS means Operating System

Well, I leave that as an exercise for the reader. In any case deletion can be verified by inspection. Or by running the command a second time and verifying that the message "ERROR: No files found with the specified search CRITERIA." is seen. Or by doing DIR before and after.

Successly? What language is that?

What part of "please quit trolling" did you fail to comprehend?




You wanted output...

Code: [Select]S:\Test\forfiles-del>forfiles /M *.* /D -6 /C "cmd /c echo delete fdate file & del file"

delete 07/12/2010 "TestFile001.zip"
delete 07/12/2010 "TestFile002.zip"
delete 08/12/2010 "TestFile003.rar"
delete 10/12/2010 "TestFile005.exe"
delete 03/12/2010 "TestFile006.PDF"
delete 06/12/2010 "TestFile007.nzb"
delete 06/12/2010 "TestFile008.nzb"
delete 13/12/2010 "TestFile009.nzb"
delete 07/12/2010 "TestFile010.zip"
delete 11/12/2010 "TestFile011.nzb"
delete 05/12/2010 "TestFile012.nzb"
delete 10/12/2010 "TestFile013.nzb"
delete 03/12/2010 "TestFile016.PDF"
delete 03/12/2010 "TestFile017.PDF"
delete 10/12/2010 "TestFile019.zip"
delete 01/12/2010 "TestFile020.zip"
delete 11/12/2010 "TestFile024.zip"
delete 05/12/2010 "TestFile025.zip"
delete 01/12/2010 "TestFile027.zip"
delete 05/12/2010 "TestFile028.exe"
delete 11/12/2010 "TestFile029.exe"

S:\Test\forfiles-del>forfiles /M *.* /D -6 /C "cmd /c echo delete fdate file & del file"
ERROR: No files found with the specified search criteria.

S:\Test\forfiles-del>

Define Troll:

"Online false statement used as Internet lure: a carefully worded but incorrect statement that is designed to lure other Internet users into sending responses."

http://www.bing.com/Dictionary/search?q=define+troll&FORM=DTPDIA&qpvt=define+troll

p.s.  I cannot find any posts by Donald99  that fits the above definition
402.

Solve : Extracting chosen characters from command's results?

Answer»

Hello,

I want to make simple batch file that copies log file and then adds original file's modification date and run program.
I remember some time ago i was doing something like printing only chosen characters from command's result with +X -Y (from X to Y, or something very similar) but i totally forgotten how exactly and where should i use it.

In that case i would like to use 1-10, 13-14 and 16-17 characters (which should be date and time) of "dir ./debug.html" result Code: [Select]import java.io.*;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.text.Format;

public class CopyFileWithModification {
    public static void main(String[] args){
        if (args.length != 1){
            System.out.printf("Usage: java CopyFileWithModification <file name>\n");
            System.exit(1);
        }
        File fileName = new File(args[0]);
        if ( fileName.exists() && fileName.isFile() ){
            long t = fileName.lastModified() ;
            Format dateFormatter = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
            String newFileName = fileName + "_" + dateFormatter.format( new Date(t) ) ;
            copyFile( args[0] , newFileName) ;
        }
    }
    public static int copyFile( String src, String dest ){
          File inputFile = new File(src);
          File outputFile = new File(dest);
          try {
            FILEREADER in = new FileReader(inputFile);
            FileWriter out = new FileWriter(outputFile);
            int ch;
            while ( (ch = in.read() ) != -1) out.write(ch);
            out.close();
            in.close();
            return 0;
          }catch (IOException ex ){
            ex.printStackTrace();
            return 1;
          }
    }
}


[recovering disk space - old attachment deleted by admin]Wow, copying a file a single byte at a time. That's EFFICIENT. I MEAN it would work here, but on the other hand, java!=batch so it doesn't really meet their needs.





Code: [Select]echo off
REM copylog <source> <destination>
copy %1 %2
echo %date% %time% >> %2

Quote from: BC_Programmer on December 24, 2010, 05:36:31 PM

Wow, copying a file a single byte at a time. That's efficient. I mean it would work here, but on the other hand, java!=batch so it doesn't really meet their needs.
true , java is not batch. However, put the java statement inside a text file, name it with extension .bat, and its called a batch. !

Quote
Code: [Select]echo off
REM copylog <source> <destination>
copy %1 %2
echo %date% %time% >> %2

are you serious? you are appending the current date time to the destination file contents. don't think its what OP wants.
Quote from: ghostdog74 on December 24, 2010, 06:50:47 PM
true , java is not batch. However, put the java statement inside a text file, name it with extension .bat, and its called a batch. !
java statements don't work in text files. and you cannot pass a .java file with the java or javaw executables. now if you use the compiled version, that would work, so one would need to either compile the provided java code using javac from the JDK (which of course requires downloading the JDK) download and use the attached class file (which requires trust of the poster that the .class is actually the compiled equivalent of the .java provided, not that there is any reason to think otherwise) and so forth. All this for a rather inefficient SOLUTION (well, ok, so the copy can easily just be replaced with a more appropriate java.nio implementation that uses chunks)


Quote
are you serious? you are appending the current date time to the destination file contents. don't think its what OP wants.
you're right... didn't read the OP quite thoroughly enough, they want the modification date of the original file. Batch has some goofy way of doing that with that weird tilde string manip or whatever it does... I think. Damned if I know, I stay away from the really freaky batch stuff like that whenever I can.

But I'm not sure if it would work to add to the filename (it's sort of hard to tell if that's what they want or wether they want it appended to the end of the logfile itself... they both sort of make sense), since it might have evil slashes in the date... (the java example works around that by providing it's own format.)






Quote from: BC_Programmer on December 24, 2010, 07:06:45 PM
java statements don't work in text files. and you cannot pass a .java file with the java or javaw executables. now if you use the compiled version, that would work, so one would need to either compile the provided java code using javac from the JDK (which of course requires downloading the JDK) download and use the attached class file (which requires trust of the poster that the .class is actually the compiled equivalent of the .java provided, not that there is any reason to think otherwise) and so forth. All this for a rather inefficient solution (well, ok, so the copy can easily just be replaced with a more appropriate java.nio implementation that uses chunks)
i am not a Java advocate, but I do know that it doesn't matter.  What matters is if OP has no worries about using the solution, then its his business. Its not for me or you to judge whether its right or wrong.

Quote
All this for a rather inefficient solution
Whenever such a statement is mentioned about inefficiency, its better to provide a benchmark to prove what you said is correct ( as pertaining to this particular case). Otherwise, its better not to assume that one thing is better than the other.
Quote from: ghostdog74 on December 24, 2010, 07:25:11 PM
Whenever such a statement is mentioned about inefficiency, its better to provide a benchmark to prove what you said is correct ( as pertaining to this particular case). Otherwise, its better not to assume that one thing is better than the other.

I don't need a benchmark. Copying a file a single byte at a time will be slower then copying it in larger chunks. It's common sense. Quote from: BC_Programmer on December 24, 2010, 09:14:18 PM
I don't need a benchmark. Copying a file a single byte at a time will be slower then copying it in larger chunks. It's common sense.
thanks for your comments.  i did not design the code with inefficiency in mind. It  can certainly be changed using BufferedInputStream/BufferedOutputStream which will be more efficient than copying byte by byte, or using NIO.
I've kinda never seen such an offtopic

So let's define my problem again, i've attached command and result to post.

I want to extract circled characters from output to some variable, then use that variable for creating new name of debug.html i just do not remember how to CHOOSE those characters.

[recovering disk space - old attachment deleted by admin]echo off
for /f "delims=" %%A in ('dir .\debug.html ^| find /i "debug.html"') do set line=%%A
set line=%line:~0,10%%line:~12,2%%line:~15,2%
Thats not way i remember i was doing, but works too, thanks alot Quote from: drag0nius on December 25, 2010, 08:20:33 AM
Thats not way i remember i was doing

I am sorry it doesn't look like you remember, but nevertheless this is how to extract a substring from a text string: we use the notation %variable:~X,Y% where X and Y are numbers. X is the offset from the start, (so to begin with the first character we use 0 (zero) ) and Y is the number of characters to take.

403.

Solve : net use with a %1?

Answer»

Hi

is it possible to use the "net use" command with a "%1"

Ex:

ehco ENTER your server name
echo server name = %1
net use Z: \\%1 /Persitent:NO

thanks for your helpI tried a different approche but with no luck...

Code: [Select]echo enter your Server Name or IP adress
echo %1 1:Name
echo %1 2:IP
set choice=
set /p choice=
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto NAME
if '%choice%'=='2' goto IP

:NAME
net use z: \\%1 /PERSISTENT:NO

:IP
net use z: \\%1 /PERSISTENT:NO
The problem is that i'm not promt to enter any informations....

I'd like the %1 the be the info the user enter...It is not clear what you think "%1" is for.
 tried ANOTHER thing that almost do what I want it....

Code: [Select]:START
set /p nameorip="enter your Server Name or IP adress"
echo.
echo %nameorip%
if '%nameorip%'=='' GOTO errorlevel1
else (
GOTO NAMEORIP)

:NAMEORIP
net use z: \\%nameorip% /PERSISTENT:NO

:errorlevel1
echo you must input a string.
echo.
pause
exit
the problem here is : it does wait for me to input a string, but at the end of the line of ip adress.
so I take it that it does not reconize my string so it goes to the errorlevel.... Code: [Select]:START
set /p nameorip="enter your Server Name or IP adress"
echo.
echo %nameorip%
if '%nameorip%'=='' GOTO errorlevel1
net use z: \\%nameorip% /PERSISTENT:NO
goto end
:errorlevel1
echo you must input a string.
echo.
pause
:end
exithanks for the reply ! it's almost there !!

here's what "net use"'s returning me :

System error 53 has occurred.

The network path was not FOUND.

also is there a WAY to input the string onto a different line then the first one ?

found what I was looking for on that...

but there is still the option I'm not too convinced about.... Quote from: metal_man77 on December 21, 2010, 01:21:58 PM

System error 53 has occurred.

The network path was not found.


1. Try a CAPITAL letter for the drive letter Z
2. Do not put a space after the Z

Quote
but there is still the option I'm not too convinced about....

What does this mean?
Quote from: Salmon Trout on December 21, 2010, 01:33:56 PM
1. Try a CAPITAL letter for the drive letter Z
2. Do not put a space after the Z

give me the system error 67 

Quote from: Salmon Trout on December 21, 2010, 01:33:56 PM
Quote from: metal_man77 on December 21, 2010, 01:21:58 PM
but there is still the option I'm not too convinced about....
What does this mean?

I meant the net use option... with the % attibute....


UPDATE : I found what was causing the error... I cannot SIMPLY have a share of a computer, I must have a share of a folder on that computer !

UPDATE2 : IT'S ALIVE !! It works as I want it to work !! thanks a bunch ^^ Quote
2. Do not put a space after the Z

This was wrong.

Quote from: Salmon Trout on December 21, 2010, 02:56:43 PM
Quote from: Salmon Trout on December 21, 2010, 01:33:56 PM
2. Do not put a space after the Z
This was wrong.

No.. it was how I was making use of the ne use command....

I found out that you cannot simply map à drive to a computer, you MUST map it to à shared folder of that computer !!

Ex.:
[WRONG] net use X: \\computer1
[ RIGHT ] net use x: \\computer1\folder1
404.

Solve : How to pass argument containing quotes to batch script?

Answer»

Hi Friends,

Considering the following batch command invocation:

demo.bat I said, "you are so beautiful!"

In demo.bat, print the passed argument. The output should be:

I said, "you are so beautiful!"

Could you please help me implement this?

Thanks in advance!Try this workaround, not pretty but FUNCTIONAL.  Spaces will be added to the variable to make up the arguments which are not passed.  The maximum number of arguments is 9 until you use the Shift command.

Code: [Select]echo off
setLocal
cls

set this=%1 %2 %3 %4 %5 %6 %7 %8 %9

echo %this%

Syntax:  Batfilename I said, "The speed limit is 100 mph".

Output:  I said, "The speed limit is 100 mph".




 This is obviously homework. OH well though.

Code: [Select]echo off
echo %*
Quote from: BC_Programmer on December 10, 2010, 08:23:34 PM

This is obviously homework. Oh well though.
Code: [Select]echo off
echo %*
WOW!
This is the first time I saw BC pass an argument!  Thank you for the lesson BC_P.  I've noted that using %* allows for more than 9 variables to be used without the Shift command.

D. Quote from: BC_Programmer on December 10, 2010, 08:23:34 PM
This is obviously homework. Oh well though.

Code: [Select]echo off
echo %*

Hi BC_Programmer,

Thanks!

BTW, how to judge if the passed auguments equal to I said, "you are so beautiful!" in demo.bat file. Code: [Select]If "%*"=="you are so beautiful!" (echo Why thank you!) else (echo You know I'm beautiful, you just won't SAY it!")
405.

Solve : HELP with simple ms dos batch program?

Answer»

I am not to familiar with ms dos so please have patience.
i need to CREATE a BAT file that will combine to DATA files located on my C drive, but i want to be able to take that batch file and modify it to combine other files if needed in the future.

Thanks Quote from: Computer_Rookie on December 20, 2010, 12:06:17 AM

I am not to familiar with ms dos so please have patience.
i need to create a bat file that will combine to data files located on my c drive, but i want to be able to take that batch file and modify it to combine other files if needed in the future.

Thanks

Append  data files to each other? 
Code: [Select]echo data2.txt >> data1.txt  |  sort

echo  data*.txt>> data1.txt  |  sortThanks that HELPED
406.

Solve : how to create a directory based on date?

Answer»

I would like to know how to create a directory using md command with the following format : DDMMYYYY
Any help is greatly appreciated.Do you need someone to do the coding to find out what your current date format is or will you tell US?

I don't know how to do it. So I am looking for the dos command. Quote from: donsls on December 29, 2010, 09:25:07 AM

I don't know how to do it.

1. Open a command window.

2. Type echo %date% at the prompt and HIT Enter.

3. Tell us what you see, preferably by copying and pasting

If you do not do this we cannot help you.


I see the following:
Wed 12/29/2010 Code: [Select]for /f "tokens=1,2 delims= " %%A in ('echo %date%') do set dpart=%%B
set foldername=%dpart:~3,2%%dpart:~0,2%%dpart:~6,4%
MD "%foldername%"
407.

Solve : Netsh - Wireless Creation (Ad Hoc)?

Answer»

Ok so im searching for a WAY on windows 7 to create an Ad-Hoc network, via the command line interface.
It will have to involve NETSH that much i know, but i haven't been able to find any information on the creation of an ad-hoc network via command line/netsh.

At the moment im not to FUSSY on whether or not the ad-hoc network has any encryption or any security on it, just getting the creation of the network up would be great.

Currently im looking into:


netsh wlan ADD profile

Any help would be appreciatedI would start with going to the website of the WIFI NIC MFR. They have software sometimes for command line configs. From Microsoft for Windows 7 it is very unlikely that there is much info out there for command line configs as for they want the users to use their GUI to configure it, and valid command LINES for wifi can be dangerous.

408.

Solve : Looking for >file.txt alternatives?

Answer»

Is there any other way to extract the output of a command in batch file to txt  without USING >file.txt

ThanksYou can use FOR with the /F switch. See the FOR documentation - type FOR /? at the prompt or read here:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx?mfr=true

Thanks for your reply...
I don's see how to use that command to do this. I want to run commands like "HOSTNAME", "wmic bios get serialnumber" and PUT the result in a text file. Can I do that with FOR command? Quote from: FahadOnline on December 28, 2010, 03:35:17 AM

Thanks for your reply...
I don's see how to use that command to do this. I want to run commands like "hostname", "wmic bios get serialnumber" and put the result in a text file. Can I do that with FOR command?

Study carefully the command and all will be CLEAR. I only told you about it 17 minutes ago. Read, learn, consider and practise.

Please show your command in a script and I will try to help.

Please show your command in a script and I will try to help.

Quote from: FahadOnline on December 28, 2010, 03:07:53 AM
Is there any other way to extract the output of a command in batch file to txt  without using >file.txt

Thanks
no, in batch, to write to a file, you have to use the output redirection operators,  >> (append mode) or >.  Even if you use the for loop to get the output of the command, if you want to save the output to a file, you will still need the redirection operators.

Most programming languages other than batch,  will have file i/o facilities for you to open a file handle, write to it, and closing the file handle after writing.
409.

Solve : Finding file in C:\ drive?

Answer»

How could you have a batch file that can start a program that's placed ANYWHERE on the User's account?

For example if someone moved a .txt file to "C:\Folder" (and i didn't know), in a batch file how could i make it search everywhere for that specific file.

I know how to locate a specific file when i know where it is Code: [Select]start /d "C:\Folder" file.txt so this isn't what i'm asking ^. Thankscd /d C:\ & for /f "delims=" %%A in ('dir /b /s "file.txt"') do start /d "%%~dpA" file.txt
Code: [Select]echo off
CD \
dir /s %1


C:\test> findtxtfile.bat  file.txt
 VOLUME in drive C has no LABEL.
 Volume Serial Number is 0652-E41D

 Directory of C:\folder

12/27/2010  04:22 PM                 7 file.txt
               1 File(s)              7 bytes

     Total Files Listed:
               1 File(s)              7 bytes
               0 Dir(s)  290,484,391,936 bytes free
C:\> cd  test

C:\test> findtxtfile.bat  *.pdf
 Volume in drive C has no label.
 Volume Serial Number is 0652-E41D

 Directory of C:\Program Files\Adobe\Reader 9.0\Reader

05/13/2008  02:13 PM           353,321 PDFSigQFormalRep.pdf
               1 File(s)        353,321 bytesBill: read the requirements listed. You'll find that dir /s does not meet them. Quote from: BC_Programmer on December 27, 2010, 09:29:31 PM

Lela: read the requirements listed. You'll find that dir /s does not meet them.

I believe you are right.  The Original Poster and all interested readers will use your solution.I could not find the BC solution of how to find a file?Billrich destroys another thread.
Quote from: Salmon Trout on December 27, 2010, 05:46:16 PM
cd /d C:\ & for /f "delims=" %%A in ('dir /b /s "file.txt"') do start /d "%%~dpA" file.txt

The above is  a sophisticated solution to a very simple problem.


KISS  ( Keep It Simple Sam )

cd \
dir /s file.txt Quote from: GingerRogers on December 28, 2010, 01:45:57 PM
The above is  a sophisticated solution to a very simple problem.


KISS  ( Keep It Simple Sam )

cd \
dir /s file.txt

... and comes back and does it again. Ginger, why did you stop dancing with Red Adair?*

You have not understood the OP's question: find the file and start it, supplying its folder name as a parameter to the start command.

*Yes, I know...
Probably time to lock. If the OP wants to use my script sample and has queries they could PM me.

This Billrich problem really needs sorting out.

Quote from: Salmon Trout on December 27, 2010, 05:46:16 PM
cd /d C:\ & for /f "delims=" %%A in ('dir /b /s "file.txt"') do start /d "%%~dpA" file.txt

This works great, but it does take a while :/


Quote from: GingerRogers on December 28, 2010, 01:45:57 PM
The above is  a sophisticated solution to a very simple problem.


KISS  ( Keep It Simple Sam )

cd \
dir /s file.txt

This one locates the directory of the file but how could you make it open it up once it has found it?When a text file is at commamd prompt or on a line by its self, notepad will open the file automatically

Code: [Select]echo off
cd \
dir /s /b %1
dir /s /b %1  >  c:\test\displaytxt.bat
cd  c:\test\
c:\test\displaytxt.bat
Output:

c:\test> findtxt.bat  file.txt
c:\folder\file.txt

c:\test>
One line vs. six lines...hmm, they both do the same thing, but one line is better. Quote from: Helpmeh on December 28, 2010, 08:10:35 PM
One line vs. six lines...hmm, they both do the same thing, but one line is better.

Are you sure?

The original poster mentioned how slow the one line is. Quote from: Teacher on December 28, 2010, 09:13:17 PM
The original poster mentioned how slow the one line is.

Dir /s on the system drive is going to be slow whichever way you package it, Bill. Why haven't you been banned YET?

410.

Solve : Sequential Execution of batch files?

Answer»

Hi,

I want to execute a series of batch files, each accomplishing a different task based on the success of the PREVIOUS one but for some reason the execution is stopping right after the first one in the below code:

Code: [Select]ECHO OFF
REM========================================

REM ====================================================
REM 1) Execute First Batch
REM ====================================================

pushd "D:\temp"
sample1.bat
popd

if %errorlevel% neq 0 (
  echo sample1 failed to execute successfully
  GOTO EXITERROR ) ELSE ( goto step2
)


REM ====================================================
REM 2) Execute Second Batch
REM ====================================================

:step2

pushd "D:\temp"
sample2.bat
popd

if %errorlevel% neq 0 (
  echo test2 failed to execute successfully
  goto EXITERROR ) ELSE ( done
)


REM ==================================
REM ERROR Code
REM ==================================
:EXITERROR
Please can you help?

Thanksyou have to use CALL to execute a batch FILE and have it return to the calling batch; "call sample2.bat" instead of "sample2.bat" for example.Thank you..It works

However when I try to put the error messages in a log file by giving

Code: [Select]SET log=\temp\sample.log
and redirect

Code: [Select]if %errorlevel% neq 0 (
  echo sample1 failed to execute successfully >>%log%
  goto EXITERROR ) ELSE ( echo done >>%log%

I am not seeing the sample.log file in the temp folder. How do I create a common file for log and append it with every message in my bat file?

411.

Solve : Mandatory reboot, stuck in A:>???

Answer»

A moms computer question.....  She downloaded something pertaining to accesing and Ecard online, and it asked her to reboot her computer.  Apon POST she was stuck in dos at the A:>??  Nothing worked, no cd's ( changing Dir) couldn't get to start windows.  It did suggest a few things from a list, but nothing WOULD work.  Almost as if there was nothing there on the hard drive.  Trying to boot from a recovery disk didn't even work.  I am sooo lost.  This is way past my experinces.  Can someone atleast point to a direction of releaf?? lol

ChearsI wanted to add that my mom is good about updating her antiviris software and does REGULAR scans as needed and not.  but it is my consern that this last download may have been a viris, but i would of thought the viris software, (norton) would of picked up on it through the download process, Im not very familiur with nortons can procedures in that in may not have an automatic scan process after internet downloads,

--thanks againHave you CHANGED something in BIOS? (boot-up order?)
Did you check that the hdd is still marked for boot there?
At boot, it freeze asking a disk (a: ) or writes something about windows starting?

If you are a little comfortable with computers, did you open the case, unplug the power cord from hdd and plug on again? The same with the data cable.
Operating system? What file did you download? Do you get stuck on the A: prompt upon normal boot-up? Does it boot-up normally up to that point? What happens when you type c: (or your main harddrive's letter) can you access it? If you can, type win. If that doesn't work, try scanreg /restoreI think it was a virus/worm/trojan It doesn't ALWAYS matter how often you update your VIRUSES. USUALLY it does, but not EVERY time... Was the virus protection on auto protect?

[glb]FLAME[/glb]

412.

Solve : how can I connected to another machine??

Answer»

Hio...
how can I connected to another machine with USERNAME and PASSWORD...

I need assign a BAT file to 5 PC's with WIN 98 to share my Printers but each time when they restart their PC I must type the USERNAME & PASS.

How can I ?

Happy HollidaysIs this a P2P netwrok that you are trying to SET up, or a home network?

[glb]Flame[/glb]yeah!...  I'm using WIn 2000 Prof in my Office and Pc's are using Win98...  I'm the administrator of the server.Well then, you should be ABLE to connect using ethernet cables correct?

[glb]Flame[/glb]yes.... well, I just need LOG IN from the pc's to my SERVER without type the USER NAME & PASSWORD...

?But when the PC(s) are connected to the network,  you SHOUD have access to the network..... It appears as a folder in my computer if I'm correct...

[glb]Flame[/glb] Quote

But when the PC(s) are connected to the network,  you shoud have access to the network..... It appears as a folder in my computer if I'm correct...

[glb]Flame[/glb]


okey...
IF I TRY IN WIN 98 WITH...  \\SERVER\LASERJET1

I NEED TYPE A USERNAME & PASSWORD     RIGHT?....

 I WANT FIX THIS STEP AND "LOG IN" FROM A WIN98 WITH A BAT...

it is home network
from xp. laptop to Me. desktopArman..... This is an office network..... I think you have the wrong forum...  

[glb]Flame[/glb]how is this setup?.....dcc.....or ics?lan based vpn?more info needed to SOLVE this riddle..I use Win 2000 in a Symple LAN...
I need share my printers with 5 users (they have WIn98....) each time when I restart my Server I need LOG IN again & again in each terminal with win 98.


hibernate the server.......go into the my network places icon and use the wizard to setup printers files etc...a server should not really be switched of! that what it does serve??
413.

Solve : Extra code in FOR/IN/DO command?

Answer»

Hope someone can help..I know some batch programming but I have recently had a batch file that had the following code   FOR  /F "tokens=1,2,3* delims=   " %%A  IN (%userdata%)  Do echo %%A  in a FOR/IN/DO command...... can someone explain what does /F "tokens=1,2,3* delims=   " do and where to find reference to this extra code...I have the book Special Edition Using DOS 6.22 2nd Ed but can't seem to find it ANYWHERE??? Thanks from what i can gather is renames a FILES to the date/time..Thanks for the response but I get the feeling that the bit of code I referred to has something to do with the FORMAT of the file read in?? Anyone??info&GT;>>have a look under for>>>>>.http://www.plympton.info/personal/doscommands.htmlThanks for that REPLY... that explains the goods. Looks like I need a DOS book that covers Windows NT to get info on Command EXTENSIONS and how to ENABLE them!!
Thanks again and have a safe and enjoyable festive season!

414.

Solve : Batch files & my network?

Answer»

I have a question about a network and a batch file...
I Need to know how to run a batch file on every computer in a network, If possible Please tell me where to place to file and what to do..
Thank you,

I appreciate your help

Me,Would every time a network computer starts up do? If that is the case, on the root directory of the main drive, edit autoexec.bat or create it if it does not exist (backup first if it exists!) and add a line, USUALLY at the bottem will do, to load your batch file. The autoexec.bat file is automatically ran each time the computer starts up.

If you want the batch file to load inside Windows at BOOT up, add it or a shortcut to it in the START > PROGRAMS > start up folder.

If you want it to run periodically, try adding it in the task scheduller.

Any help?

415.

Solve : Task Manager open?

Answer»

Does anyone KNOW how to open the task manager with the command prompt window? Any help would be greatly appreciated.

ViperWhy? Ctrl + Alt + Delete doesn't WORK? That should BRING up the task manager...

[glb]Flame[/glb]Just type
Code: [Select]taskmgr
Make sure that
Code: [Select]C:\WINDOWS\system32
is in your Path environment variable.

Cheers, cs
Try "taskman"oookkk..... Did any of our SUGGESTIONS work? lol

[glb]Flame[/glb]

416.

Solve : Partitioning Problem?

Answer»

Any One Help me

yesterday i DECIDED to Partition my Hard Disk Drive. i faced the below Problem.

i booted computer from Cd room, then i typed Fdisk command,
after displaying partions, there were only two partiton (Primary 5% and Extend 95%) and there wasn't any non dos partiton, when i was deleting the Logical Dos drives, it replied there isn't any logical dos drive, then i went forward , i decided to delete Extend dos partitions, it replied when u have Logical Dos drives u can't delete Extend Dos Drive, even there isn't any logical and non dos partions. this was my headacheYour partitions were created by xp or w2k.My Partitions were created through Dos.Fazelqadir.......perhaps you could tell us exactly what it is your trying to do ......The operating system information would be of tremedous help to us .
The problem we have is.... while there are some very knowledgable people on this forum......I don't recall a single mind reader in the lot ........So we have to rely on you .

let us know

dl65  DEAR:

now i don't have any os installed on my system. i had windows xp2004 on my system and it have been corrupted. also my system infected by virus. due these problems i tried to REPARTITION my Hard Disk Drive. to solve my problem. but unfortunately the above problem occured. that i mentioned in my FIRST post. hope u people help me in this issue. it would be ur most kindness. thanksRead this.

417.

Solve : 1 simple question about a batch file.?

Answer»

Hello,

I have made a batch file that starts up a mp3 song.
But now I want it to close when the song has finisht playing.
So when the MUSIC file has stopt I want the MEDIA player to quit.

I that POSSIBLE in the same batch file?How did you get the mp3 to play? I was unaware they could be played in DOS... at least not without special software. As to your problem, I do not THINK it is possible, especially if it is a Windows program.Sorry, I FORGET to tell that I'm working on windows XP.

It sounds stupid why making a batch file on XP, but its for something special.

I have read somewhere that the command for to close something is /CLOSE.

But I cant use that command to close my music file.

I am trying to close the complete media player with that command, but that didn't work either.

Maybe this is the right command, but I'm using it wrong.

418.

Solve : How to get out of MS Dos mode?

Answer»

I have an HP Pavillion, Windows 98.  I restarted my computer in the MS Dos mode accidentally.  I have typed win and it ASKS if I want to GO to the Windows Application, I enter to accept.  It reboots and COMES up back in the MS Dos mode.  What command do I need to type to get back to windows applications?  either cls    or exit  typed     after the c:\windows   prompt

419.

Solve : get file name in ms-dos batch program?

Answer»

hi? how are you?  
I want to get file NAME in ms-dos batch program  
but I want to apart of file name.  
for example,    
 
   c:\kk\20041220\CGAA0_ROLE_20041220.txt  
     
---&GT; I want to get  " CGAA0 " then  
 INSERT below variable XXX  
 
ECHO open 111.111.44.78 > FTPHEAD.SCR  
ECHO lsy>> FTPHEAD.SCR  
ECHO lsy01>> FTPHEAD.SCR  
ECHO bi >> FTPHEAD.SCR  
ECHO hash >> FTPHEAD.SCR  
ECHO prompt >> FTPHEAD.SCR
 
ECHO put  XXX_ROLE_20041220.txt >> FTPHEAD.SCR  

ECHO bye >> FTPHEAD.SCR  
ftp -s:FTPHEAD.SCR > Dashboard_Log_quit_20041220.logTry something like this:

CODE: [Select]set v=c:\kk\20041220\CGAA0_ROLE_20041220.txt
for /f "tokens=4 delims=_\" %i in ("%v%") do echo %i
The for loop breaks the variable v into several pieces, separated by either _ or \. It then assigns the 4th piece to the variable i.

Good luck,
[GLB]cs[/glb]Remember in DOS, filenames are limited to 8 charectors in length, plus 3 for an extention.

420.

Solve : change icon of batch file?

Answer»

how to CHANGE ICON of BATCH file in win2kMake a shortcut to it and change its icon. How to change a batchfile's own icon... I do not THINK it is possible.

421.

Solve : Extraction of path extensions in FOR loop?

Answer»

Hi *,

I am trying to loop over all path EXTENSIONS with a FOR command (W2K):

Code: [Select]for /f "eol=;" %i in ("%PATHEXT%") do echo %i

I thought FOR would loop over all LINES and if I declare ';' as a LINE separator, it should work. (Of course, it does not.) I can also not use

Code: [Select]"DELIMS=;"

as I don't know how many path extensions are defined.

Any idea?
Thanks,
CSGot it   It works with

Code: [Select]set P=%PATHEXT:;= %
for %i in (%P%) do echo %i

422.

Solve : assign variable name to file?

Answer»

Hi, i want create a simple text file with MD, i would like to assign a specific name, example:

MD testfile_041221.txt

041221 is the variable name for a current date

can you help me to run this?
Thank youAssuming that

Code: [SELECT]echo %date%
RETURNS Mi 2004-12-22
just extract the numbers like:

Code: [Select]set d=%date:~11,2%
set m=%date:~8,2%
set y=%date:~5,2%

and compose your file name:

Code: [Select]md testfile_%y%%m%%d%.txt
The representation of the date might be different on your PC, depends on your regional options.

Cheers,
[glb]cs[/glb]Hi, thanks for a reply!!!
I tried your solution but don't run nothing
Have a idea why?
SORRY for my question but is my first time to make a batch fileOK!!!!!!!!!!!!!!1
Thank you very MUCH!!!
I tried and retraied your solution and at the and I understended the operation, the code is:

echo %date%
set d=%date:~12,2%
set m=%date:~7,2%
set y=%date:~4,2%
copy con testfile_%y%%m%%d%.txt

I substitute MD with COPY CON for create a file but is not important because my file will be CREATED by wzzip.
Thanks a lot

423.

Solve : how to get file name in ms-dos??

Answer»

hi? how are you?
I want to GET FILE name in ms-dos batch program
but I want to apart of file name.
for example,  

   c:\kk\20041220\CGAA0_ROLE_20041220.txt
   
   ---> I want to get  " CGAA0 "

so I INSERT to below variable ???

ECHO on
Set CURRDATE=%TEMP%\CURRDATE.TMP
DATE /T > %CURRDATE%
Set PARSEARG="eol=; tokens=1,2,3,4* delims=-,/,월,화,수,목,금,토,일 "
For /F %PARSEARG% %%i in (%CURRDATE%) Do SET YYYYMMDD=%%i%%J%%k
cd %YYYYMMDD%
ECHO open 111.111.44.78 > FTPHEAD.SCR
ECHO lsy>> FTPHEAD.SCR
ECHO lsy01>> FTPHEAD.SCR
ECHO bi >> FTPHEAD.SCR
ECHO hash >> FTPHEAD.SCR
ECHO prompt >> FTPHEAD.SCR
ECHO put  ???_ROLE_%YYYYMMDD%.txt >> FTPHEAD.SCR
ECHO bye >> FTPHEAD.SCR
ftp -s:FTPHEAD.SCR > Dashboard_Log_quit_%YYYYMMDD%.log



  uuuummmm....... WHAT?!  

[glb]Flame[/glb]hi? how are you?
I want to get file name in ms-dos batch program
but I want to apart of file name.
for example,  

   c:\kk\20041220\CGAA0_ROLE_20041220.txt
   
---> I want to get  " CGAA0 " then
      insert below variable XXX

ECHO open 111.111.44.78 > FTPHEAD.SCR
ECHO lsy>> FTPHEAD.SCR
ECHO lsy01>> FTPHEAD.SCR
ECHO bi >> FTPHEAD.SCR
ECHO hash >> FTPHEAD.SCR
ECHO prompt >> FTPHEAD.SCR

ECHO put  XXX_ROLE_20041220.txt >> FTPHEAD.SCR

ECHO bye >> FTPHEAD.SCR
ftp -s:FTPHEAD.SCR > Dashboard_Log_quit_20041220.log

424.

Solve : how to open the print dailog for IE?

Answer»

Hi all
i am developing an application that creates HTML FILES and other types of files i want the application to PRINT directly these files....

i can OPEN the generated HTML file USING (start [filename]) in the CMD but i cant open the IE printers dailog.

can any one help me to print the HTML files....

Thanks in advanceif you are printing from dos you might have to set your printer software to that mode :-/i dont think that i want a command like in acrobat reader (/p) to open the printer dialog for IE or like /mprint for the MSwinword please if any one knows the solution for printing HTML mail me at [email protected]
Thanks in advance

425.

Solve : Setting File Pointer to BOF from Batch File?

Answer»

I have searched the site using the string "dos batch bof eof" without success.

I have recently ARRIVED at batch files and am progressing with the help of some excellent web sites but I haven't found an answer to this one. Can anyone help please?

I have a batch file which copies some files as a backup measure. On completion it makes an entry in a log file. The most recent entry is PLACED at the end of the file. It would be better for me if it was at the BOF.

How do I do this please? I look forward to hearing from you - many thanks.

[glb]ScriptHam[/glb]       :-/Batch files don't have BOF and EOF pointers so you will have to do a little work around. In your .bat file, before it writes the entry to the LOGFILE, if exist logfile.txt ren logfile.txt logfile.old. After it writes the entry to logfile.txt copy logfile.old >>logfile.txt. Then del logfile.old. The newest entry should always be at the top.

Test the batch file FIRST, before applying it to your existing logfile. You can always delete any extra files but might not be able to recover your logfile if something goes awry. 
Thanks very much.
I can see that this will work. But at the moment it just KEEPS the most recent entry in the log file. I will need to troubleshoot it a bit. Will leave until Monday now.

Thanks once again for the prompt reply.

[glb]ScriptHam[/glb]It didn't quite work at first. What was needed was the concatenation script e.g.
Code: [Select]copy /B /Y H:\log.txt + H:\logold.txt H:\log.txt
in place of the redirection script
Code: [Select]copy /B /Y H:\log.txt >> H:\logold.txt
Other than that all went perfectly, thankyou very much.
Many thanks to you and my compliments of the season - have a good one.
Kind Regards
ScriptHam

426.

Solve : Truncating in a batch file?

Answer» HELLO. I am trying to figure out how to TRUNCATE a variable to only 8 CHARACTERS.  I need to be able to assign only the first 8 characters of %username% to a variable in a batch file.

Does anybody have any IDEAS?  It shouldn't be that hard, but I can't seem to find any information about it.Try this:

CODE: [Select]set t=%USERNAME:~0,8%
Cheers,
[glb]cs[/glb]
427.

Solve : Error message in a batch job?

Answer»

I MAKE same VBA transaction written in a “word.doc”. I start this word.doc in a BATH job.
How can I route the return code of the VBA to the bath job back?
(For EXAMPLE If the VBA was not complete I should end  the batch job with a return code > 0)
thank you: László

428.

Solve : XP DOS uppercases diskette file names?

Answer»

  • Files transferred between my Win98 and XP machine via diskette via DOS are FORCED upper CASE by XP.  A dir shows them lower case on XP but upper case on 98.  I've reformatted the diskette with XP to AVOID a possible FAT problem and the problem persists with both COMMAND.COM and CMD.EXE.  Any help would be appreciated.
429.

Solve : Starting a bathc file at every start up??

Answer»

I have a question.... ?... I would like to start my batch file at the start up of my computer each time I turn it on.. ? what command would help me do that..? If not a command then Help me with what i need to do.... thank you very MUCH..You can PUT a "Call" STATEMENT in your autoexec. bat file.

Ex: Call mydrive:\myDir\myprog.myextension

The autoexec file is run during DOS system STARTUP. If you don't have one, create one and put it in your root directory.

430.

Solve : Deleting Profiles with a Batch File?

Answer»

I was looking for a solution to my problem on DIFFERENT websites and I couldnt find ANYTHING useful so I figured I would see if anybody knew how to here. Im running Windows 2000 Professional and I would like to know if anybody KNOWS how to DELETE user profiles but leave or copy certain ones back. All Users, Administrator, and src are the folders that I dont want DELETED. If anybody could help it would be much appreciated ^_^

431.

Solve : ipconfig /renew error?

Answer»

Hey all,

I have run into a snap with renewal of ip for my local area NETWORK.   It as of now has a 169. ??   made up IP that won't release which makes some sense, but when I renew I GET............."the following error occured when renewing adapter Local Area Network.  An Operation was atempted on someting that is not a socket."   Any thoughts,   all connections appear to be linked ETC......

thanks

cramerread OISA  SOLUTION is seems to have worked>http://www.tek-tips.com/viewthread.cfm?qid=337688&page=1

432.

Solve : Extracting a number in an XML string??

Answer»

I've been playing with SUBSTRING and for LOOPS with no luck so far.  How do you EXTRACT a number inside an XML tag.

example:
132

All I WANT to do is set the numeric (1 or more digits) to a variable

set VER_NUMBER=132


Thanks in advance.http://www.angelfire.com/biz/rhaminisys/tagcheck.html

433.

Solve : config.sys help?

Answer»

I have DOS 7.1 and have gone to their site to try and find out how to edit config.sys but I couldn't figure it out.

I need to add two lines to it.  If someone could tell me in a SIMPLIFIED manner how I MIGHT go about doing this, it'd be great.

I also don't KNOW how to edit or copy from and paste into text files.  This would be helpful as I have a file that has the two lines in it if I wanted to easily add onto the config file.At the c:\ prompt, type edit config.sys<enter>
You cannot cut and paste in DOS unless you have a utility that permits it. You will have to do your editing manually. Cut or Copy and Paste is a function of the Windows clipboard.thank you much.

how do I save and exit out of config?Press the alt key to activate the menu bar. You can navigate with the arrow keys or simply press the highlighted letter for a particular function. F for file drop down menu. Select save. Do it again and select exit.Alternatively you could install DOS mouse drivers.

http://cutemouse.sourceforge.net/

Add a line in your autoexec.bat to make it AUTOMATICALLY load.

434.

Solve : dos games won't work second time?

Answer»

I have Doom, Rise of the Triad(rott), and Duke Nukem 3D.  I go to run Doom for the first time, and it works fine.  Then I install and run Rise of the Triad and it works fine.  When i go to run Doom after this, it won't play and says "Game mode indeterminate".  After this I try to play rott but it won't play and says "W_InitFiles: no files found".  If I install doom again, i can run it just fine till I try to run rott.  Duke Nukem will run no matter what, but if i install doom, run duke, and then try to run doom it won't work etc.

I don't understand this.  I WANT to just have to install a game once and run it fine always.  Any help would be great.http://www.softpedia.com/get/CD-DVD-Tools/Virtual-CD-DVD-Rom/Fantom-CD.shtml  or try an emulator.>>.http://sourceforge.net/projects/dosbox/.or just drag them to the hard drive..create a folder.......gamesi appreciate this but i'm running off dos 7.1 as my only os.You mean no Windows at all?? If you want a DOS machine, I'd try installing Windows 3.1 which is super dos compatable (ASSUMING your hardware is). In the good old days, gamers flipped between dos and Windows with the blink of an eye.if there is no way around this problem, then my very last resort would be to install win 3.1.  But where could I get that?this will run on dos7.1>http://www.vmware.com/download/sorry but unless this problem is unsolvable, I'm not going to spend money on these problems

Is this problem unsolvable?OK...  i still had the problem when I installed win 98, but only for rott this time.

I tried dosbox on my xp pc but can't stand it for itself not to mention the fact it runs like a snail even if I use the settings to increase speed.

So i uninstalled the 98 on my other pc and am back to dos 7.1.  The problem still exists.  There must be some way to fix this.

I would be willing to use windows 3.1 but I don't know where I can find it for free, and I'm not willing to spend money on a problem that can be solved otherwise, and I know that if this couldn't be solved then gaming in dos would have died a long time before windows came along.

please help me out here.  I've gotten a lot of help from this site in the past and have found if you guys don't know how, nobody that I know of does.What problems did you get in Windows 98? Did the games run at all? I have gotten Duke Nukem 3D working in 98.

For DOS box, what settings did you CHANGE? You can use frameskip to lesson demand on your computer and you can get it into full-screen mode you know. What is your computer's specs?

If the games don't even work in pure DOS, then maybe your computer's hardware is not DOS compatable.

What actually happens when you try to run the games. Do they just not work? Do you get errors?

For Windows 3.1, you might find it for free on the Internet but even though it's age old it's still illegal to download it for free. You should be able to find it on EBAY... but that will cost money.I've figured it out.  Kinda stupid really.

when I exited out of either rott or doom, the ChDir would chang back to c:\  But when I exited out of duke3d, it would be at c:\duke  so i just typed in cd c:\doom_se and then c:\doom_se\doom and it worked fine.  I just had to have the chdir set to the program's immediate directory.Do you know how to navitage your way around DOS properly? eg difference between cd xxx and cd\xxx? If not I could write a short tutorial.

435.

Solve : Weird error message...????

Answer»

Hi there... I know next to nothing about computers... There's what I assume to be an error message that keeps popping up on my screen that reads "C:\WINDOWS\SYSTEM32\AUTOEXEC.NT. The system file is not suitable for running MS-DOS and Microsoft Windows aplications. Choose 'Close' to TERMINATE the application." When I hit "close", the message goes away for maybe 10 or 20 seconds, and if I hit "ignore" the same thing happens... this doesn't seem to be getting in the way at all... EXCEPT the error message can't be put into the background... I just have to drag it off the screen and leave it... any SUGGESTIONS WOULD be appreciated.Go to this site: http://support.microsoft.com/default.aspx?scid=kb;en-us;324767 .... When it says to insert the "CD", it wants the Windows CD.... LET me knw if you have any questions....

[glb]Flame[/glb]

436.

Solve : Phantom Directory Name?

Answer»

operating system Win2k

I have the following situation that has me stumped. I have limited DOS knowledge.

Each day I receive files that are ftp'd to my company in which the name of the directory is different with each ftp session. The format of the directory name is yymmdd_hhmmss where:
yy = year,
mm = month,
dd = day,
hh = hour,
mm = minute
ss = seconds

This is the date &AMP; time the session took place.  i.e 041214_132546

I need to be able to have a batch file capture the name of the directoy, so all the *.pdf files contained in that directory can be copied to another directory whose name changes monthly.
The target directory path would be YYYY\MM. where YYYY = the current year and MM = the number of the current month.
Each YYYY directory would have 12 subdirectories 01 - 12.  i.e. 2004\12

currently I am using the following, but this method is prone to typing errors.and has to be CHANGED for each use.


dalycopy.bat 041214_132546 12
copy I:\from_ftp\%1\*.pdf I:\pdfs\2004\%2
exit

I would like to be able the have the batch run without HUMAN intervention.

ThanksTry putting it in the TASK schedualler.http://www.robvanderwoude.com/index.html

437.

Solve : Batch File Leaves Boxes on Desktop After Exit??

Answer»

OS is Win98SE

I keep getting disconnected from my DSL connection when I am not using it for awhile (dynamic IP), so I wrote the following file to reconnect:

echo off
cls
winipcfg /release
winipcfg /renew
exit

Now this does the job fine, *but* after exiting, there is a gray pop up box on the desktop with an "OK" BUTTON that I must click twice to clear the desktop.  (It says "usage" in the two little boxes that come up in the taskbar and clicking the OK's removes them one at a time).  

Now what do I do get it to exit cleanly?  I have not run into this problem before with desktop MS-DOS files . . .  :-/

Thank you.

KarlChange the the batch file to use the DOS VERSION instead of the windows version:

ipconfig /release_all
ipconfig /renew_all

Issueing the proper commands should get rid of the "usage" boxes.Thank you.  That left an open window on the desktop that I had to close, so I changed the code to:

ipconfig /release_all
ipconfig /renew_all
echo off
cls

And that works perfectly.

This is really great; even my previous inferior one beat the stupid "support tool" provided by the ISP because it took forever to load and make the reconnection, but I knew there must be some way to get rid of clicking out of the boxes.

Thank you for the input!

Karl   help someone tell me somje software questions with answers and i need 3 questions on systems life cycle?

help!!!!!!!!!!!!!!!!!!2k dummy:  You said: "Change the the batch file to use the DOS version instead of the windows version:"  

After thinking about it over nite, I got to wondering; what do you mean by this?  They are both running in MS-DOS windows, so what is the difference.  Could you educate me a little on this?  

Thank you very much.

Karlipconfig was written to run under true DOS. It can be used in DOS or from a command prompt in Windows. winipcfg was written as a Windows app and intended to run under Windows. The "usage" boxes that you were getting were, in fact, error messages telling you that you were running the command inproperly. Windows was being polite and allowing you to execute the commands anyway (a rare thing in Windows ). As for closing the DOS window, Windows will close it automatically for you if that is selected in the properties dialog under the program tab. Try running winipcfg from Start/Run and look at the information it displays.Well, all it does is display the DNS numbers, etc., in a box that comes up when I run it as a command, and then gives me the OPTION of renewing, etc.

What do you mean  "As for closing the DOS window, Windows will close it automatically for you if that is selected in the properties dialog under the program tab."  

What program tab are you referring to?

(Please excuse my ignorance; I have always run batch files in true DOS before which requires the computer to reboot on exit, and I don't know what I am doing trying to run it from the desktop in MS-DOS window . . . obviously!)

Thank you.

Karl   In Windows explorer, or from start/find, locate your batch file. Right click on it and select send to/desktop as shortcut. This will place a shortcut on your desktop. Right click on the shortcut and select properties. Under the program tab, you can choose to run it in a NORMAL window, maximized, or minimized. You can put a check box in the "close on exit" box to have Windows automatically terminate it after it runs. A double click on the shortcut is all it takes to run it.OK, I see what you are talking about.  I recreated the orginal one to see what would HAPPEN with the close on exit box checked, but it still behaves the same way with 2 usage boxes that have to be OK'd out of . . . ?  

Guess it just really does not want to run properly.

Very glad you told me how to code it properly last nite!

Karl

438.

Solve : help software??

Answer»

hey well im up in a lesson at the mo tryin to sort out this software QUIZ can NE1 tell me some QUESTIONS and ANSWERS http://computer.howstuffworks.com/software-channel.htm

439.

Solve : Language commands....?

Answer» HMM.. i seem to be having a problem....i am trying to program my keyboard language to whatever language.. i have tryed a few.. I typed in the command.. and i got the MESSAGE "Not a recognizeable command" with is not my problem.. Then i typed in the whole path, to where i would find the settings for my languages. and it seemed ti work.. because no message popped up.. and i am posative i am usuing the right command.. but nothing happens... No changes have been made.. I restarted my comp. THINKING it would work.. But it didn't... thanks alot for the help... ( I got this info out of a DOS manuel ) so i am PRETTY sure it is right... I am just doing something WRONG... thanks,

Me.http://academic.cuesta.edu/rsutter/keyboard.html
440.

Solve : How to use a batch to convert multiple files?

Answer»

How to write a batch to run a program to change all the FILES in ONE folder to a different FORMAT?
For example, to change one file, I would type:
A.exe B.xxx B.yyy
I don't want to just change the extension, but have the program convert the files. 
it seems that you want to write a batch file to change a dbf file to an xls file etc

i do not  think so!Huh? I have a folder FULL of textures for a game that come in a custom format and i want to convert them to tga files to edit in photoshop. The conversion program works from the command line only and converting 100 textures one by one would be a major pain.i could do it dbase with this sort of loop arrangement

copy all the files into a temp directory

find the first file in the new directory

exercise the command line jargon

move the NEWLY formatted file to the original directory

delete the first file

call the batch again

you will need a counter in there or else watch the dos stuff till you get error messages.

- i am sure there is a better way, but this will probably work


441.

Solve : batch file output to screen and text file?

Answer»

Hi,

I'm TRYING to create a BATCH file that can send the output to the sceen and the same TIME create a text file. When I send the output to a text file, the screen output won't appear??

(
ipconfig/all | find "IP Address"
ipconfig/all | find "Subnet Mask"
ipconfig/all | find "Default Gateway"
ipconfig/all | find "Host Name"
) > logfile.txt
pause

THANKS in advance.No, if you redirect your command output to a file, the output of the command will not appear on the screen.Just add another line to your batch file.

type logfile.txt

This will display the CONTENTS of the text file.It works!! Thanks

442.

Solve : Close MS-DOS Window while executing application?

Answer»

Hi,

I have a problem CLOSING an MS-DOS windows.  I use a batch file to start an application.  This MS-DOS Window stays there until I close the application that the batch file starts.

Any ideas?Right click - select PROPERTIES - click program TAB. On the line that says "run" - select run minimized.the run minimum thing WORKS but you still have a tab on the bottom of the screen

in window 95/98 if you are using that

make a DESKTOP shortcut to your batch file
right click on the icon

go to properties
then second tab..program  check in the little boxthat says close when done.
(if your program is still running that the batch file executed, it will not close)

443.

Solve : shut down time?

Answer»

this is how i called a program to stamp the time i opened my computer session
 in my autoexec.bat file

doskey
call c:\logagin.com
win


I used a program called bat2exe.exe
to CONVERT this to the logagin.com

ECHO. |TIME > TIME
COPY LOG +TIME


what i want to KNOW is how to stamp the time again when i close down the sessionYou would have to shut down from a script (in WINDOWS 98, make a shortcut with your desired RUNDLL32.EXE and other commands) instead of from the 'START Menu'...

I use rundll32.exe user.exe,exitwindows in a shortcut to shut down instead of having to use the Start Menu.

444.

Solve : Accessing c:?

Answer»

hi how can i ACCESS c: from does? i tried USING a winxp BOOT disk and reach till a: and then i try to access c: and it says invalid directory..Which OS are you using?TYPE c:
Do you know basic dos commands?start
run
 type and enter command
 type and enter   cd  c:\ sorry an error

after you type command

type and enter   cd c:\

445.

Solve : MS DOS Boot disk?

Answer»

I am trying to create a boot disk with a menu. The code I have seems to work fine on my 2000 desktop command prompt, but when I make a boot disk and try to run the same menu it starts ok, but fails shortly there after.
Any IDEAS?
Thank youdo you receive any messages or it justs go of the screen MAYBE the end part of the code does not have  time delay on it.......you may find something here to help you>http://www.robvanderwoude.com/index.htmli think you may have a problem with a menu in win2000 as i understand it win2000 has no DOS (i read that somewhere) and the menu you are trying to get to run has no DOS to run it.

if i am wrong about this, i would APPRECIATE it if SOMEONE would correct this response

446.

Solve : Switch to administrator in batch file?

Answer»

I'm trying to make a startup batch file to open a PROGRAM from all users in my SCHOOL district.  The problem is I have to be administrator in order to install the program.  Is there a way to switch to administrator from within a batch and switch back while the computer is LOGGING in?

Any help would be greatly appreciated.I would also like for it to notify me by email which computers have been fixed and I would like a way that it could check to see if the program has already been run before.

Thanx,i BELIEVE the WHOLE idea of having an administrator is to prevent users from issuing system wide commands.

speak to your administrator

447.

Solve : MS-DOS FTP ...how to configure FTP transfer rate??

Answer»

Hi How are you?
I WANT to KNOW how to configure DOS ftp transfer SPEED?

I want to configure 2000kbps for transfer speed.

Could you please teach me ,,,Please....

I appreciate that.http://www.window95.com/internet/ftp.html

448.

Solve : Files older than supplied date?

Answer»

I need advice on how to create a bat file that will find files LESS than a specific date (date to be passed as a PARAMETER) for a specific directory and all of its'  subdirectories.here is a beginning thought


dir  /a /od will GIVE you a list of files in a directory sorted by date

dir  /a /od > filelist will produce a text file called filelist
that will show you the list of files in a directory sorted by filedate

dir  /a /od /s > filesub will produce the directory with all the dates in date order plus those in subdirectories

i am not SURE if this will solve your problem but it should helpActually, what I need is within a bat file to be able to access the file date and programmatically compare that to a particular date ENTERED as a parameter to the bat file.  I don't think there is a dos command that will just return the filename and date; but thought I would ask anyway.

449.

Solve : how 2 change directory if it name is j2sdk1.4.2_04?

Answer»

please send me this reply as shown as possible

i want to  CHANGE the directory.i am at present in d:>
i want to change it to j2sdk1.4.2_04 ,but it is not allowing me to change the directory.so how to change itAnd where is j2sdk1.4.2_04? c:\j2sdk1.4.2_04? Or d:\jsdk1.4.2_04? Or else?
Try with \
cd c:\j2sdk1.4.2_04
or with
cd d:\j2sdk1.4.2_04 .

Type in a command prompt window
cd /?
for more help.You need to use cd j2sdk1~1
If that doesn't work try using a different number ~2. Make SURE you are in the right folder. Type dir/p to see what's there.

Viking, in DOS folders and files cannot be LONGER than 8 letters. Or at least in mine...cd "j2sdk1.4.2_04" should work if you are in its PARENT folder. DOS 7 (Win9x DOS) USUALLY accepts long file names if they're in "quotes".

450.

Solve : batch file to copy a file from one folder and past?

Answer»

Hello,

i am trying to make a batch file which copies a file from a folder in d:/folder1 , checks if a folder name "c:/someFolderName   exists or not in c drive and pastes the file in that folder.
I am NEW to making batch files.
any help?
thank you.it seems to me that you would have to know if the target folder exists, or else what is the sense of what you are doing.

if it does exist,

then  this sort of thing will work for you

copy d:\[filename.ext]  c:\[foldertarget] if the target folder exists then paste the file there otherwise, is there a way to give a warning to CALL administrator ? or just  to tell them that folder DOESNOT exist so that further actions can be taken?it seems that you are the administrator and you need to let the user place files only where they do exist or else how are you going to find them :-/echo off
if exist c:\target\nul: goto cpym
echo Target DIRECTORY does not exist, CTRL-C to ABORT or any key to create
pause
md c:\target
:cpym
xcopy d:\source c:\target /s /e
:end


Note: You can handle the nonexistant directory with just a message and goto end instead of allowing creation of the target directory if you wish, or leave off the /s /e from xcopy if you don't want subdirectories copied, or use copy and a single file name if you just want one file copied...