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.

1801.

Solve : Launch Matlab and launch commands from MS-DOS?

Answer»

Hello,
I would greatly appreciate it if someone could help me with the following problem.
I would LIKE to launch Matlab from the MS-DOS command prompt and then subsequently input commands into Matlab through the MS-DOS command prompt, such as "a=3" (I OBVIOUSLY have much more COMPLICATED commands to enter but if I can get "a=3" in there, I should be able HANDLE anything).  In the past, I used such commands as "matlab.exe < matlab_commands_file.txt", where matlab_commands_file.txt is a text file with the commands I want to enter.  This however does not work for me this time.  Does anyone know how I could solve my problem?

Thank you.

1802.

Solve : Close Firefox with a bat?

Answer»

I'm trying this

start taskkill.exe /im firefox.exe /f

but produces the instant closing of firefox and when I restart must recover the opened session.

Can I close the PROGRAM in any other way? .

I consulted the web  mozillazine for command line arguments , but only goes for initiate the firefox navigator.

Thanks
Excuse my language. I'm from CANARY Islands



I dont think you can do this in a batch file because it will alway kill the precess in the same way. Here is a similar question and one of the people suggest using a macro. It will simulate you CLICKING the X yourself and should work for you.

http://www.webmasterworld.com/forum119/9.htm

Heres a tutorial video I found on youtuve FORE macro's. Not sre this is the way to go or not but...

http://www.youtube.com/watch?v=tcKnsMQsYsw

1803.

Solve : Another simple xcopy question...?

Answer»

I would like to echo the date and time to an error text file, which sends ERRORS from xcopy like this:
xcopy *.* Y:\FOLDERNAME /E /C /Y 2>>c:\copyerrors.txt

Right now it just echoes the error, not the date/time

How can I do that?

Thanks!This might work for you if you DONT Echo Off and Echo On, if you Echo off and On then remove the

echo. %date% at %time%>>c:\copyerrors.txt
xcopy *.* Y:\foldername\*.* /E /C /Y >>c:\copyerrors.txt

Warning: A cyclic copy error will show if your running this from C:\ so you may want to have it write to Y: instead of C:

1804.

Solve : xcopy for specific files and their folders?

Answer»

Greetings.

I have a situation for which I'm attempting to use xcopy (or xxcopy) to resolve, but have not yet had success with it. What I need to do is copy a series of specific files (if I am successful, this it will be 100's to 1,000's of files at a time) from different folders to a specified location. What I also need is for the directory structure (1 or 2 folders deep) to be replicated as well.

I have found instructions on using .xcf files for composing the list of files, but as of this point of time, I have not been successful in what I've defined above.

Any insights on the proper syntax, or even the ability/inability to do this with xcopy, or other means would be greatly appreciated. Thank you in advance.have you look at the help file

Code: [Select]D:\batch>xcopy/?
Copies files and directory trees.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
                           [/EXCLUDE:file1[+file2][+file3]...]

  source       Specifies the file(s) to copy.
  destination  Specifies the location and/or name of new files.
  /E           Copies directories and subdirectories, including empty ones.
               Same as /S /E. May be used to modify /T.
  /I           If destination does not exist and copying more than one file,
               assumes that destination must be a directory.
Reno,

Thanks. And yes I've been looking through many of the posts online and doing my best to decipher all the switches. What you made reference to sounds correct, but in my experience with attempting to use them, does not quite accomplish what I'm after.

For example: If I have a folder named "folder1" that contains files "a","b","c" and "d", I may only have the need for file "b". I'm currently able to copy file "b" out of the folder (and have used various switches) and to a different directory, but in doing so it does not create "folder1" and place file "b" inside of it, it merely copies file "b" to the folder I specify.

The reason I'm attempting this is a work around to a hyperlinking issue with g.i.s.. The database I'm working with has over 14,000 records in about 250 different folders and I need to maintain the directory structure for the hyperlinking to work.type:
dir/b/s file_b.txt somemorefile.txt fileiwanttocopy.txt

does the above output match your requirement for the files to copy?
and how many is the "b" condition out of the many files of a-z?Hi

The problem is not yet clear to me.

Does each of the 250 folders have 56 required files,
and are the identically same file names required in each of the 250 folders ?

If so then something like this may work :-
Code: [Select]FOR %%A IN (PATH1 PATH2 ... PATH249 PATH250) DO (
  FOR %%B IN (FILE1 ... FILE55 FILE56) DO (
    XCOPY %%A\%%B NEW\%%A\%%B
  )
)

If not then you probably have to list as 14,0000 items the complete path and file that is required

Regards
Alan
Thank you for your posts. I won't be able to experiment with your suggestions until sometime tomorrow (5/28).

In an attempt to clarify: no the 250+ folders do not have the same required files or identically named files.

I need this to work, so when I'm required to subset data, I can copy out ONLY the files (in this case image files) for the subset that I'm performing. It will change with every subset that I do.

After I perform a subset, I will be able to pull out all the paths of the files I need from the database, format them as needed and paste them into a txt file, thus my attempts at using the .xcf files with xcopy.

If you are familiar with zip utilities, you often have the option when creating the zip archive to save the directory structure in which the files you are compressing reside. In this way, when you decompress the zip archive, a directory structure is created so the files you added to archive reside within the same directory structure from which they were copied. This is the effect that I'm after.

hope this helps. thanks again.

Quote from: garv on May 27, 2009, 04:21:24 PM

After I perform a subset, I will be able to pull out all the paths of the files I need from the database, format them as needed and paste them into a txt file, thus my attempts at using the .xcf files with xcopy.
then CONSIDER it done because you already have the list of file path in a file. now need a little bit more information:
1. is this file path is full-path-name or relative-path-name?
2. would you mind to post couple of lines from the xcf file.

i am thinking to do it in a simple for loop and light-weight copy function.Thank you Reno. You give me hope. I just spent another couple hours looking for solutions and it may involve setting parameters in a batch file, but again, I'm not fully understanding what I'm seeing.

So far, I've been using full-path-names, as that is how I've been able to successfully copy files across the network.

Below is a sampling of the files I need to copy and create the directory structure for. As you can see, there are a variety of directories and only a few files from each.

"T:\! Field_Verification_Data\BW\Big Walnut27\50.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\48.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\87.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\58.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\62.jpg" "T:\! Field_Verification_Data\BW\Big Walnut101\90.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\70.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\73.jpg" "T:\! Field_Verification_Data\BW\Big Walnut101\70.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\80.jpg" "T:\! Field_Verification_Data\BW\Big Walnut100\55.jpg" "T:\! Field_Verification_Data\BW\Big Walnut100\38.jpg" "T:\! Field_Verification_Data\BW\Big Walnut56\68.jpg"  c:\pics /oAlog/h/c/e/r/y

I don't mind concatenating what is needed to each entry to allow this to work, so I look forward to your suggestions.

f.y.i. I'm including a bit of coding I found that may be something to consider as well, but I'll await your suggestions.

echo off
for  /F  "tokens=*"  %%*  in (c:\Files.txt)  do  xcopy /y /c /d /h "%%*"
d:\Target\ Quote from: garv on May 28, 2009, 09:41:47 AM
"T:\! Field_Verification_Data\BW\Big Walnut27\50.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\48.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\87.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\58.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\62.jpg" "T:\! Field_Verification_Data\BW\Big Walnut101\90.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\70.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\73.jpg" "T:\! Field_Verification_Data\BW\Big Walnut101\70.jpg" "T:\! Field_Verification_Data\BW\Big Walnut27\80.jpg" "T:\! Field_Verification_Data\BW\Big Walnut100\55.jpg" "T:\! Field_Verification_Data\BW\Big Walnut100\38.jpg" "T:\! Field_Verification_Data\BW\Big Walnut56\68.jpg"  c:\pics /oAlog/h/c/e/r/y
before i write something up, need to confirm a few things:
is it no line-break between each entry? or the formatting is loss due to copy&paste from unix system maybe??
what is this last line mean -  c:\pics /oAlog/h/c/e/r/y?
there is a limit in cmd a certain number of characters in a variable.

if you able to format the file like this:
Code: [Select]"T:\! Field_Verification_Data\BW\Big Walnut27\50.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\48.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\87.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\58.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\62.jpg"then a batch code would be possible, otherwise i need to do it in another scripting language, such as vbscriptCorrect, what I pasted has no line-breaks between entries, however if I need line breaks (or commas, tabs etc.), I can make it that way.

The last line is what I was using as the destination directory (this can be anything), and the remainder were xcopy switches including the creation of a log file for errors, which I have found helpful in the past.for this text format with line break, support unlimited number of entry:
destination directory is at the top for performance sake, if you put the destination directory on the last line, it will take a long time for large list
Code: [Select]c:\pics
"T:\! Field_Verification_Data\BW\Big Walnut27\50.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\48.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\87.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\58.jpg"
"T:\! Field_Verification_Data\BW\Big Walnut27\62.jpg"the batch code:
Code: [Select]echo off & setlocal

set /p dest=<test.txt
if %dest:~-1%.==\. set dest=%dest:~0,-1%

for /f "skip=1 tokens=*" %%a in (test.txt) do (
if not exist "%dest%%%~pa" MD "%dest%%%~pa" && echo created "%dest%%%~pa"
echo copying "%%~a"
copy "%%~a" "%dest%%%~pa"
)Reno,

FANTASTIC. I tested what you posted and it worked, then I chose a more complex set of paths and files and it worked perfectly. That is exactly what I'm in need of. Rest assured it will be put to good use.

If it is ok with you I will make this available to other people that have had the same issue that I was dealing with; there are many. If you'd like to receive some feedback or credits for this I know a place we can probably post it. Let me know your thoughts.

In the mean time I will spend some more time deciphering what you created and test it in some different ways.

Once again. Fantastic. Thank You.glad it works well.

feel free to modify and give it to your friends, just dont put my name on it, i'll be ashamed if my name tagged somewhere for such a simple script.

if the simple script help you out somehow, you only need to click "thanks at post #11". that's more than enough 
btw, click once only, i don't like cheating 
Reno,

I clicked the thank you button 'once' for you yesterday right after I tested the script. If I can do what I'd like to with the script I will give you an update, it really could help a lot of people. Have a good weekend. - joshReno,

I'd like to join in on the thank you's here!!  In researching the very issue and need over the past two days (and many experiments later), I came across this thread and was able to IMPLEMENT your .bat in the exact MANNER I needed.   

Best regards,

L. Burr
1805.

Solve : batch file to rename files based on content?

Answer»

I am trying to write a batch file that will:

1. Select a DIRECTORY (EDI*.*)
2. Read the first line of each file (this line is the new filename I want)
3. Delete the first line.
4. Rename the file to the new file name.

Thanksif you have GAWK for WINDOWS (see my sig)
Code: [Select]BEGIN {
for(i=1;i<ARGC;i++){
                print "Processing file: "ARGV[i]
getline newfile < ARGV[i]
while( ( getline line < ARGV[i] ) >0 ){
print line > newfile
}
close(ARGV[i])
cmd = "ren "ARGV[i]" "newfile
print cmd
system(cmd)
}
}
save the above as myscript.awk and on command line
Code: [Select]c:\edi> gawk -f myscript.awk *.*
The rename works great. Thanks

Just need to know how I can delete the first line before the file gets renamed.

1806.

Solve : dos syntax - $ and network path?

Answer»

If I am defining a network path in a net use command  example is    net use K: \\test\test$
What is the purpose of the $ in windows it is used in administrative shares. that is when you have not explicitly defined the share (windows default). The $ is used to denote a hidden share on the server. Any Shares that end with the $ will not be published or visible. You have to now the share name to access. Quote from: gregflowers on June 29, 2009, 01:49:52 PM

The $ is used to denote a hidden share on the server. Any Shares that end with the $ will not be published or visible. You have to now the share name to access.

or if you need to KNOW the share's on your system
you can right click My Computer
manage
click the + Shared Folders
and then select shares

all shares including administrative shares will show up.you will also need user/password followed by that command if you dont already have passthrough AUTHENTICATION at the windows permissions level. "This can be dangerous if PLACED in a BATCH, in a batch that other users have access to with lesser permissions or in an environment where anyone can view the batch with that mapping and credentials in the open."
1807.

Solve : Log File?

Answer»

Hey guys,

I have a simple one here, i just can't figure it out CORRECTLY. I have a huge BAT file that copies all the contents from one folder to the "all users" desktop folder on ALL our computers that are on our "staff" network. I just want to create a small log file that simply states the start TIME that the BAT was run and the end time of the BAT. That's it. Well sort of. I want to have it create a log file with the date in the title. (i.e. log_07092009.txt). Then is the file was run again, on the same day,  it would add a line in the created text file.

So i have this is the begining:
Code: [Select]ECHO Push to all STAFF computers started at %date% %time% by %username%>>"%~dp0\Log Files\%DATE%_backuplog.txt"and this at the end:
Code: [Select]echo Push to all STAFF computers completed at %date% %time% by %username%>>"%~dp0\Log Files\%DATE%_backuplog.txt"
echo ---------------------------------------->>"%~dp0\Log Files\%DATE%_backuplog.txt"
but i get this and can not figure out why:
Code: [Select]The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
Press any key to continue . . .
Thank you guys for the help!%~dp0 AFAIK Not valid outside a For loop, also requires double % in a batch script as in %%~dp0

okay, i managed to get this going. Below is a sample of how i was able to get the date in the file name.

Code: [Select]FOR %%A IN (%Date:/=%) DO SET Today=%%A

echo ******************************************************* >>"Log Files\Log__%TODAY%.txt"
echo Started Push to ALL STAFF Desktops on %DATE% %TIME% >>"Log Files\Log__%TODAY%.txt"
echo ******************************************************* >>"Log Files\Log__%TODAY%.txt"
echo. >>"Log Files\Log__%TODAY%.txt"

USING this i now have the following file name scheme.

Quote

Log__07092009.txt
1808.

Solve : Batch file to run multiple programs - error on command line?

Answer»

I'm new to BATCH files and have read the beginner MATERIAL on here.  I can get certain programs to run through my batch file but others I can't because of the spaces in the file path.  I have already done the simple things mentioned on this site like adding the quotation marks but that doesn work.

OS Is Vista64 if that matters.
 
Here are my command lines:
START C:\Users\Cary\Desktop\miniAdmin3\miniAdmin3.exe  (this one works fine)
START C:\Program Files (x86)\CoD RconTool10\CoD RconTool.exe  (this one errors because of the spaces.

So I tried using QUOTATIONS:  START "C:\Program Files (x86)\CoD RconTool10\CoD RconTool.exe" (but this brings up a CMD window instead of the program I want to run)

What am I doing wrong?
Okay I figured out what I'm doing wrong.  here is how the command line should look:

START C:\"Program Files (x86)"\"CoD RconTool10"\"CoD RconTool.exe"  (where we only need "" marks around the file name or directory that has the space in it. Quote from: Medaitor on JULY 03, 2009, 01:33:28 PM

Okay I figured out what I'm doing wrong.  here is how the command line should look:

START C:\"Program Files (x86)"\"CoD RconTool10"\"CoD RconTool.exe"  (where we only need "" marks around the file name or directory that has the space in it.
Quite strange, I haven't seen a path with more than one set of quotes...but start "C:\Directory Here\file name.exe" should work...I had the same problem but when i removed the start command and checked my spelling it did work

1809.

Solve : XCOPY - .bat to all users?

Answer»

I'm trying to RUN a batch file that deploys files from our file server to the all users startup folder and C drive without having to manually drag each file to its destination.  When I copy the files from the network path to the WINDOWS DIRECTORY, all is well. When I copy to the C:\Documents and Settings\All Users\Start Menu\Programs\Startup I get "The syntax of the command is incorrect". I guessing I need the old school ~ paths but I'm not sure what I need to do. Help please.Nevermind I figured it out. You must use quotation marks around the path. Quote from: prosportal on July 02, 2009, 03:29:21 PM

Nevermind I figured it out. You must use quotation marks around the path.
GOOD for you! One thing to make it so you won't get that error again is to ALWAYS use QUOTES around paths.
1810.

Solve : passing password?

Answer»

how can i pass password to ssh. i m able to pass username by using belw given command

putty.exe -ssh -l username servername

but unable to pass the password...PLS HELP me out....RTFM ?
http://the.earth.li/~sgtatham/putty/0.53b/htmldoc/Chapter3.html
3.7.3.8 -PW: specify a password
Graham

1811.

Solve : BATCH to format text in files .txt?

Answer»

Hello,
I searched but I didn't found.
I need a COMMAD or an program to transform 3 lines or more in 1 line like:

I have following text:          111111111
                                      222222222
                                      333333333
                                      444444444
                                      555555555

I want to MAKE it like:    1111111111      2222222222       3333333333
                                 4444444444      5555555555

I tried EDLIN but didn't worked.
Thank you.if you have gawk for windows(see my sig)
Code: [Select]C:\test>more file.txt
111111111
222222222
333333333
444444444
555555555
666666666
777777777

C:\test>gawk "ORS=(NR%3==0)?\"\n\":\" \"" file.txt
111111111 222222222 333333333
444444444 555555555 666666666
777777777
if you prefer a native solution, an example vbscript here you can use Quote from: gh0std0g74 on July 01, 2009, 12:06:04 AM

if you have gawk for windows(see my sig)

Sorry I forgot to say that I'm using W2K OS.
 Ty, but i can't use "gawk for windows". Quote from: SuperSteaua on July 01, 2009, 12:57:54 AM
Sorry I forgot to say that I'm using W2K OS.
 Ty, but i can't use "gawk for windows".
gawk works on W2K as well. Its a matter of whether you want to download it or not. Its only a one time effort if you want to download and use it. However, if not, i have also shown you example of vbscript in the link. you can try that.heh, "I Have windows, so I can't use Gawk for windows"

classic. Code: [Select]echo off
setlocal enabledelayedexpansion

for /f %%a in (a.txt) do (
if not !num! equ 3 (set line=!line! %%a) ELSE (
set num=0
echo !line!
set line=%%a
)
set /a num+=1
)
echo %line%

pause
C:\>type strcat.bat
Code: [Select]echo off
setLocal EnableDelayedExpansion
set /a c=0

for /f "tokens=1-3 delims=" %%a in (strcon.txt) do (
set /a c+=1
set str!c!=%%a

set Final=!str1! !str2! !str3!
if !c! EQU 3 echo !Final!
if !c! EQU 3 set /a c=0 && set str1= && set str2= &&  set str3=

)
echo %Final%
Output:

C:\>strcat.bat
111111111 222222222 333333333
444444444 555555555 666666666
777777777
C:\>
C:\>type strcon.txt
111111111
222222222
333333333
444444444
555555555
666666666
777777777

C:\> Quote from: billrich on July 01, 2009, 09:23:08 AM
C:\>type strcat.bat

Code: [Select]echo off
setLocal EnableDelayedExpansion
set /a c=0

for /f "tokens=1-3 delims=" %%a in (strcon.txt) do (
set /a c+=1

set str!c!=%%a


)

set Final-1=%str1% %str2% %str3%
set Final-2=%str4% %str5% %str6%

echo  %Final-1%

echo  %Final-2%
Output:

C:\>strcat.bat
 111111111 222222222 333333333
 444444444 555555555
C:\>

C:\>type strcon.txt
111111111
222222222
333333333
444444444
555555555

C:\>
your SCRIPT doesn't take care of more input lines.07/02/2009 :

More input lines now possible. See post # 6  Bill


Quote from: gh0std0g74 on July 01, 2009, 10:16:58 AM


your script doesn't take care of more input lines.

Devcom post#5  beat  me to the draw.  His code is complete and nearly perfect.  I'm still learning. 

Maybe the non Batch solutions should be on another Board?

We might be overloading the newbies?I have to say that I realy can't use other STUFF than batch, because I use it on a server of an CLIENT and I can't INSTALL on it softweare without permision. And offcourse I don't have permision.


Quote from: devcom on July 01, 2009, 08:45:52 AM
Code: [Select]echo off
setlocal enabledelayedexpansion

for /f %%a in (a.txt) do (
if not !num! equ 3 (set line=!line! %%a) ELSE (
set num=0
echo !line!
set line=%%a
)
set /a num+=1
)
echo %line%

pause

This one seems to do the trick. But I didn't succeed to put the result into a result file DEVCOM if u can refine it please.


As for the other program it didn't worked for me.

Thank you in advance for u'r help.

Code: [Select]echo off
setlocal enabledelayedexpansion

for /f %%a in (a.txt) do (
if not !num! equ 3 (set line=!line! %%a) ELSE (
set num=0
echo !line! >>log.txt
set line=%%a
)
set /a num+=1
)
echo %line% >>log.txt

pause Quote from: devcom on July 02, 2009, 06:25:37 AM
Code: [Select]echo off
setlocal enabledelayedexpansion

for /f %%a in (a.txt) do (
if not !num! equ 3 (set line=!line! %%a) ELSE (
set num=0
echo !line! >>log.txt
set line=%%a
)
set /a num+=1
)
echo %line% >>log.txt

pause

Thank you very much.
It's working fine.
Problem solved.
1812.

Solve : help in outputting HPGL file to com port?

Answer»

I am trying to output an HPGL file to a com port.

It's been too MANY years of windows and whatever DOS I once knew has fled the scene of the mind.

I can output one LINE at a time manually, but want to PLOT to an HP 7475A PLOTTER and need the syntax to read each line of the HPGL file and echo it to the com port the plotter is connected to with necessary handshakes to match the speed of the plotter.

Thanks

DonS

1813.

Solve : Null character as delim??

Answer»

Win XP Home SP.3.  Cmd.exe batch scripting.

Can the NULL character (hex 00) be used as a delimiter in a For loop please?Replying to own POST!!

Have been ADVISED that the non-printable chars (hex 00 thru' 1F) cannot be used as delims.

Quote from: ValerieMay on July 01, 2009, 07:13:39 PM

Replying to own post!!

Have been advised that the non-printable chars (hex 00 thru' 1F) cannot be used as delims.


Now you know...although it would be cool if you COULD though...
1814.

Solve : my pc wont start?

Answer»

Hi
My computer wont start. When I hit the power button it goes to Startup REPAIR mode and running in this mode to check for computer problem. After finish running this mode, the screen shows Startup Repair cannot repair this computer automatically. During this running the green back ground of window OS flashes and has some vertical DARK green line. Could some one help me with this problem. I SUSPECT graphic card has issue but not sure. Thanks for your help.can you press system restore or system recovery in the very beggining up startup
usually shows:

press f8 to enter system recovery

We need a bit more info..
Hardware specs(is this a desktop or a laptop?) Any recent changes to hardware/software.. that sort of stuff..Hi
My pc is dell vostro 400. It has core 2 QUAD 2.0Ghz cpu, 200G hardrive and 2G memory. The problem shows up after I take out headset from USB slot. I do not install any new hardware and software

1815.

Solve : ftp.exe "Data connection created for directory listing"?

Answer»

Hi folks 

i have problem getting some info from ftp server
so i have this code:
.bat
Code: [Select]ftp -s:a.txt
pause.txt
Code: [Select]open **.***.***.**
******* <USER
******* <pass
cd DATA
dir
and i get this:
Code: [Select]ftp> open **.***.***.**
Connected to **.***.***.**.
220 KRASNAL Serv wita na CesarFTP 0.99G!
User (**.***.***.**:(none)):
331 User LOGIN OK, waiting for password

230 User password OK, CesarFTP server ready
ftp> cd DATA
250 Directory CHANGE OK
ftp> dir
200 command successfully executed
150 Data connection created for directory listing
it hangs at "150 Data connection created for directory listing" only when USING ftp.exe, i can NORMALLY use it thru opera or explorer

my server is windows server 2008 and CesarFTP, port open 21

searched all google and nothing,thanks

1816.

Solve : Resolved--- How to make a Batch file to copy folders from variable source??

Answer»

Hi,

sorry to barge in like this, but would really appreciate any help with this as I have been reading for hours now trying to find my answer..

can you drop a bat file in the Dir I specify to copy in that Dir that folder to a new folder in that Dir?
so without specifying the drive etc..
as it's for multiple users and I don't know where they have it installed (everyone has different installs/versions)
------------------------------------------------------------------------------------------------------

if you need background, the longer version   
why and what I'm trying to do with this batch file..
I'm a gamer/modder..
for a gaming community I made maps for a game, but will need to make a duplicate of the main game (mod) into a new mod..
to make it easier for the non technical members (copying manually).
and to keep download size down
(not having to make them download all the duplicate things as well)
I want to make BATCH file to copy the files from this main game folder to new folder (in same Dir)..

The problem is that everyone has different directory's they use to install their game,
so i can't just do:
copy (or xcopy, not sure the difference?!) "C:\programs\game\folder" C:\programs\game\new folder

I need to ask the people using this to specify (or maybe drop this batch file into) the main game Dir..
(the main game folder even varies..eg deluxe version)
eg   copy " \game\folder" \game\New folder
but this doesn't work so, how can I do that?


many thanks for your time people
you can:

1.(i see you have vista)

use where command to find executable of your game ex.
Code: [Select]H:\Users\_CORE7>where /R D:\ "crysis.exe"
D:\Program Files (x86)\Electronic Arts\Crytek\Crysis\Bin32\Crysis.exe
D:\Program Files (x86)\Electronic Arts\Crytek\Crysis\Bin64\Crysis.exe
D:\Program Files (x86)\Electronic Arts\Crytek\Crysis WARHEAD\Bin32\Crysis.exe
D:\Program Files (x86)\Electronic Arts\Crytek\Crysis Wars\Bin32\Crysis.exe
D:\Program Files (x86)\Electronic Arts\Crytek\Crysis Wars\Bin64\Crysis.exe
2.
let user input the path ex.
Code: [Select]H:\Users\_CORE7>set /p input=PATH:
PATH: C:\

H:\Users\_CORE7>echo %input%
C:\
3.
use dir command (longer version of where) ex.
Code: [Select]H:\Users\_CORE7>dir /s /b "D:\program files (x86)" |findstr "Crysis.exe"
D:\program files (x86)\Electronic Arts\Crytek\Crysis\Bin32\Crysis.exe
D:\program files (x86)\Electronic Arts\Crytek\Crysis\Bin64\Crysis.exe
D:\program files (x86)\Electronic Arts\Crytek\Crysis WARHEAD\Bin32\Crysis.exe
D:\program files (x86)\Electronic Arts\Crytek\Crysis Wars\Bin32\Crysis.exe
D:\program files (x86)\Electronic Arts\Crytek\Crysis Wars\Bin32\Crysis.exe.patch1
D:\program files (x86)\Electronic Arts\Crytek\Crysis Wars\Bin64\Crysis.exe

if you will use 1. or 3. then you need also for loop
Thank you very much devcom..

I should have stated though that I'm completely new to this.. sorry
I have no clue how to link this code to do a copy for the desired directory?
And actually I have been trying to do a bat file in a test Dir and can't get it working with the whole paths specified.. Here I thought, piece of cake
(when executing your 2nd code lines, I get 2 files dropped in the Dir?! )

maybe my mind is fried atm and should leave it for an other day,
but if you could help me how I would do this you would make my day


I think the second is my PREFERENCE, as that will cover all bases..

And while I'm at it , how you would exclude a folder within the folder to copy?
(i don't need to copy the Levels folder - being 3gig)


thank you very much again devcom,
i really appreciate it..  
I might have a try again TOMORROW with a fresh mind 




 I'm at a total loss 
I can't even seem to execute simple code that seems to work for everyone else 

I created this directory to test

xcopy /t /s /f "c:\folder\game\bf2142\" "c:\folder\game\2142DR\"

I get an error saying that "xcopy" is not recognized as an internal or external command?!

using just copy says the syntax of the line is incorrect?!
tried variations with that (eg - addressing a file within the folder) but same thing over and over...

I don't get it...

this is something i tried with your code devcom

Code: [Select]echo please enter the directory your main bf2142 folder is situated
echo.
echo off

H:\Users\_CORE7>set /p input=PATH:
PATH=C:\

H:\Users\_CORE7>echo %input%


pause

Xcopy /t /s /f "%input%=PATH:\bf2142\" "%input%=PATH:\2142DR\"
anyways, I thought I see what it does(did some variations).. and nothing is recognized, even "echo." is not a recognized command.. like what the?!?

please can anyone help me, I really want this to work.
otherwise my project would be jeopardized.. from a mere 180meg to nearly 2gig..
which is for many too much..
Being part of setting up a ladder competition starting off within a week or so, hoping to use my custom maps if i can get it finalized with a server provider..
and the people that signed up downloading and installing my content

thank you again..
all good, I have convinced the server provider to put the maps in with the rest of the game. So don't have to make a mod out of it..

If SOMEONE still would like to enlighten me with this problem, most welcome, as I still would like to learn this for some stage.
But thought to say that the pressure is off.

And thanks again Devcom..
you wrote me down quite some options of code there
awesome..

if any of your command doesnt work try this Code: [Select]http://www.technize.com/2007/05/14/your-command-prompt-doesnot-recognize-any-of-your-commands/
here is how this could look:

Code: [Select]echo off
setlocal enabledelayedexpansion

set modname=TEST
echo.SCANNING YOUR DISC FOR BF2142.exe

for /f "tokens=*" %%a in ('dir /b /s "D:\" ^|findstr "BF2142.exe"') do (
set _path=%%a
goto EXITLOOP
)

:EXITLOOP
set _path=%_path:BF2142.exe=%
set _path_mods=%_path%mods
set _path_bf2142=%_path%mods\BF2142

for /f "tokens=*" %%a in ('dir /b "%_path_bf2142%"') do (
if /I not "%%a" equ "LEVELS" if /I not "%%a" equ "MOVIES" (
echo copy "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a" >>log.log
)
)

pause
log.log - just for testing
Code: [Select]copy "mods\bf2142\AI" "mods\TEST\AI"
copy "mods\bf2142\ClientArchives.con" "mods\TEST\ClientArchives.con"
copy "mods\bf2142\Common_client.zip" "mods\TEST\Common_client.zip"
copy "mods\bf2142\Common_server.zip" "mods\TEST\Common_server.zip"
copy "mods\bf2142\DefaultEnvMap.tweak" "mods\TEST\DefaultEnvMap.tweak"
copy "mods\bf2142\Fonts_client.zip" "mods\TEST\Fonts_client.zip"
copy "mods\bf2142\Fonts_server.zip" "mods\TEST\Fonts_server.zip"
copy "mods\bf2142\GameLogicInit.con" "mods\TEST\GameLogicInit.con"
copy "mods\bf2142\Ingame.mep" "mods\TEST\Ingame.mep"
copy "mods\bf2142\Init.con" "mods\TEST\Init.con"
copy "mods\bf2142\levels.md5" "mods\TEST\levels.md5"
copy "mods\bf2142\Localization" "mods\TEST\Localization"
copy "mods\bf2142\Logs" "mods\TEST\Logs"
copy "mods\bf2142\menu" "mods\TEST\menu"
copy "mods\bf2142\Menu_client.zip" "mods\TEST\Menu_client.zip"
copy "mods\bf2142\Menu_server.zip" "mods\TEST\Menu_server.zip"
copy "mods\bf2142\Mod.desc" "mods\TEST\Mod.desc"
copy "mods\bf2142\mod.png" "mods\TEST\mod.png"
copy "mods\bf2142\mod_icon.png" "mods\TEST\mod_icon.png"
copy "mods\bf2142\Objects" "mods\TEST\Objects"
copy "mods\bf2142\python" "mods\TEST\python"
copy "mods\bf2142\rain.con" "mods\TEST\rain.con"
copy "mods\bf2142\rain_heavy.con" "mods\TEST\rain_heavy.con"
copy "mods\bf2142\rain_light.con" "mods\TEST\rain_light.con"
copy "mods\bf2142\rain_medium.con" "mods\TEST\rain_medium.con"
copy "mods\bf2142\ServerArchives.con" "mods\TEST\ServerArchives.con"
copy "mods\bf2142\Settings" "mods\TEST\Settings"
copy "mods\bf2142\shaders" "mods\TEST\shaders"
copy "mods\bf2142\Shaders_client.zip" "mods\TEST\Shaders_client.zip"
copy "mods\bf2142\snow.con" "mods\TEST\snow.con"
copy "mods\bf2142\snow_heavy.con" "mods\TEST\snow_heavy.con"
copy "mods\bf2142\snow_light.con" "mods\TEST\snow_light.con"
copy "mods\bf2142\snow_medium.con" "mods\TEST\snow_medium.con"
copy "mods\bf2142\Sound_client.zip" "mods\TEST\Sound_client.zip"
copy "mods\bf2142\Sound_server.zip" "mods\TEST\Sound_server.zip"
copy "mods\bf2142\std_archive.md5" "mods\TEST\std_archive.md5"

i excluded LEVELS and MOVIES just for testThat is AWESOME!!

Your tha code man Devcom

And I suspect your familiar with bf2142 as well , seeing that you excluded the movie files also..
I didn't even think of that..

I will definitely be using this at some stage..
(maybe even still, now I got this )
very much appreciated..

ps.
didn't realize there was a rep button.. will come back after two hours to give you an other one well deserved..  least I can do..
 
dang.. the code seems to do it's thing, making a log file and all.
but it actually didn't make a copy in my mod folder?!
(the code didn't give me any errors, but was way to short.
seeming it didn't actually do anything beyond looking up the bf2142.exe ..
As it looks for that,
then you get the prompt to continue, and it exits out straight away?!

I assume you have tried it, so maybe there is something wrong with my PC?!
as that link you gave me, I did have a look at that and the dir's are in there.
So again the PC beats me..

anyways, I feel terrible that it won't work after all your effort into this.
that must have taken you some time to think up and type out..
 
sorry buddy..

well i dont know in what disc you have installed bf2142 i used D:\ ('dir /b /s "D:\" ^|findstr "BF2142.exe") as example you can also find on which disc user have bf:

Code: [Select]for %%a in (A B C D E F G H I J K L M N O P R S T U W X Y Z Q V) do (
if exist "%%a:\" (
for /f "tokens=*" %%b in ('dir /b /s "%%a:\" ^|findstr "BF2142.exe"') do (
set _path=%%a
goto EXITLOOP
)
)
)
but this can take much more time

also in my last code if you want to copy files you need to remove echo and  >>log.log
Code: [Select]echo copy "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a" >>log.logor add this line
Code: [Select]copy "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a"
then it should workHey devcom

I did overlook the echo bit , and it sort of worked after I took that out..
Well added a code to create a folder for the mod, as that was what stopped it at first as well..

It made all files into a folder though, and then put those files in that folder
eg. Fonts_client.zip made that the folder name, and put the actual zip file inside of that..
I tried with xcopy and some other things, and one just copied straight over without any folders (and contents of those folders) with some feature on it I can't remember and can't seem to find it again

this is what I came up with so far, as your multi drive search code didn't seem to work..
(I do have to say that this works but it still GOES from c to d, even when I put input d.. but no biggy, I just don't echo searching drive c: now .. coding is weird

Code: [Select]echo off
setlocal enabledelayedexpansion

CLS
:MENU
ECHO.
ECHO ...............................................
ECHO please select the drive your BF2142 is installed on.
ECHO ...............................................
ECHO PRESS C key for C: Drive
ECHO PRESS D key for D: Drive
ECHO PRESS E key for E: Drive
ECHO PRESS F key for F: Drive
ECHO ...............................................
ECHO.
ECHO.

SET /P M=Type C, D, E, or F then press ENTER:
IF %M%==C GOTO :CDrive
IF %M%==D GOTO :DDrive
IF %M%==E GOTO :EDrive
IF %M%==F GOTO :FDrive

:CDrive
set modname=2142DR
echo.SCANNING for your main BF2142 folder.

for /f "tokens=*" %%a in ('dir /b /s "c:\" ^|findstr "BF2142.exe"') do (
set _path=%%a
goto EXITLOOP
)

:DDrive
set modname=2142DR
echo.SCANNING for your main BF2142 folder.

for /f "tokens=*" %%a in ('dir /b /s "d:\" ^|findstr "BF2142.exe"') do (
set _path=%%a
goto EXITLOOP
)

:EDrive
set modname=2142DR
echo.SCANNING for your main BF2142 folder.

for /f "tokens=*" %%a in ('dir /b /s "e:\" ^|findstr "BF2142.exe"') do (
set _path=%%a
goto EXITLOOP
)

:FDrive
set modname=2142DR
echo.SCANNING for your main BF2142 folder.

for /f "tokens=*" %%a in ('dir /b /s "f:\" ^|findstr "BF2142.exe"') do (
set _path=%%a
goto EXITLOOP
)
)
)

:EXITLOOP
set _path=%_path:BF2142.exe=%
set _path_mods=%_path%mods
set _path_bf2142=%_path%mods\bf2142

for /f "tokens=*" %%a in ('dir /b "%_path_bf2142%"') do (
if /I not "%%a" equ "LEVELS" if /I not "%%a" equ "MOVIES" (
cls
mkdir "%_path_mods%\%modname%\%%a"
echo copy "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a" >>log.log
xcopy /T /E "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a"
copy "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a"
)
)

pause
the last lines I also tried with just these with the same result..?!
(without xcopy)
Code: [Select]echo copy "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a" >>log.log
copy "%_path_bf2142%\%%a" "%_path_mods%\%modname%\%%a"

This is getting somewhere though ..
thanks again..
ok here is my final code, tested works

Code: [Select]echo off
setlocal enabledelayedexpansion

set modname=TEST
echo.SCANNING YOUR DISC FOR BF2142.exe

for %%a in (A B C D E F G H I J K L M N O P R S T U W X Y Z Q V) do (
if exist "%%a:\" (
for /f "tokens=*" %%b in ('dir /b /s "%%a:\" ^|findstr "BF2142.exe"') do (
set _path=%%b
goto EXITLOOP
)
)
)

:EXITLOOP
set _path=%_path:BF2142.exe=%
set _path_mods=%_path%mods
set _path_bf2142=%_path%mods\BF2142

if not exist "%_path_mods%\%modname%" md "%_path_mods%\%modname%"

echo.>log.log

for /f "tokens=*" %%a in ('dir /b "%_path_bf2142%"') do (
if /I not "%%a" equ "LEVELS" if /I not "%%a" equ "MOVIES" (
robocopy "%_path_mods%\bf2142\%%a" "%_path_mods%\%modname%\%%a" || (
copy "%_path_mods%\bf2142\%%a" "%_path_mods%\%modname%\%%a"
)
)
)

cls
echo.DONE!
pause
this one use robocopy so if you want to give that "install" to someone else copy robocopy.exe from C:\Windows\System32 and add it to folder where script isAwesome, thanks a lot Devcom.

works a treat..

1817.

Solve : Piping, FIND command??

Answer»

IN a CMD window I type

Code: [Select]dir /b /a:d ^| find BC????
This works, It displays all directories with BCsomenumber but when using a for LOOP in a bat that is looking in the same directory

Code: [Select]for /f "tokens=1*" %%i in ('dir /b /a:d ^| find /I "BC????"') do ECHO 1:%%i
Doesn't work. Does it interpert my ?'s differently in a for loop? Using the search string "BC" works in a sense but also returns information I don't need at this time.


Thanks for the assistance. maybe this:
Code: [Select]dir /b /a:d ^| find BC???? >text.txt
for /f "tokens=1*" %%i in ('type text.txt') do ECHO 1:%%idevcom, i am sure there is no need to create a temp file.

OP, you can use vbscript
Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = "c:\test"
Set objFolder = objFS.GetFolder(strFolder)
Go( objFolder)
Sub Go(objDIR)
  If objDIR <> "\System Volume Information" Then
    For Each eFolder in objDIR.SubFolders
    strFolderName = eFolder.Name
    If INSTR(strFolderName, "BC")>0 Then
    WScript.Echo strFolderName
    End If
      Go eFolder
    Next

  End If 
End Sub
save as mysearch.vbs and on command LINE
Code: [Select]c:\test> cscript /nologo mysearch.vbs

C:\>type bc.bat
Code: [Select]echo off
for /f "tokens=1*" %%i in ('dir /b  ^| find /I "BC"') do ECHO 1:%%i
Output:

C:\>bc.bat
1:bc.bat
1:bc11.txt
1:bc12.txt
1:bc13.txt
1:bcalc.bat

C:\>

C:\>dir /b BC*.*
bc.bat
bc11.txt
bc12.txt
bc13.txt
bcalc.bat

C:\> Quote from: devcom on July 06, 2009, 04:48:31 PM

maybe this:
Code: [Select]dir /b /a:d ^| find BC???? >text.txt
for /f "tokens=1*" %%i in ('type text.txt') do ECHO 1:%%i

I ended up using this. This appears to meet my needs at this time. Thanks for the other replies. I appropriate it.

gh0std0g74
Still haven't taking the the time to really learn VBS, need to as I know it has a lot of power, but in the mean time usually when I ask a DOS question it is because the rest of the BATCH is already written and some function part of it isn't working the way I think it should or isn't working to my needs. THANK you by all means though for your VBS input as at some point I will be shifting my focus into this LANGUAGE.
1818.

Solve : help getting DOS to talk to XP with "net use"?

Answer»

Hi everyone,

Here is my problem: I NEED to map a shared folder on a computer that runs XP onto the "i" drive of a machine that only runs DOS.  The two computers are connected VIA ethernet. I type "net use i: \\XPcomputer\sharedfolder at the command prompt of the DOS machine and this SEEMS to work just fine: it says "command completed successfully" and I can see the I drive.  However, when i try to take a look at the I drive on the DOS machine it TELLS me that I:\\ is XPcomputer but typing "dir" doesn't show me any of the files that are in the shared folder and it won't open any of the .ini files that are in the shared directory (it just says "error opening *file*.ini) Any ideas for somethings I can try?

I am only a casual windows user and  KNOW next to nothing about DOS, so any help is really appreciated!

Just FYI: The files are all in the shared directory and are not corrupt, I am using an administrator account on the XP machine and all of my file sharing preferences are set correctly and there doesn't seem to be a problem with the network connection.

Thanks!

TatiNevermind, I got it. For some reason it looks like you need to have "full control" enabled for all users, not just the user account you're logged in under on the host machine.... I'm not sure why this is but it solved the problem.

1819.

Solve : Version of EXE??

Answer»

I am completing a script that copies some directories off as a backup and writing a log at the same time.

I would like to also dump the version of an application to the same log for reference purposes in CASE the system ever needs to be restored. Is this possible in DOS? If not is there a way to write this function into VBS then return the value back to DOS? What application? The application itself usually has to have a function such as a help feature that will give this output. Only other way to tell is maybe by date/time stamp of the exe of the application in which you can perform a DIR and write >> to log file for that file such as

DIR application.exe>>APVersion.log

The date/time stamp of the exe's would be unique to the version.That is a good idea. Thank you for the suggestion. Dave has given good advice - but Microsoft do not always follow the rules.

My son installed a "Vista Experience" on my XP.
I did not like the experience and un-installed.
Months later Windows File Protection had a hissy fit.

I found that the un-installer had failed to reinstate some *.cpl files etc.
It left me with "Vista compatibles" that had identical dates and version strings to XP,
but did not match the catalogue checksums etc.

Also a few years ago a security update replaced a vital file, I think I remember it as Explorer.exe.  For some people this update broke functionality.
The truly horrendous ASPECT was that all the date stamps and version strings appeared identical.

I would suggest a hash checksum as secondary confirmation.

Regards
Alan
Hey Alan ...Good Idea ...WOW what a mess with that Vista. I went with MD5 hash. I found a nice LITTLE program on Microsoft's website that will compute the value at command line. I hard coded what I thought the value should be and DUMPED to log weather or not they matched.

1820.

Solve : Batch Help - delete unneccessary quoted messages in email conversation?

Answer»

Hi everyone,

I've never dealt with batch files before, but I know some Delphi and Java.

My problem is that I have a really long email conversation that I want to print off. I extracted everything into a big HTML file. I could print it off now, but each conversation includes several quotations of messages sent before. You know that each time an email has been answered the conversation so far was quoted underneath the new message. Now I see in the HTML code that the quotations are between two tags. It begins with


Could someone be so NICE and give me the code for the batch file? Or at least tell me what commands I would need? Thanks so much in advance!

Buff

PS: if no one knows how to do this maybe someone know a place to get help...a.txt
Code: [Select]1text text text text text text text text text text text text text
1text text text
1text text
1text text text text text text text text
1text text
&LT;BLOCKQUOTE
text text text text text
text text
text text
text text text text text
text text text
</BLOCKQUOTE
2text text text text text
2text text text
2text text
2text text text text text text
<BLOCKQUOTE
text text text text text
text text
text text
text text text text text
text text text
</BLOCKQUOTE
3text text text text text
3text text text
3text text
3text text text text text text

batch:
Code: [Select]echo off
setlocal enabledelayedexpansion
set skip=0

for /f "tokens=*" %%a in ('type a.txt') do (
if !skip! equ 1 (
if "%%a" equ "</BLOCKQUOTE" set skip=0
) ELSE (
if not "%%a" equ "<BLOCKQUOTE" (echo %%a) ELSE (set skip=1)
)
)
)
pause
output:
Code: [Select]1text text text text text text text text text text text text text
1text text text
1text text
1text text text text text text text text
1text text
2text text text text text
2text text text
2text text
2text text text text text text
3text text text text text
3text text text
3text text
3text text text text text text
Press any key to continue . . .Hey thanks for the quick reply...

I'll try this out next week when I'll be able to use my pc again.

Have a great day! Quote from: Buff on JULY 01, 2009, 10:46:37 AM
So what I need my batch file to do is to look for every blockquote opening tag and to delete everything after that until the closing blockquote tag.
you can see here for example on how to do it with vbscript
Quote from: devcom on July 01, 2009, 04:55:51 PM
Code: [Select]echo off
setlocal enabledelayedexpansion
set skip=0

for /f "tokens=*" %%a in ('type a.txt') do (
if !skip! equ 1 (
if "%%a" equ "</BLOCKQUOTE" set skip=0
) ELSE (
if not "%%a" equ "<BLOCKQUOTE" (echo %%a) ELSE (set skip=1)
)
)
)
pause
it would be good to take care of both open and close tags on the same line as wellJust a sideways thought - you could (Im not expert enough) edit a STYLE into the html that renders blockquotes invisible, then print it off from a browser - maybe

Graham Code: [Select]<STYLE>
BLOCKQUOTE
{
display : none;

}
</STYLE>

try placing that in the section of the HTML file. Quote from: BC_Programmer on July 02, 2009, 09:56:20 AM
Code: [Select]<STYLE>
BLOCKQUOTE
{
display : none;

}
</STYLE>

try placing that in the <HEAD> section of the HTML file.
yes, that was the sort of thing I had in mind !
ThanksThanks...
so far this has worked out but now I have left some quotes that ARENT WITHIN blockquote tags but all start off with > or actually ">". So once again: how do I delete each line that starts off with ">"?

Thanks =)

Buffa.txt
Code: [Select]1text text text text text text text text text text text text text
1text text text
1text text
1text text text text text text text text
1text text
"&gt;" text text text text text
"&gt;" text text
"&gt;" text text
"&gt;" text text text text text
"&gt;" text text text
2text text text text text
2text text text
2text text
2text text text text text text

.bat
Code: [Select]echo off
setlocal enabledelayedexpansion

for /f "tokens=*" %%a in ('type a.txt') do (
echo %%a | findstr ""^&gt;"" >nul || echo %%a
)
pauseHey...

it's not working =(
Could it be that the batch file also tries to execute commands from the text file (a.txt)? I think it tries to find the command "gt" because the &-sign is in front of it in my textfile. How do I tell the batch file not to try to do this? Code: [Select]C:\>type a.txt
1text text text text text text text text text text text text text
1text text text
1text text
1text text text text text text text text
1text text
"&gt;" text text text text text
"&gt;" text text
"&gt;" text text
"&gt;" text text text text text
"&gt;" text text text
2text text text text text
2text text text
2text text
2text text text text text text

C:\>a.bat
1text text text text text text text text text text text text text
1text text text
1text text
1text text text text text text text text
1text text
2text text text text text
2text text text
2text text
2text text text text text text
Press any key to continue . . .
how ?ok...that works but i have something like this:

Code: [Select]1text text text text text text text text text text text text text
1text text text
1text text
1text text text text text text text text
1text text
&gt; text text text text text
&gt; text text
&gt; text text
&gt; text text text text text
&gt; text text text
2text text text text text
2text text text
2text text
2text text text text text text
>text text text text
>text text
>>text text text text text text
>>text text
>>text text text text text text
>>text text
3text text text text text text
3text text
3text text text text text text
3text text
3text text text text text text text text

and it seems that if i read this with Code: [Select]('type a.txt') it tries to execute a command because of the &-sign in line 6-10

any idea how to solve this?

-----
hey this works =)

Code: [Select]echo off
setlocal enabledelayedexpansion

findstr /V /B /C:"&gt;" original.html > clean.html

pause
1821.

Solve : can you help me about using dos move command to move directory??

Answer»

I want to use "move" command to move directory.
Example: move [data] from C drive to D. D drive hasn't [data].
I tried using "move" like this:
move c:\data\ d:\data\
But it errors "Access is denied".
I don't know why. But when I move directory from one location to another in one drive (such as C or D). It's ok. And if I move files from one drive to another, it's ok too. But only directory, It errors "Access is denied".

Can you help me please? I'm a newbie, my english is not good. Hope you understanding.

Thanks a lot! Until your code works as you want, use XCOPY or copy. ( you may LATER erase the source files ).  Move erases source code as you go.

Play with xcopy until it does what you need.

Good luck

p.s.  Log in as the system ADMINISTRATOR, the "access denied" should not be a problem.  Copy files and not DIRECTORIES. Be safe and not sorry.  well i can't see why move isn't working for me either.

but xcopy works just the same.

I have a FOLDER named hello there:
Code: [Select] Directory of C:\tests\hello there
07/13/2009  01:12 PM                10 file1.txt
07/13/2009  01:12 PM                10 file3.txt
07/13/2009  01:12 PM                10 file4.txt
then you can use xcopy and /e to copy all directories.

Code: [Select]xcopy /e /y "c:\tests\hello there" "f:\hello there"
this should be it for as far as the move command goes

1822.

Solve : D.E.A.D V2 , Batch File Game?

Answer»
hey i got banned so i havent been here in a long TIME, but im assuming its lifted because i was alloud to register again, if it hasnt been can it please be?

I wanted to advertise my new batch game, since ive gotten banned its improved greatly,
Im going to post it here in a few minutes , this version has many improvements compared to 6 months ago and the last one i posted here,

What it includes,

-In Game Help Database
-Game Items, Game Item Creator and inventory
-New Functions, Get/Use/Inventory/Drop items
-Sacrifice now works, your god will give you money for your sacrifice
-8 New Temples,  3 Of them hide keys to access the main temple "gemini"
-The temple of gemini, it includes two thrones one to allow CHANGES to all variables
And the other to allow changes to all Variables in all open instances of the game at the same time.

-Map, Area Directions
-Many Bugs Fixed,
-New Game Titles
-Vastly Improved interface offering multiple display options and added information
-Added ways to access hidden areas built in the beginning of the game
-Added a "forge" where any item of any kind may be created to an area.
-All Open Instances now communicate variables to eachother, further improving networking
-Added new classes/choices of faith
-Fixed the options bugs,back bugs,

I have a running website for D.E.A.D , you can find it at odn.t35.com/dead
The new version (the one with working items, will be released here first) and is currently not available on the webpage.Here are the files

dead.cmd < -- the game
deadinst.cmd < -- The game installer
icreator.cmd < -- Item creator

[attachment deleted by admin]Im also offering a source for the 7th version of realms of *censored*, realms of *censored* is the second era of my batch game(created prior to D.E.A.D), please contact me by email for this source
Since i added interactive items to the game, item packs have become possible
to write an item, use this tutorial:

Using icreator.cmd

Variable ITN, is the Name of the Item for example , ITN=Egg
Variable ITV, is the Worth of the item, ITV=400
Variable ITA, is the Area the item should appear, ITA=RBB0001


copy con %v1%\i%itn% , Adds the commands to the item file, The item file is named i%ITN%
CLS&echo +%itn%>>%v1%\v%ita% ,Adds the item to the Room file, Items are identified from this file by whatever has a + sign NEXT to them, if it doesnt contain the + sign the item wont be listed.

echo %itn% %itv%>>%v1%\sacl , This adds the Item name and worth to the sacrifice value list , EG: egg 400

i%itn% is the commands to be processed by usage of the item in question, and can include anything

so the above, will create an "egg thats worth $400 in area RBB0001 (The front entrance"

Avoid two named items for the time being,
Not exatly those that had the ban on got removed.  But were did you find that game?  Also, in aid of helping if I can.
I created the game from scratch, well this version is built off other versions the first one was diablos batch game, the second was R.O.H and now its D.E.A.D

if you want to help you can take the source, try to eliminate all the bugs and add as many new features as possible, dont worry about adding new areas yet i want to get the game features working first in a small area then expand on them, so there is less work updating the code , you can make your own version or help with MINE and if you need to know anything just ask

thanksI cant say exatly if I would be able to or not.  Not used to working with bat too much
k , well if you want to i can help you

I can explain a little right now,

It works by setting a bunch of variables, like your name faith ect
then travelling to an "area" and that is just a section of the batch file
the area the continues to process a few types of files from the game folder,
these files provide items/possible movements/users in the area/save file information/Current time information/chat files/ and any number of other files,
so that the information in one instance of the game isnt contained to a single instance but instead all running instances of the game, for example opening dead.cmd twice, you can see and interact with both players, in order to save many lines of code

all the areas loop through a master area, sectioned as :XILE , :Xile works as the BRAIN behind the game, and all the calculations/lines of code are placed there except a few that are placed in the "area", xile processes a number of variables and creates a number of files, every move you make to another "area" you are first sent to :XILE without knowing it,

Moving is all done by file, in all areas you will see a line similar to these

for /f "tokens=1*" %%a in (%v1%\v%rmid%) do if "%%a"=="%choice%" %%b
for /f "tokens=1*" %%a in (%v1%\v) do if "%%a"=="%choice%" %%b

the first line checks for Room options, the file v%rmid% is vROOMID, rmid is the area id for example, RBB0001 is the "main entrance"

Inside the V%rmid% file, you will see something similar to this

N goto 404040
n goto 404040
S Goto 4039030
s Goto 4039030


so in the area, when you type N or n it will be checked in this file, and the result will be sending you to a section called 404040,

The second line is similar, except its only called v, the v file contains all the room commands, like sleep,say,load,save,quit,main ect and works in the same way.

if you need to know anything else just ask,

This is supposed to be fun ? ? ?

lol you mean the game?
I agree the game sucks right now, but creating it has been fun for me atleast expecially since its almost at the point now where i can use itself to create itself.  It seems really cheazy, I could do one and java and it be better but I dont have a complier.

Heres another update, With working enemys

This is just the first step in adding game enemys, but i wanted to show you

First of all the new enemys arnt yet added into the game, to use an enemy please follow these instructions

1)install the game
2)open a new instance of the game
3)in NT Command prompt open the folder with the ded3.cmd file in it
4)create a file in the game folder root:\ded , that looks like this:

exit
goto RBB0008
goto RBB0002
goto RBB0006
goto RBB0005
goto RBB0007
goto RBB0003
goto RBB0010
goto RBB0009
goto RBB0008
goto RBB0002
goto RBB0006
goto RBB0005
goto RBB0007
goto RBB0003
goto RBB0010
goto RBB0009
goto RBB0008
goto RBB0002
goto RBB0006
goto RBB0005
goto RBB0007
goto RBB0003
goto RBB0010
goto RBB0009
goto RBB0008
goto RBB0002
goto RBB0006
goto RBB0005
goto RBB0007
goto RBB0003
goto RBB0010
goto RBB0009
goto RBB0008
goto RBB0002
goto RBB0006
goto RBB0005
goto RBB0007
goto RBB0003
goto RBB0010
goto RBB0009
goto RBB0008
goto RBB0002
goto RBB0006
goto RBB0005
goto RBB0007
goto RBB0003
goto RBB0010
goto RBB0009


5)save the file -palace_security.eaf
6)type ded3.cmd ENA -palace_security 42

ded3.cmd is the program name
ENA is the variable that switches it to enemy mode
-palace_security is the enemy name
42 is the number of lines in the enemy file,

enemys are identified in the game as someone with a - in the start in their name, so for this reason ALL enemy files must start with a -

the above enemy will walk around the main area patrolling it



[attachment deleted by admin]When I get the chance I'll look at it.How Do I actually Get the Game there is no download link herefourm is a good bit old.  Its not a download, its code to make one.
1823.

Solve : AMAZING!!! Batch File Challenge!?

Answer»

Hello!

Here's my issue, I need to have a batch file our users can download and it will PROMPT them for 2  items of info  'dbname' and 'dbpass'

With those 2 variables, it will fill in 3 lines of dos commands and save it to a specified directory as a batch file.

EXAMPLE USER INPUT:
-------------------------------
*launch .bat file*

DBNAME: testdb09   *user types dbname here*
DBPASS: testpass09 *user types dbpass here*

*then saves to specific *.bat file*
-------------------------------



THEN, EXAMPLE OUTPUT *.BAT:
-------------------------------
echo
C:\program\app.exe  -0 SQL: -DBNAME: testdb09  -DBPASS: testpass09  -commandone
C:\program\app.exe  -0 sql: -DBNAME: testdb09  -DBPASS: testpass09  -commandtwo
C:\program\app.exe  -0 sql: -DBNAME: testdb09  -DBPASS: testpass09  -commandthree
cls
exit
-------------------------------

Please guide me in any way possible!!!  Thank you in advance  sth like this ?

Code: [Select]echo off

set /p dbn=DBNAME:
set /p dbp=DBPASS:

C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandone
C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandtwo
C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandthreeHello,

Thank you for the RESPONSE

How can  I then have it export to a batch or text file  with the variables filled in?

What I mean is, when they type the DBNAME and DBPASS  it will save those credentials and then export that into a txt/batch file with the three commands filled in with there info.

Does that make sense? Code: [Select]echo off

set filename=tst.txt
set /p dbn=DBNAME:
set /p dbp=DBPASS:

echo.C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandone >%filename%
echo.C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandtwo >>%filename%
echo.C:\program\app.exe  -0 sql: -DBNAME: %dbn%  -DBPASS: %dbp%  -commandthree>>%filename%perfect!  perfect!

Now ...the last baby step.

It's gotta be a batch file,not a txt that file that it exports. which I can easily change the extension to *.bat.

But it's gotta export a file like this:

echo off
C:\program\app.exe  -0 sql: -DBNAME: exampledb  -DBPASS: examplepass  -commandone
C:\program\app.exe  -0 sql: -DBNAME: exampledb  -DBPASS: examplepass  -commandtwo
C:\program\app.exe  -0 sql: -DBNAME: exampledb  -DBPASS: examplepass -commandthree
cls
exit


Bro... I SERIOUSLY appreciate your help, I PROMISE I'm grateful  why not just remove the password if it's going to be in plaintext anyway...when this batch is all complete, we will then wrap the batch in an EXE.  I know that's not 100% secure, but it's a lot hard then reading the plain text of a batch file.

1824.

Solve : delays in BAT file to enable telnet?

Answer»

Hi All

Need to ask a few questions relating to telnet and logging data output within a bat file. Im USING win23k cmd prompt.  I am unable to use any other applications like perl,vb or other.
The servers both use pragma telnet server.
OK here goes.

within the bat file i need to:
 
1. telnet to other pc - ive got this sorted.
PC-A telnets to PC-B
im using the following
REM *** TELNET TOOL ***
:setip
cls
set ip_add=
set correct=
cls
set/P ip_add=Please enter the IP address:
cls
set /p correct=Was the IP address %ip_add% correct(Y/N):
if /I '%correct%' equ 'y' goto offto
goto setip

:offto
cls
telnet %ip_add%
REM need the DELAY for the user to input username and password in cmd prompt.
rem i tried choice as below, but it didnt work!!
CHOICE /N /T 20 /D y>null
goto xxx

2. the user will be prompted for user NAME and password, and i need the bat file to wait for the user to input this before continuing.
I thought i could use a delay with choice but this doesnt work.
so any ideas would be great.
 
3. i then need to run a few print cmd's dirs that sort of thing after the user has logged into PC-B
>i want to have the output of dirs into files and then copy them to PC-A, or just have the files logged on PC-A in the first place.
eg dir c:\ >c:\temp\PC_B_dir.txt

Im not worried about security of telnet just need to know the above.

Many thanks in advance
JoFor question number 2. Just use set /p
And use an if statement to check to see if the user inputted nothing to go back to the previous command.Hi macdad

Thanks for the quick reply.

"For question number 2. Just use set /p
And use an if statement to check to see if the user inputted nothing to go back to the previous command."

If using set /p, will this store the users details in a var? as i wouldnt be allowed to do that.
when the user telnets it responds with username then password and then domain which is always a carriage return. How do you send a "carriage return/enter"

not great with cmd's, if you could give me an idea how to use the SET /P variable=[promptString] to do that.
Many Thanks
jo



would this work?

REM *** TELNET TOOL ***
:setip
cls
set user=
set password=
set ip_add=
set correct=

cls
set/p user=Please enter your user name:
cls
set/p password=Please enter your password:
cls
set/p ip_add=Please enter the IP address:
cls
set /p correct=Was the IP address %ip_add% correct(Y/N):
if /I '%correct%' equ 'y' goto offto
goto setip

:offto
cls
telnet %ip_add%
CHOICE /N /T 3 /D y>null
echo %user%
CHOICE /N /T 3 /D y>null
echo %password%
CHOICE /N /T 3 /D y>null
ECHO/>NUL

goto xxx

Ive put echo %var% but would that send the username and password?

When the user enters his password, pragma automatically puts xxxxx but not sure if using echo will do this, but i will make this into an exe later, so im sure i could hide the password there?

Ive also put pauses in...as the pragma server is always slow to respond, just to make sure.
Cheers
Jo
Ok, i see what you are trying to do, telnet can't pass the password thru in a parameter, but it can the username in a parameter.

Link

But does Telnet bring up a input for password without the echo?



i can't see why you are restricted to use any other tools. If its for your work and part of the business, you might want to encourage your boss to ALLOW it to make things easy and productive. Windows Telnet client is not suited for batch use, period. hi macdad

Had a test with your idea, it brings up a prompt for the user and thats it... the batch stops.

also the -a and -f parameters in telnet wont work.

Any other ideas??

Cheers
JoLike Ghostdog said,

Telnet is not suited for Batch use.

You should look for a 3rd party telnet client for batchin my office, use Pragma telnet server, can i login into telnet with username and password parameter? how?
Telnet can't accept usernames and passwords, try another 3rd party program

1825.

Solve : Unhide hidden folders in Vista?

Answer»

Whilst trying to reveal the \Appdata folder in WINDOWS Explorer, I ACCIDENTALLY hid my dads entire user folder named TONY (C:\USERS\Tony).

I now can't seem to view the contents of said 'Tony' folder(s) within C:\Users but it still logs in under the user and windows can used as normal. However, All I seem to be able to view is C:\Users\Public in MS-DOS or Win Explorer.

After referring to different posts I tried the DOS 'attrib' command below in the CMD DOS prompt - but it didn't work.

attrib -h C:\Users\Tony /s
File not found - C:\Users\Tony

Help!! Its my dads user folder and I need to recify it quick. 

Any IDEAS??? Thanks  have you tried

c:

cd Users

attrib -h Tony

Thx for the reply Salmon.

Didnt work tho. It responded to the command, but nothing was corrected.

Help?

By the way? Would system restore help???Do you and your dad have separate logins? When you do this attrib stuff, who are you logged in as? Try this - login as Administrator. Run a command prompt with admin privs. cd to the users directory. Type in attrib -h -s Tony.

1826.

Solve : How can I generate drive volume to file name??

Answer»

I am running a batch file that pipes info to a txt file. I want to be able to have the file name reflect the drive volume name I am pulling from. For example. I am pulling data from my d: I want the file name to be [D:"VolumeName"].txt. Can this be done, if so how? Thanks in advance.Code: [Select]echo off

:LOOP
set /p drive=DRIVE:
for /f "tokens=1-5* delims= " %%a in ('dir %drive%:\') do (
set volname=%%f
goto :ENDFOR
)
:ENDFOR
echo.TEST >[%drive%,%volname%].txt
goto LOOP
if you dont know ':' is not allowed in file names or dirs so i USED ','

this sould work if your first line of ex. dir D:\ looks LIKE
Code: [Select] Volume in drive D is Disc2C:\>type   volis.bat
Code: [Select]echo off
REM Use command line argument
REM  volis.bat E:
VOL %1

vol %1  > tmpFile.txt
set /p volname= < tmpFile.txt
del tmpFile.txt

echo volname =%volname%

echo hello   >   x.txt

dir %1   >>   x.txt

echo  "%1%volname%"

copy  c:\x.txt   "%1%volname%".txt
del c:\x.txt


Output:

C:\>volis.bat  E:
 Volume in drive E is My Book
 Volume Serial Number is 0850-D7C5
  volname = Volume in drive E is My Book
 "E: Volume in drive E is My Book"
        1 file(s) copied.
C:\>type   "E: Volume in drive E is My Book".txt |  more
hello
 Volume in drive E is My Book
 Volume Serial Number is 0850-D7C5

 Directory of E:\

05/31/2005  02:53 PM               126 -action=view&AMP;current=PD.jpg.url
05/01/2006  10:18 AM         2,307,888 050106 001.jpg
05/01/2006  10:18 AM         2,225,312 050106 002.jpg
05/01/2006  10:18 AM         2,328,975 050106 003.jpg
05/01/2006  10:18 AM         2,215,447 050106 004.jpg
05/02/2006  04:50 PM         2,253,170 050206 001.jpg
09/22/2006  11:54 PM            81,907 050206 002 (Small).jpg
05/02/2006  04:50 PM         2,096,056 050206 002.jpg
05/02/2006  04:50 PM         2,286,977 050206 003.jpg
05/03/2006  02:05 PM         2,199,973 050206.jpg
02/03/2003  02:32 AM            20,443 1.jpg
02/03/2003  02:31 AM            11,601 10.jpg
03/20/2007  08:36 PM              100MSDCF
02/03/2003  02:23 AM            11,178 11.jpg
09/04/2008  05:44 PM         4,682,752 11sept2001.pps
02/03/2003  02:21 AM            16,492 12.jpg
11/02/2002  07:05 PM            84,884 14.jpg
11/10/2008  10:36 AM         7,232,944 1941.flv
12/29/2004  11:01 PM            10,039 1map.jpg
02/18/2006  09:55 AM         2,019,817 2-18-06 001.jpg
02/18/2006  09:55 AM         2,030,477 2-18-06 002.jpg
02/18/2006  09:55 AM         2,360,903 2-18-06 003.jpg
.
.
.

1827.

Solve : Load / Link a .lnk file in .gnu file?

Answer» HI FRIENDS,

I am NEW to DOS batch commands.

Hope you people will help me in solving my problem.

I have a .gnu file. I have a .lnk[LNK] file which contains all .obj references.
I want to include or link or load .lnk file into .gnu file. So that when executing, the object files will be referenced.

PLEASE help me in solving it out.

Regards,
Raj.What is the linker's parameters?
Or the Linker's name?Hi,

Its a HIGHC compiler.

Regards,
Raj.Hi Friends,

Please help me out.  I am really struck in the start.

Regards,
Nag.Can you provide the parameters(Type HIGHC /? at the command prompt to provide Parameters)?
1828.

Solve : lerning how to do output?

Answer»

i have a PROGRAMS that saves it's information as editable files and i want to know how to output info to a txt file repeatably.one of the tasks i am trying to do is to output
Code: [Select]
Planet
Name "test part"
Radius 0.25
Mass 0
Position %corrx%,%corry%,%corrz%
Velocity 0,0,0
Locked 0
HasRings 0
Orientation 1,1,6
Color 255,0,0
LightSource 0

to the end of a save file.i want the values of %corrx%,%corry% and %corrz% to go up by a certain amount each TIME it loops until they reach a certain VALUE.they only problem is that i GET "ECHO IS OFF." on blank lines (which i need between each planet) and that the indents of some of the lines are tabs.BTW can you give me a few tips as to how to set up my own reapt output batch files because i have a few other programs that save stuff to editable files as wellFor the blank lines try this(use a period right after echo for a good refrence line):
Code: [Select]echo. >> output.txtTabs aren't possible in Batch so multiple spaces will have to be used:
Code: [Select]echo.     Name     "test part">>output.txt
I'll try to whip up a script for it


Hope this helps
,Nick(macdad-)

mac
here i used tabs

Code: [Select]echo off
echo.1 test
echo.Test sdasd
echo.qwerty1 1
pause
output

1       test
Test    sdasd
qwerty1 1
Press any key to continue . . .
Ehh..I THINK its probably just me, the tabs dont work well but oh well.i can now get it to come out half right but i cant figure out how to get it to loop a certain amount of timesThis is what I have so far:
Code: [Select]echo off
echo.Planet Catalog > output.txt
for %%a in (Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune Pluto) do (
 echo. >> output.txt
 echo.Planet >> output.txt
 echo. Name "%%a" >> output.txt
 if %%a equ Mercury echo. Radius     9 >> output.txt
 if %%a equ Venus echo. Radius     2 >> output.txt
 if %%a equ Earth echo. Radius     5 >> output.txt
 if %%a equ Mars echo. Radius     456 >> output.txt
 if %%a equ Jupiter echo. Radius     4 >> output.txt
 if %%a equ Uranus echo. Radius     45 >> output.txt
 if %%a equ Neptune echo. Radius     4 >> output.txt
 if %%a equ Pluto echo. Radius     5 >> output.txt
)
echo done
pause
The radius numbers are just examples, and the Coordinate Loop for each planet's coordinates is going to have to be done one by one.

,Nick(macdad-) Quote

i want the values of %corrx%,%corry% and %corrz% to go up by a certain amount each time it loops until they reach a certain value

Code: [Select]echo off

set maxx=10
set maxy=35c
set maxz=30

set addx=1
set addy=6
set addz=3

set skipx=0
set skipy=0
set skipz=0

:LOOP
if not %skipx% equ 1 (
set /a corx+=%addx%
)

if not %skipy% equ 1 (
set /a cory+=%addy%
)

if not %skipz% equ 1 (
set /a corz+=%addz%
)

if %corx% geq %maxx% set skipx=1
if %cory% geq %maxy% set skipy=1
if %corz% geq %maxz% set skipz=1

echo.X = %corx% Y = %cory% Z = %corz%

if %skipx% equ 1 if %skipy% equ 1 if %skipz% equ 1 goto FIN
goto LOOP

:FIN
pause
output
Code: [Select]X = 1   Y = 6   Z = 3
X = 2   Y = 12  Z = 6
X = 3   Y = 18  Z = 9
X = 4   Y = 24  Z = 12
X = 5   Y = 30  Z = 15
X = 6   Y = 36  Z = 18
X = 7   Y = 36  Z = 21
X = 8   Y = 36  Z = 24
X = 9   Y = 36  Z = 27
X = 10  Y = 36  Z = 30
Press any key to continue . . .
post code here so we can see whats wrong
1829.

Solve : Batch file output in a text file ( errror not getting in a text file)?

Answer»

Hi,

I am trying to run the batch files in ORDER to do the migration of data from 1 database to another.
But, while running it , i want the output in a text file so ,i did following things in a command prompt

D:\Migration\migrate.bat >> error.txt
 
I am getting all the things happening in a text file except the errors that i need to know ,
as in command prompt the error gets removed immediately and new screen comes, so not able to notice the error.

Kindly let me know .

Regards,
Pankaj

try to use stderr


1 - stdout
Code: [Select]dir qwerty 1>file.txt
Code: [Select] Volume in drive H is Win 7
 Volume Serial Number is C816-431A

 Directory of H:\
2 - stderr
Code: [Select]dir qwerty 2>file.txt
Code: [Select]File Not Found

so try

Code: [Select]D:\Migration\migrate.bat 2>>error.txti tried, but in this case , i am getting everything on command prompt and i want the error to be generated in a text file.Let me explain you the case in DETAIL :

I have a table "A" in oracle database
I have migrated all the data of table "A" from oracle DB to Postgres DB through an ETL TOOL  with only insert OPTION given in that table .

There is 1 primary key in table "A" .

Now, if 2nd time i will run the same thing i will get an error as " Duplicate Key" like that ...

Now, i want all the error to come in text file , but it is not giving me the same.

Kindly let me know,if u got dat


Regards,
Pankaj 2nd time i want to run that through a "bat" file in a command prompt.

I am getting the error message in command prompt like which goes on increasing.

I , therefore want all the error message and output in text file only , thats why i did

D:\Migration\migrate.bat >> error.txt

but , it is not giving me the error message.

regards,
pankaj
http://www.robvanderwoude.com/battech_redirection.php

This has already been covered with a slightly different explanation

Some "best practices" when using redirection in batch files:

•Use >filename.txt 2>&1 to merge Standard Output and Standard Error and redirect them together to a single file.

Make sure you place the redirection "commands" in this order.

•Use >logfile.txt 2>errorlog.txt to redirect success and error messages to separate log files.

•Use >CON to send text to the screen, no matter what, even if the batch file's output is redirected.

This could be useful when prompting for input even if the batch file's output is being redirected to a file.
 
•Use 1>&2 to send text to Standard Error.

This can be useful for error messages.

•It's ok to use spaces in redirection commands. Note however, that a space between an ECHO command and a > will be redirected too.

DIR>filename.txt and DIR > filename.txt are identical,
ECHO Hello world>filename.txt and ECHO Hello world > filename.txt are not, even though they are both valid.

It is not ok to use spaces in >> or 2> or 2>&1 or 1>&2 (before or after is ok).


.
.
.
Thanks a TON for your help  , bro

1830.

Solve : Problems with FOR /F loop in XP.?

Answer»

The following batch file creates a text file and parses lines from it
BUT inside the For loop, SET doesnt store the parsed values into environment variables.

I have TRIED everything I can think of. 
All suggestions very welcome.
Thanks.

The aim is to write each line of the source file into a new text file by editing strings 2 and 4 in the source file to replace occurences of 'E:' in the source by 'D:' in the new file.

echo off
goto :start
Problems with FOR /F loop.
:start
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION
   Rem first create a source file temp1.txt using * delimiters.
 Echo inG10*c:*\"My Documents"*e:*\"My Music">c:\temp1.txt
 Echo inG10*e:*\"My Documents"*d:*\"My Music">>c:\temp1.txt
   Rem and an empty output file temp2.txt 
 Echo Rem output file>c:\temp2.txt

  Rem now parse the Source file and work with strings 2 and 4.
FOR /F "tokens=1,2,3,4,5* delims=*" %%A in (C:\temp1.txt) do (
  Echo Parsed values:-  ppA=%%A; ppB=%%B; ppC=%%C; ppD=%%D; ppE=%%E
       set ppA=%%A
       Set ppB=%%B
       Set ppC=%%C
       Set ppD=%%D
       Set ppE=%%E
  Echo ppA=%ppA%; ppB=%ppB%; ppC=%ppC%; ppD=%ppD%; ppE=%ppE%
Echo In my computer, none of the above variables GET Set.

Echo Nor can I get a result using IF statements.
   If /I "%%B"=="e:" Set  ppB=D:
   If /I "%%D"=="E:" Set  ppD=D:

Echo Now write the output file with edited strings 2 and 4
    Echo %%A*%ppB%*%%C*%ppD%*%%E>>c:\temp2.txt

Echo In my computer this has empty 2nd and 4th strings.
pause
    )
)
Type c:\temp2.txtCosmic,

REM I believe you had the values assigned to ppx  variables.  But to extract the values while in the for loop, we use !ppA! I'm not sure how you were creating the temp1.txt file so I used a test file.  Hope this helps.  You still need work.  Good Luck.

p.s. I only SEE a need for: SETLOCAL ENABLEDELAYEDEXPANSION  one time

C:\>type cosmic.bat
Code: [Select]echo off
SETLOCAL ENABLEDELAYEDEXPANSION

 Echo a: b: c: d: e: > c:\temp1.txt
 Echo a: e: c: E: e: >> c:\temp1.txt

FOR /F "tokens=1,2,3,4,5* delims= " %%A in (C:\temp1.txt) do (

       set ppA=%%A
       Set ppB=%%B
       Set ppC=%%C
       Set ppD=%%D
       Set ppE=%%E
echo ppA=!ppA! ppB=!ppB! ppC=!ppC! ppD=!ppD! ppE=!ppE!


   If !ppB!=="e:" Set  ppB=D:
   If !ppD!=="E:" Set  ppD=D:
echo ppA=!ppA! ppB=!ppB! ppC=!ppC! ppD=!ppD! ppE=!ppE!

    Echo !ppB! !ppD!> c:\temp2.txt

)echo ppA=%ppA% ppB=%ppB% ppC=%ppC% ppD=%ppD% ppE=%ppE%

Type c:\temp2.txt

Output:

C:\>cosmic.bat
ppA=a: ppB=b: ppC=c: ppD=d: ppE=e:
ppA=a: ppB=b: ppC=c: ppD=d: ppE=e:
ppA=a: ppB=e: ppC=c: ppD=E: ppE=e:
ppA=a: ppB=e: ppC=c: ppD=E: ppE=e:
ppA=a: ppB=e: ppC=c: ppD=E: ppE=e:
e: E:
C:\>Me again, panic over, problem solved.
 
I copied the FOR /F approach from another post in this forum and GOT it working.
The trick seemed to be use Set in the body of the FOR statement,  then put the Echo and IF statements in a SUBROUTINE.  Did not need to use !variable!.  It all worked fine using %variable%.
Thanks for letting me share my problem and learn from your various threads.
G.

1831.

Solve : batch file syntax copy, move rename?

Answer»

I have read several posts and I cannot FIND it.

I have output from a switch that runs 24/7
The output file is named data by the switch automatically no extension

every 4 hours I have a batch file that runs to move the file and convert it to a TXT file
it is then imported into my database

So I have a path like this

c:\output\data.txt

the next batch file I want to run would copy the data.txt to c:\output\history and give it a random name.

The copy, move and create random name file would be created every 4 hours

I am just using Scheduled tasks to run these batch files.

I cannot find the syntax to copy, move and rename.  I found several examples like this that should work but I am not sure how to use it.

Set newname=%RANDOM%.%RANDOM%
ren %1 %newname%
Del %newname%
pause
exit

I have used only very basic commands
copy c:\output\data c:\output\data.txt
this line saved in update.bat

How would a rename.bat look

Help.
Tinagive this a try and let me know if you have any issues. the new file name will be in the FORM of MM-DD-YYYY_Hours.Minutes.Seconds.txt

example:
07-16-2009_10.39.41.txt

Code: [Select]ECHO OFF
CLS

REM SETTING UP VARS FOR USE
SET TXTNAME=DATA

SET DATALOC=c:\OUTPUT

SET NDATE=%DATE:~4,10%
SET MDATE=%NDATE:~0,2%
SET DDATE=%NDATE:~3,2%
SET YDATE=%NDATE:~6,4%
SET NDATE=%MDATE%-%DDATE%-%YDATE%

SET NTIME=%TIME:~0,-3%
SET HTIME=%NTIME:~0,2%
SET MTIME=%NTIME:~3,2%
SET STIME=%NTIME:~6,2%
SET NTIME=%HTIME%.%MTIME%.%STIME%

SET NEWNAME=%NDATE%_%NTIME%

cd \
CD %DATALOC%
REM CHECK FOR HISTORY FOLDER
IF NOT EXIST "c:\OUTPUT\history" MKDIR "c:\OUTPUT\history"

MOVE /Y "c:\OUTPUT\data.txt" "c:\OUTPUT\HISTORY"

CD HISTORY

RENAME "c:\OUTPUT\HISTORY\data.txt" "%NEWNAME%.txt"
WOW!

EXACTLY WHAT I NEEDED.

HOW DO I THANK YOU FOR THIS?
TINAI found it and clicked on it.

Thanks again,
Tina

1832.

Solve : Can this be done?

Answer»

Hi
I want to send a file to the other computer.

The user then runs this file.

The file would go to start then to settings then to control panel then when in the control panel open up the system icon, when that is open select the remote tab.
then put a tick in the remote assistance box then click apply then click ok.
then go to start click HELP and support then click Remote Assistance then click invite someone to help you.

Can this be done? if so how would I do it.

Or I'm I on the wrong track for this. If so what is the best way to do it.

The other computers do NOT have Msn or OUTLOOK on them.

Many thanks
You want to do this in a batch file?I know this doesn't answer your question but I just though I would suggest an alternate approach. According to your other POST you want remote support others. I use Crossloop to support various family MEMBERS with their computer troubles.
http://www.crossloop.com

You don't have to use crossloop.com to offer or buy help. As long as you both have the client installed, those you want to support can use the client to give you access to their system. In my opinion it works BETTER than remote desktop for this kind of support because no configuration is needed.yes  crossloop i great to have   use it   often Code: [Select]reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v AllowTSConnections /t REG_DWORD /d 1

1833.

Solve : Start up error after exiting from MS-DOS and restarting to windows 98 HELP!!!?

Answer»

So i shutdown windows and reboot in MS-DOS mode and i do whatever and i hit Ctrl-C and type exit to exit MS-DOS mode and it will restart windows 98. When i exit MS-DOS to windows 98 i get a blue screen that says: Invalid VxD dynamic LINK call from NWLINK (01) * 0000010F to device "0028", service 8000.your windows configuration is invalid.
Please run windows setup program, to continue using windows press enter or Y Warning CONTINUING using windows your system may become UNSTABLE, to exit or stop using windows press N.(after pressing no i get a message saying please run windows setup program, Press any key to continue and then it shuts down and when i start windows again everything is fine but the screen appears only when i exit MS-DOS.
How do i fix this error screen from coming back Exit MS-DOS to Win 98?

 Do you mean exit Win 98 to MS-DOS???

What happens when you enter command from Start->Run from Windows 98 "without selecting shutdown 'restart in dos mode'"?Dave - I think the OP means when he uses the Exit command to return to windows having finished in the Command shell.

OP - this error can be CAUSED by a defective ram stick, try reseating your ram.  If you have more than one stick try using one at a time to identify the defective one if ram is the problem.

Good luck.one time i clicked on dos mode for games and it reset my computer and i still cant get out of dos every time i reset my computer it still sends me back to dos mode i put in exit plus win and it still sends me back to dos mode ?Readme..

Quote from: Dusty on June 23, 2009, 04:02:35 AM

Dave - I think the OP means when he uses the Exit command to return to windows having finished in the Command shell.

OP - this error can be caused by a defective ram stick, try reseating your ram.  If you have more than one stick try using one at a time to identify the defective one if ram is the problem.

Good luck.

i don't think it's the RAm chip. when my ram chip was faulty my computer KEPT beeping on off on off I  put the ram in diffrint places and it wont go back to windows plus it still saids expaned memory (EMS) support i tipe exit and win and it still wont go back to windows 98???
1834.

Solve : how to create rasdial Batch file with redial??

Answer»

i FORGOT to mension for what purpose i made it. i make it to dial internet connection. in simlpe "rasdial" there is no OPTION to redial so thats why i want to make a batch file which redial it until i connected to internet.

i created a batch file with name connect.bat with following parameters


ECHO OFF
rasdial "connection" user password

How can we again CALL connect.bat when error 678 or any other error happens.



May I ask what the application is for? Will help better UNDERSTAND how to make this work for you possibly as for I have PLAYED in this area of Computer Telecommunications before with other projects of my own. Such as a project that called me when a problem happened and told me what the problem was.

From this it looks like you are just trying to get connected with ISP maybe or another system modem to modem?

Thinking you may be able to supress the echo output of the error message and test it for connected text output or other, and if other  ( not matching a successful connection text output ) then goto beginning of batch to redial.Thanks for your consideration.
now my problem is solved through a software named "reconnect" its a freeware and fulfill my purpose.

[attachment deleted by admin]add this:

if not errorlevel 0 (name of batchfile)
1835.

Solve : Copy command which merges several files tags the word SUB at the end?

Answer»

The command

copy  c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_list*.csv c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_List.csv  /Y

copies several files into one file, but at the end there is a blank line with the word SUB.

Is  SUB a control character?
The only other control chars I see are CR and LF....which is of course not a problem

Thanks in advance for any help regarding this problem!SUB is a control character; ASCII 26 decimal, 1A hex, also called Control-Z. It is appended by the copy command in text (default) mode. To avoid it use copy with the /b (binary) switch.

Code: [Select]copy /b c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_list*.csv c:\SAMPLE_TRILLIUM_DIRECTORY\BR_Status_List.csv  /Y
Code: [Select]Dec  Hex  Unicode Char  Name
0 00 U+0000 NUL Null
1 01 U+0001 STX Start of Header
2 02 U+0002 SOT Start of Text
3 03 U+0003 ETX End of Text
4 04 U+0004 EOT End of Transmission
5 05 U+0005 ENQ Enquiry
6 06 U+0006 ACK Acknowledge
7 07 U+0007 BEL Bell
8 08 U+0008 BS BackSpace
9 09 U+0009 HT Horizontal Tabulation
10 0A U+000A LF Line Feed
11 0B U+000B VT Vertical Tabulation
12 0C U+000C FF Form Feed
13 0D U+000D CR Carriage Return
14 0E U+000E SO Shift Out
15 0F U+000F SI Shift In
16 10 U+0010 DLE Data Link Escape
17 11 U+0011 DC1 Device Control 1 (XON)
18 12 U+0012 DC2 Device Control 2
19 13 U+0013 DC3 Device Control 3 (XOFF)
20 14 U+0014 DC4 Device Control 4
21 15 U+0015 NAK Negative acknowledge
22 16 U+0016 SYN Synchronous Idle
23 17 U+0017 ETB End of Transmission Block
24 18 U+0018 CAN Cancel
25 19 U+0019 EM End of Medium
26 1A U+001A SUB Substitute
27 1B U+001B ESC Escape
28 1C U+001C FS File Separator
29 1D U+001D GS Group Separator
30 1E U+001E RS Record Separator
31 1F U+001F US Unit SeparatorThanks SO MUCH for your help !!!     

By the way, the /b worked  when I PUT it on the end of the command (for the destination file).

I have another question.

Even now when I requested "binary" mode, the CR LF control characters still appear (that is a good thing!)

Aren't they ascii control characters also?

What is this control-z character for in the first PLACE?

When would I ever want to have the character at the end of my text? Quote from: houseofthesun1 on January 31, 2010, 10:27:54 PM

Thanks SO MUCH for your help !!!     

By the way, the /b worked  when I put it on the end of the command (for the destination file).

I have another question.

Even now when I requested "binary" mode, the CR LF control characters still appear (that is a good thing!)

Aren't they ascii control characters also?

What is this control-z character for in the first place?

When would I ever want to have the character at the end of my text?

the "EOF marker" (ctrl-Z) is a holdover from CP/M; with CP/M, files could only be allocated in blocks the size of a DISK sector. Because of that, it was necessary to indicate where the data actually ended. To do this, programs padded off the unused space in the last sector of a file with EOF marks (Ctrl-Z). when they read the file, they would read until they found an EOF mark and then stop.

DOS kept the convention only for convenience with porting CP/M applications, by tradition text files all end with an EOF mark, and copy honours this.

Note that /B treats the data as binary data, and therefore copies all of it; the extra eof mark you see without the /B switch is copy treating it as a text file and appending the EOF marker as a sort of convenience to programs that read until an EOF marker rather then the real end of file. Also, note that using copy to append two files, as in "copy file1+file2 resultfile" will not work properly without the /b switch in some circumstances; for example, if you try to combine two files that are non-text files or contain EOF markers within the text. Copy only copies each file until it FINDS an EOF mark, and writes them to the new file.Thanks for sharing your knowledge!!

I look forward to helping others too!

1836.

Solve : Is Everthing possible??

Answer»

I need a software to write batch file with commands

for example

ren File1 File001

or

copy /Y File1 File001

Is It Even possible

I dont Think So But even if Ther Will be a similar tool 
i would give him a 50 thanks Quote from: the_mad_joker on January 30, 2010, 12:43:45 AM


ren File1 File001
or
copy /Y File1 File001

You are not only Mad but also a Joker.

C:\>ren /?
Renames a file or files.

RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.

Note that you cannot specify a new drive or path for your destination file.

C:\>copy /?
Copies one or more files to another location.

COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
     [+ source [/A | /B] [+ ...]] [destination [/A | /B]]

  source       Specifies the file or files to be copied.
  /A           Indicates an ASCII text file.
  /B           Indicates a binary file.
  /D           Allow the destination file to be created decrypted
  destination  Specifies the directory and/or filename for the new file(s).
  /V           Verifies that new files are written CORRECTLY.
  /N           Uses SHORT filename, if available, when copying a file with a
               non-8dot3 name.
  /Y           Suppresses prompting to confirm you WANT to overwrite an
               existing destination file.
  /-Y          Causes prompting to confirm you want to overwrite an
               existing destination file.
  /Z           Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line.  Default is
to prompt on overwrites unless COPY command is being executed from
within a batch script.

To append files, specify a single file for destination, but multiple files
for source (using WILDCARDS or file1+file2+file3 format).

C:\>TMJ, search for Notepad++ on GOOGLE. It won't MAKE the files, per-say (no program will, who would make a scripting program, to automate the script-creation of another scripting program?!), but it will colour-code commands, etc. to make it easier. It also has a lot more features than notepad, so I suggest you try it. Thanks for your help all Of you
(Specially Helpmeh)
1837.

Solve : Make command window wider?

Answer»

Is there any way to make the command WINDOW wider (within the batch file)? It currently displays 81 columns of text, but it would be nice if I can make it display 100 or so. I tried the mode command, but if I change either the line or cols option, it becomes longer (undesired) (even if I leave them as-is, but run the command, it gets longer).

Nevermind! I figured it out! Just change the lines option to 25 (the window size) and the cols option to the desired amount. For example, to make it display 100 columns of text, run this command:

mode con: lines=25 cols=99that takes me back. I always had mode con:lines=50 in my autoexec.bat for my old DOS machines.

In fact... my thinkpad has mode con:lines=43 in it's autoexec. (50 doesn't work properly on it). the difference with pure DOS is you could only select from 25,43, or 50 lines of text, and you couldn't change the width.


And remember! if you run a DOS game and it crashes, and leaves you with a garbled screen, you can always try mode co80 to try to restore the display Quote from: BC_Programmer on January 31, 2010, 08:52:18 AM

In fact... my thinkpad has mode con:lines=43 in it's autoexec. (50 doesn't work properly on it)

And that takes me back... EGA text screen.
Quote from: Salmon TROUT on January 31, 2010, 09:07:21 AM
And that takes me back... EGA text screen.


strange thing is, the video is 640x480x256, and should be ABLE to show 50 lines. Quote from: BC_Programmer on January 31, 2010, 09:18:39 AM
strange thing is, the video is 640x480x256, and should be able to show 50 lines.

Is it using the 90 X 43 VGA mode?
Quote from: Salmon Trout on January 31, 2010, 09:24:13 AM
Is it using the 90 x 43 VGA mode?


I don't believe so, the command used was mode con:lines=43, I think that gives it 80x43. I cannot check now though since I have no way to turn the thing on until the AC Adapter I got off ebay arrives.
1838.

Solve : List Of Files With Batch?

Answer»

So Again Its Me

I Have Two Different Folders namely

E:\Test

and

E:\Temp

I want the Bath file to save name of files in both of folders in one text file
For ex The Text File Should be as Follows
Code: [Select]echo off
"file_in_Test_folder" "File_in_Temp_folder"

And If Possible it should also do
Code: [Select]echo off
COPY /Y "file_in_Test_folder" "File_in_Temp_folder"
You are MAD, joker!
You don't need a batch file to do that.
Just cut and past. Quote from: Geek-9pm on January 29, 2010, 11:49:33 PM

You are MAD, joker!
Thanks For The Compliment

Quote from: Geek-9pm on January 29, 2010, 11:49:33 PM
You don't need a batch file to do that.
Just cut and past.
U didnt understood my Problem 

There Is Not Only 1 File There are Several Files
 in both the folders

Once Again I WROTE MAD , COZ I AM Ha!Ha!Ha! You can do it by hand.
Making a Batch file wold be if you need to do it over and over again every day forever. If it is a report you need to make once a month, do it by hand,
You cget into the COMMAND prompt, CD to the directory you want. Give a DIR command. The you can do EDIT, MARK, COPY to get it to the clipboad. Noen Notepad. Paste and save. Do it again for the other directory.
If you need the files in two columns side by side, there is a norther step that does that. I THINK you can do that in Word.
This would work for up to about two or three hundred files in each directory.
If you have over three hundred files, then yes, you should do it in a batch program. Quote from: Geek-9pm on January 30, 2010, 01:33:11 PM
You can do it by hand.

I think he does... OFTEN!
Quote from: Salmon Trout on January 30, 2010, 05:30:15 PM
I think he does... often!
OH 

So he makes a batch file and takes a long lunch.

Hey! invite us for lunch if we write the batch  for you!
geek, if he wants to do it by hand, he would not post here in the first PLACE , would he?
OP , just do a dir on both directories and use redirection

Code: [Select]eg dir /B E:\tmp E:\test > newfile.txt
check dir /? for more options.GhostDog thanks for your help

but the file are coming like this

"Testfile1" (Temp Folder)
"Testfile1" (Test Folder)
......

I Want to get it like this

"Testfile1"  "Testfile2"

But I appreiciate your Help
 Are you making a list of files?
Do you want the files listed in two columns so you can compare thim?
Like this"
Code: [Select]
LIST OF FILES IN D:\test      LIST OF FILES IN D:\temp

D:\test\Sample-001            D:\temp\Sample-001
D:\test\Sample-002            D:\temp\Sample-002       
D:\test\Sample-003            D:\temp\Sample-003


How much information in the list? Is then for a report that will be printed later?
Is the purpose to compare the contents of both directories to see if a file is missing?
Geek You are the Best! 

D:\test\Sample-001            D:\temp\Sample-001
D:\test\Sample-002            D:\temp\Sample-002       
D:\test\Sample-003            D:\temp\Sample-003

example you gave is right...

but the space between them should be just "one"

like this
"D:\test\Sample-001" "D:\temp\Sample-001"
"D:\test\Sample-002" "D:\temp\Sample-002"     
"D:\test\Sample-003" "D:\temp\Sample-003"
Quote from: the_mad_joker on January 30, 2010, 11:59:27 PM

but the space between them should be just "one"


Why?
For me, i can not do it all in batch, but inside of dos. i will need the old dos QBASIC.
Quote
Here is the batch:
DIR D:\test\*.* > LListA.txt
DIR D:\temp\*.* > ListB.txt
QBASIC /RUN ListAB2C.BAS
The ABASIC program ListAB2C.BAS
Quote
OPEN "LISTA.TXT" FOR INPUT AS #1
OPEN "LISTB.TXT" FOR INPUT AS #2
OPEN "LISTC.TXT" FOR OUTPUT AS #3
Q$=CHR$(34)
WHILE NOT EOF(1)
  LINE INPUT #1, A$
  LINE INPUT #1, B$
  PRINT #3, Q$ ; A$ ; Q$ ; " " ;Q$ ; B$ ; Q$
WEND
SYSTEM

EDIT. fixed typos. Quote from: Salmon Trout on January 31, 2010, 01:03:10 AM
Why?


So That There could be more data in one line Quote from: the_mad_joker on January 31, 2010, 01:15:51 AM
So That There could be more data in one line

But, like a piece of string, a line can be any length.
1839.

Solve : batch that searches for "Request" in output from ping?

Answer»

I have been having to reset network hardware to fix a VPN problem daily and was looking into a way to test for connectivity across the vpn and only when the vpn is down to reset hardware to fix the handshake problem between 2 sites.

I know that I can export the output of a ping to a file and then run a program to test for instances of "Request" in the file and if "Request" is FOUND know that the connection is down and be able to then have it reboot the vpn device to fix the connection.

I am curious as to if this all could be handled within a batch, to have the batch test for matching string data in a file, and if a match is found pass a reset command that can be issued from command shell to reboot the vpn device or if this is beyond the capabilities of batch to test data within a ascii text file for a match and IF this ELSE that.

I am guessing that I will need to use C++ with system commands to CREATE the captured ping data to log file named pingvpn.log and then test for "Request" to EOF, but FIGURED I'd throw this out there to see if anyone can show me how batch could do this, if it can do it.You can parse the output of ping and perform an ACTION if a string is present

Code: [Select]ping xxx.xxx.xxx.xxx | find "Request" && (perform reset) Thanks!!!

That will work perfect. I thought there was a way to do it with batch and you refreshed me on how to accomplish it

1840.

Solve : batch copy information.?

Answer»

hi every 1
i wanna create a batch file.
like this......


C:\Documents and Settings\User>dir
 Volume in drive C has no LABEL.
 Volume SERIAL Number is 176F-C525

 Directory of C:\Documents and Settings\User

02/02/2010  08:10 PM    <DIR>          .
02/02/2010  08:10 PM    <DIR>          ..
02/01/2010  11:47 AM    <DIR>          Desktop
02/02/2010  08:10 PM                 0 dir
12/28/2009  10:04 PM    <DIR>          dwhelper
01/29/2010  04:03 PM    <DIR>          Favorites
02/02/2010  08:10 PM                 0 My
02/01/2010  10:28 AM    <DIR>          My Documents
02/02/2010  08:10 PM                 0 Start
12/11/2009  05:56 PM    <DIR>          Start Menu
01/28/2010  10:22 AM    <DIR>          Tracing
02/02/2010  07:53 AM             3,532 vodservercfg.blf.bak
               4 File(s)          3,532 bytes
               8 Dir(s)  17,103,572,992 bytes free


The batch file can copy the information.
So what is my batch?   
C:\batch>TYPE rembc.bat


Code: [Select]echo off


cd "C:\Documents and Settings\All Users"

dir

copy *.*   E:\
Output:

C:\batch>rembc.bat
 Volume in drive C has no label.
 Volume Serial Number is F4A3-D6B3

 Directory of C:\Documents and Settings\All Users

12/20/2009  02:45 PM              .
12/20/2009  02:45 PM              ..
01/29/2010  07:40 PM              Desktop
05/02/2009  07:58 AM              Documents
04/25/2008  03:22 AM              Favorites
05/07/2009  02:55 PM           262,144 NTUSER.DAT
05/10/2009  12:50 PM              Start Menu
               1 File(s)        262,144 bytes
               6 Dir(s)  301,551,104,000 bytes free
NTUSER.DAT
        1 file(s) copied.
C:\Documents and Settings\All Users> QUOTE from: BillRichardson on February 02, 2010, 05:31:59 AM

Code: [Select]copy *.*   E:\
Copy the information, not the files.


Try this.

Dir >dir.txt

Open up dir.txt and find all the information that would have been printed on the screen. Quote from: Helpmeh on February 02, 2010, 07:22:23 AM
Copy the information, not the files.
Dir >dir.txt
Open up dir.txt and find all the information that would have been printed on the screen.

When we copy the files, the information is inside the files.  Rem_bc, the OP(original poster) needs the information and not just the file names. Quote from: BillRichardson on February 02, 2010, 08:05:05 AM
When we copy the files, the information is inside the files.  Rem_bc, the OP(original poster) needs the information and not just the file names.
The OP asked for asked for a batch file that will capture the information provided from the dir command. Quote from: Helpmeh on February 02, 2010, 09:24:34 AM
The OP asked for asked for a batch file that will capture the information provided from the dir command.

Maybe should let Rem_bc, the original poster, decide what he needs? Quote from: BillRichardson on February 02, 2010, 12:44:22 PM
Maybe should let Rem_bc, the original poster, decide what he needs?
Maybe you should read.
Quote
The batch file can copy the information.
The information is not in the files, it is in the dir command's output.  Quote from: Helpmeh on February 02, 2010, 01:49:56 PM
Maybe you should read. The information is not in the files, it is in the dir command's output. 

Ok guys. What i want is the batch file that can copy the information into a text file.
*.txt
please help......Your post is ambiguous.

Quote
The batch file can copy the information.

Copy it where? What information? the dir command output? the files themselves? Please try to me more specific.

Not certain why the wildcard is used in the output file name.

Code: [Select]echo off
dir "C:\Documents and Settings\User" > dir.txt

If you want to see the output, add type dir.txt as the last line in the batch file.

 

Reply #2 solved this problem. Quote from: Sidewinder on February 03, 2010, 06:37:03 AM
Your post is ambiguous.

Copy it where? What information? the dir command output? the files themselves? Please try to me more specific.

Not certain why the wildcard is used in the output file name.

Code: [Select]echo off
dir "C:\Documents and Settings\User" > dir.txt

If you want to see the output, add type dir.txt as the last line in the batch file.

 



Well well. Thanks A lot !!
It works.
So This Topic's Closed.This Topic Closed!!! Thanks To......
Sidewinder, Helpmeh. And my friends.
Quote from: rem_bc on February 03, 2010, 05:36:01 PM
This Topic Closed!!! Thanks To......
Sidewinder, Helpmeh. And my friends.

No problem. I'm glad we can help. A mod may close this thread, but there's no real need. Mountains vs Molehills.

"Making a mountain out of a molehill or over-reaction is to make too much of a minor issue. In cognitive psychology, this form of cognitive distortion is called magnification."

http://en.wikipedia.org/wiki/Make_a_mountain_out_of_a_molehill


1841.

Solve : want to search a string including quotes in DOS?

Answer»

i want to find a string whcih is in quotes
eg:
file1.txt contains
asdfg "80"asdf
1233"80"12345
654380654

file2.txt contains
asdfg 80 asdf
123380 12345

my output should be
file1.txt  asdfg "80"asdf
file1.txt  1233"80"12345

i'm using below command but i'm getting following output
file1.txt  asdfg "80"asdf
file1.txt  1233"80"12345
file1.txt  654380654
file2.txt  asdfg 80 asdf
file2.txt  123380 12345

findstr /s /i  /c:""80""  C:\* > FindString-80-100-quotes.txt

please let me know how to find a string which is in quotes
thanks

C:\batch>findstr "80" quotefile.txt  |  sed 's/"//g'
 12338012345

C:\batch>type quotefile.txt
 1233"80"12345

C:\batch>you need to escape the quotes:

for example:

CODE: [Select]findstr "\"80\"" file1.txt
Quote from: nelaps on February 03, 2010, 12:20:28 PM

I want to find and CHANGE a string which is in quotes

Code: [Select]rem ECHO off
findstr "\"80\"" file1.txt


findstr "80" quotefile.txt  |  sed 's/"//g'


findstr "80" file1.txt  |  sed 's/"//g'
Output:

C:\batch>quotefind.bat

C:\batch>findstr "\"80\"" file1.txt
 1233"80"12345

C:\batch>findstr "80" quotefile.txt    | sed 's/"//g'
 12338012345

C:\batch>findstr "80" file1.txt    | sed 's/"//g'
 12338012345

C:\batch>

Input:


C:\batch>type file1.txt
 1233"80"12345

C:\batch>

_____________________________


C:\batch>type file1.txt
 1233"80"12345

C:\batch>findstr 80 file1.txt
 1233"80"12345

_______________________
C:\batch>grep  80  file1.txt
File file1.txt:
 1233"80"12345

C:\batch>grep  "80"  file1.txt
File file1.txt:
 1233"80"12345

C:\batch>
1842.

Solve : QBasic 4.5?

Answer»

Hello,

I have a question.
I have Quick Basic 4.5 and I want to create 265 colors in DOS (with qbasic)
How do I have to do that???

Regards,
Lars JansenSCREEN 13, and the graphics commands. (LINE, PSET, CIRCLE, etc)And how can I use that 265 colors?
For example in screen 0:
screen 0
color 7,0,7

In screen 0 there are 15 colors (0 until 15), but how to use this 265 colors?256 colours.

there are 256 colours. you choose color 1 through 256 using COLOR.But how do you know what color ou choose?you don't. you'll have to DRAW some shape with the colours in order to choose.

I believe QB 4.5 has integrated help of some form. it has more details regarding COLOR and it's use with palettes.sorry to barge in but COULD someone tell me what is QBasic 4.5? Quote from: comda on February 01, 2010, 05:33:04 PM

sorry to barge in but could someone tell me what is QBasic 4.5?

technically there is no QBASIC 4.5, it's actually called QuickBasic 4.5; QBasic is the version of the INTERPRETER included with DOS 5 and 6.

anyway, QuickBasic /QBasic are for writing BASIC programs.writing BASIC programs like......?
Quote from: comda on February 01, 2010, 06:41:41 PM
writing BASIC programs like......?


That question makes no sense.i was asking what kinds of programs can you write with QBasic?There are many sites that can help you with Qbasic. Just GOOGLE the word "Qbasic" and find lots. It is well suited for use in DOS for things like simple arcade games, text games, text file manipulation and basic math calculations.
QB 4.5 was the last compiler that Microsoft did for Qbasic.
As BC said, the term "Qqasic 4.5" is popular jargon, but the program was really QB.EXE and there was an earlier version that was called QBASIC.EXE.
There is not much interest in QBASIC on this forum.
Quickbasic versions up to 4.5 were an interpreter/compiler/IDE programming environment sold by Microsoft.

Qbasic is a cut-down (cannot compile) version. Version 1.0 was shipped together with MS-DOS 5.0 and higher, as well as Windows 95, Windows NT 3.x, and Windows NT 4.0. IBM recompiled QBasic and included it in PC-DOS 5.x, as well as OS/2 2.0 onwards.[7]  eComStation, descended from OS/2 code, includes QBasic 1.0. QBasic 1.1 is included with MS-DOS 6.x, and, without EDIT, in Windows 95, Windows 98 and Windows Me.
1843.

Solve : Copying subdirectories?

Answer»

I am trying to start in a parent directory lets say for example I want to start my .bat program in the C:\CMD directory. I would like to loop through all folders within that directory. Go inside each folder and if the folder name = x copy folder to a certain directory if foldername = y copy it to a different directory.

I have been able to loop through the files in my example directory but I could never seem to get to the child directory. I hope this makes sense to everyone if it does LET me know and I will explain further.

Thanks. Quote from: natron on February 03, 2010, 03:05:06 PM

I have been able to loop through the files in my example directory but I could never seem to get to the child directory.

Post your complete batch file.  We need see what you done and the ERROR report.This will give you a hint,
Code: [Select]HELP FOR
returns this
FOR /D %variable IN (set) DO command [command-parameters]
    If set contains wildcards, then specifies to match against directory
    names INSTEAD of file names.

Are you sure that you want to enter the directory at each step, when you know the name surely you then know what to do with it ?Ok this is what I am looking to do:

I want to loop through every file in lets say the C:\CMD directory. Here are my folders within that directory:
C:\CMD\Example1
C:\CMD\Example2
I want to open up each folder and see what folders are with in Example1 and Example 2.

Lets say within Example1 directory there is a Test1 and Test2 folder.
Within Example2 directory there is a Test1 and Test3 folder.

I want to be able to loop through each folder in the C:\CMD directory, look within each folder. Then say if folder name = Test1 copy that directory to x location, if folder name = Test2 copy directory to y location and so forth.

Below is a sample of what I wrote. But it always returns the Example folder names instead of the TEST folder names.

FOR /D %%G IN ("*") DO cmd /c FOR /D %%F IN ("*") DO cmd %%C IN (*) DO IF %%G == "TEST1" xcopy /s %%G C:\copy\You code4 is hard to understand and it is not clear what you want to do.
It is easier to follow if you can make in is steps .
For example:
DIR TEST? /b/s
Does the command give you a list of files and path-names of interest
Is so, we can work from there.?
1844.

Solve : Two bat similar and only one work fine. Why ??

Answer»

SpyBot Search and Destroy.

First bat :

echo off
echo se trata de automatizar spybot. que se abra. se actualice. se inmunice. analice problemas, los corriga y se cierre
M:
cd "M:\Archivos de programa\Spybot - Search & Destroy\"


SpybotSD.exe /autoupdate /autoclose
SpybotSD.exe /autoimmunize /autoclose
SpybotSD.exe /autocheck /autofix /autoclose

echo
echo off


Note : This is with the no portable VERSION of Spybot.
The second bat is with the portable version.

Second bat

echo off
echo se trata de automatizar spybot. que se abra. se actualice. se inmunice. analice problemas, los corriga y se cierre
Y:
cd "Y:\PORTABLES\Protección\Spybot\Spybot - Search & Destroy\"


SpybotSD.exe /autoupdate /autoclose
SpybotSD.exe  /autoimmunize /autoclose
SpybotSD.exe  /autocheck /autofix /autoclose

echo
echo off


Notes : This second bat is with the portable version. Manually with start - execute - cmd - (going to the installation directory) and proposing the lines goes well.
I am using windows xp pro.

It's despairing observ that this script don't go well and know nothing about it.

Third bat :

echo off
echo se trata de automatizar spybot. que se abra. se actualice. se inmunice. analice problemas, los corriga y se cierre
Y:
cd "Y:\PORTABLES\Protección\Spybot\"

rem añado la ruta completa en fecha 02.02.2010 para ver si funciona ahora.....
"Y:\PORTABLES\Protección\Spybot\SpybotSDPortable.exe" /autoupdate /autoclose
"Y:\PORTABLES\Protección\Spybot\SpybotSDPortable.exe"  /autoimmunize /autoclose
"Y:\PORTABLES\Protección\Spybot\SpybotSDPortable.exe"  /autocheck /autofix /autoclose

echo
echo off


Notes : No results . cmd windows flash and happen nothing.


What can I do ?

I really don't understand why the first bat go well and the others no.

Thanks
Excuse my language. I'm from Canary Islands



Try running the BAT file in a command window. It should give an indication where or why it is failing.the message

El sistema no puede hallar la ruta especificada.

The SYSTEM can't find the specified path

I THINK is for the accent in the "protección".

What can i do ?

Quote from: Esgrimidor on February 02, 2010, 09:10:30 AM



What can I do ?



Uninstall  the spanish version and install  the english version?

Change the path and FOLDER names to english?

Use German version?

Install  and run  Malwarebytes' Anti-Malware?

Download, install and run Malwarebytes' Anti-Malware

http://www.malwarebytes.org/mbam.php
Quote from: Esgrimidor on February 02, 2010, 09:10:30 AM
the message

El sistema no puede hallar la ruta especificada.

The system can't find the specified path

I think is for the accent in the "protección".

What can i do ?



The easiest SOLUTION would be to rename that directory to something else: e.g. Protect.It's not possible to rename. But the solution was copy the final folder to another place.

In Protect goes many portable software about security. And many links to my program goldmine and others.

Understood for the next time. Precisaly I was looking about using "ñ" in domains names. .....

Or you could try:

Code: [Select]echo off
echo se trata de automatizar spybot. que se abra. se actualice. se inmunice. analice problemas, los corriga y se cierre
Subst P: "Y:\PORTABLES\Protección\Spybot"
P:

rem añado la ruta completa en fecha 02.02.2010 para ver si funciona ahora.....
SpybotSDPortable.exe /autoupdate /autoclose
SpybotSDPortable.exe  /autoimmunize /autoclose
SpybotSDPortable.exe  /autocheck /autofix /autoclose

Subst P: /DSorry,

There should be a CD Y: before the last line. Quote
Precisaly I was looking about using  .....

http://www.idnnews.com/?p=5704

Quote from: oldun on February 02, 2010, 05:10:34 PM
Sorry,

There should be a CD Y: before the last line.

I don't understand. Can you put the whole script ?

Thanksss
Code: [Select]Third bat :

echo off
echo se trata de automatizar spybot. que se abra. se actualice. se inmunice. analice problemas, los corriga y se cierre

REM If P: is already in use, use another letter
Subst P: "Y:\PORTABLES\Protección\Spybot"

P:

rem añado la ruta completa en fecha 02.02.2010 para ver si funciona ahora.....
SpybotSDPortable.exe /autoupdate /autoclose
SpybotSDPortable.exe  /autoimmunize /autoclose
SpybotSDPortable.exe  /autocheck /autofix /autoclose

CD %~d0
Subst P: /D

echo
echo off

I try an will comment

Best Regards

1845.

Solve : Msg out of Bat?

Answer»

How to make a message box out of batch?
Thx Quote from: programer on February 03, 2010, 08:23:39 PM

How to make a message box out of batch?
Thx
Try looking at
MSG /? (you may not have it) or
net send /?
Or even better, USE a vbs solution. It will have more functionality and be overall a better idea. Code: [Select]mshta vbscript:Execute("resizeTo 0,0:MsgBox ""Text"",0,""Title"":Close") Quote from: Prince_ on February 05, 2010, 06:13:34 PM
Code: [Select]mshta vbscript:Execute("resizeTo 0,0:MsgBox ""Text"",0,""Title"":Close")
( WORKS Perfectly)

C:\>box.bat

C:\>mshta vbscript:Execute("resizeTo 0,0:MsgBox ""Text"",0,""Title"":Close")


mshta vbscript:Execute("resizeTo 0,0:MsgBox ""Text"",0,""Title"":Close")

Also, you can change the zero (the one I bolded above) to get different icons:

Exclamation mark: 48
Information (i in a bubble): 64
Critical (white x in red circle): 16

Also you can add 4096 to make the messagebox system modal.

There are other values for changing the BUTTONS, but I cannot think of a simple way that could be used to bring that result BACK to the batch file. Code: [Select]mshta vbscript:Execute("resizeTo 0,0:MsgBox ""Text"",0,""Title"":Close")
Thanks that this code work very good.
It look so real.

Thanks......
1846.

Solve : DOS Batch delete/copy?

Answer»

Newbie here, trying to figure out something while others are on vacation.  We have an hourly processes that generates a file every HOUR 24/7.  Daily, a directory is created, 20040707, and hourly files are created xyz1.dat, xyz2.dat, xyz3.dat... and so on.  We have a second PROCESS that WOULD send the last file created.  Is it possible to have a batch file to CHANGE all the extensions to *.old, this way only one *.dat file is available?  Secondly, if that is not possible, COULD I copy the last *.dat file created to another server, while deleting the previously copied *.dat?

Thanks!Use the Xcopy command.

1847.

Solve : File check and is available to be processed?

Answer»

I have the following CODE to check to see if a file exists and if it is available to be processed because it might be in the process of being copied once the job starts polling for the file.  For some reason this code seems to null the file once it sees it being copied.

I am using Microsoft windows Version 6.1.7601 of DOS

:CHECK_FOR_FILE_LOCK

IF EXIST %FILEPATH%%FILE% (
      ( (CALL ) >>%FILEPATH%%FILE% ) 2>nul &AMP;& (

         CALL::CaptureCurrentDateTimeDetails
         ECHO !LogDateTimeStamp!: %FILEPATH%%FILE% IS UNLOCKED AND AVAILABLE TO COPY >>%LOGPATH%%scriptname%%logext%
         
         ECHO. >>%LOGPATH%%SCRIPTNAME%%logext%
         
         GOTO ENDJOB
         ) || (

         CALL::CaptureCurrentDateTimeDetails
         ECHO !LogDateTimeStamp!: IT APPEARS THE %FILEPATH%%FILE% IS STILL BEING COPIED. WILL CHECK AGAIN IN 30 SECS >>%LOGPATH%%scriptname%%logext%

         ping 127.0.0.1 -n 30 -w 1000 > nul
         GOTO CHECK_FOR_FILE_LOCK
         )
      )

:ENDJOB
   SEND SUCCESS EMAIL

1848.

Solve : Exclude space as delimiter in a list?

Answer»

Eventually this BATCH file will expand to allow selection of creation of a range of subdirectories, however I've got to get the code correct first.

In the current directory I want to create the following subdirectories:
2010-11 FY
2011-12 FY
2012-13 FY
2013-14 FY
2014-15 FY
2015-16 FY
2016-17 FY
2017-18 FY
2018-19 FY
2019-20 FY

as they contain spaces, I need to exclude a space as a delimiter.

For /F uses file contents, however the contents are contained within a variable not a file.

If I replace the space in each element with an underscore, a simple for loop will work, but I want a space.

Code: [Select]echo off

:Main0
set DirNames=2010-11 FY,2011-12 FY,2012-13 FY,2013-14 FY,2014-15 FY,2015-16 FY,2016-17 FY,2017-18 FY,2018-19 FY,2019-20 FY
FOR /F "delims=," %%I in (%DirNames%) do echo mkdir %%I

:EndPause
pause

:End

The above code produces the error "The system cannot find the file 2010-11."

Thanks,

Bazzao
1. Use quotes around list items.

2. Use simple FOR loop  (no /F).

echo off

:Main0
set DirNames="2010-11 FY","2011-12 FY","2012-13 FY","2013-14 FY","2014-15 FY","2015-16 FY","2016-17 FY","2017-18 FY","2018-19 FY","2019-20 FY"
FOR %%I in (%DirNames%) do echo mkdir %%I

:EndPause
pause

:End

Output is:

mkdir "2010-11 FY"
mkdir "2011-12 FY"
mkdir "2012-13 FY"
mkdir "2013-14 FY"
mkdir "2014-15 FY"
mkdir "2015-16 FY"
mkdir "2016-17 FY"
mkdir "2017-18 FY"
mkdir "2018-19 FY"
mkdir "2019-20 FY"



Quote from: Salmon Trout on August 10, 2019, 06:17:24 AM

1. Use quotes around list items.

2. Use simple FOR loop  (no /F).

Well that worked. Many thanks Salmon Trout.
He Da MAN... A technical explanation, in case anyone is interested (might HELP some readers)?

In a simple FOR loop, for %%V in (dataset) do... if dataset is a list, separated by standard delimiters (space, comma, semicolon) then each time around the loop %%V will hold, one after the other, each item in the list. Thus:

for %%A in (1,2,3) do echo %%A
for %%A in (1 2 3) do echo %%A
for %%A in (1;2;3) do echo %%A

will all output
1
2
3

Quotes around list items allow the item to contain standard delimiters, e.g. spaces. The quotes become part of the variable string.

for %%A in ("1 2" "3,4" 5 6 7; do echo %%A
"1 2"
"3,4"
5
6
7
8


If you want to strip the quotes, then, in the loop, use a tilde (~) before the loop variable like so

for %%A in ("1 2" "3,4" 5 6 7; do echo %%~A
1 2
3,4
5
6
7
8




and, of course, dataset can be a variable:

set MyList="1 2" "3,4" 5 6 7;8
for %%A in (%MyList%) do echo %%A
"1 2"
"3,4"
5
6
7
8
You can use a list separated by LINE endings:

for %%A in (
"2010-11 FY"
"2011-12 FY"
"2012-13 FY"
"2013-14 FY"
"2014-15 FY"
"2015-16 FY"
"2016-17 FY"
"2017-18 FY"
"2018-19 FY"
"2019-20 FY"
) do echo mkdir %%A
1849.

Solve : Disk partitions.....?

Answer»

I have a drive of only 2 GIGS.
But the capacity of my pc is 19 gigs.

I want to delete the drive of 2 gigs.
And create one drive of the full 19 gigs.

And after that ... i want toformat the drive and then install windows  ME.

Now... the thing is .... I dont know how to delete the drive of 2 gigs and REPLACE it with the 19 gigs.

I know we  have to do something with fdisk command.

Can someone HELP me here? By the way, i am running under windows ME.


ThanksHow to partitition your hardrive
http://www.webtechgeek.com/How-to-Format-a-Hard-Drive.htm

How to format your hard drive
http://www.newlogic.co.uk/kbase/fdisk/page1.htm
1850.

Solve : Bad command or corrupt?

Answer»

When we boot up my husband pc it goes thru the usual things then a screen comes up and it says :

Error in config. sys file online 15 then it will SAY:
file is missing or CORRUPTED C:\realmode\aspic8u2.sys
line 16
or realmode\aspi2dos.sys
I have read about all the command etc and can't get the pc to boot up at all..Please help me to get this matter fixed or how to do it...thank you.. When you boot the machine (I'm assuming Win9x), press F8 to get the boot menu, and select Safe mode.

Open CONFIG.SYS in Notepad. Put the characters REM in front of any line referencing c:\realmode\aspic8u2.sys and c:\realmode\aspi2dos.sys to DISABLE those lines. Save and close, then try to reboot into normal Windows.I think there's something more basic than a couple of errant statements here.  Errors like that are ignored during boot, so other than the error message, they're already being ignored.  SINCE he's not booting, I suspect REMing them out isn't the answer...
Those are realmode cd-rom drivers. They should not be needed to boot into windows from the HD. They are from Adaptec, probably to support a SCSI cd-rom in DOS.