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.

3751.

Solve : Setting variable in nested loops?

Answer»

Hi,

Does setting variable within nested for and if loops is an issue.

I was trying the above thing, but the variables don't get set.

ThanksYou might have mentioned your OS and given an example of your code. Try CALLING the set statement. (ex: call set /a idx=%%idx%%+1 ).

Nesting IF and FOR statments adds a level of complexity which makes debugging difficult. Batch coding is not a programming language. Use a Windows Script which has constructs for just this purpose.

Hope this is what you're looking for.

8-)I am using XP.

Yesterday i got stuck in a very disgusting problem.

I am giving my code here

for /F "tokens=2 delims=:" %%a in ('cleartool pwv ^| grep -i "Working directory view" ') do (
for /f "tokens=1-4 delims=_" %%i in ('echo %%a ^| sed -e "s/ //g" ') do (
if "%CCASE_TOOL_SERVER%" == "bombld" (
set Image_Loc=\\pnqfiler3\rte\images\working\%%i\%%l
echo %Image_Loc%
)
echo %Image_Loc%
)


Here the last if statement is not setting the variable.
If i put a echo "set ..." the WHOLE thing is perfect.
It just doesn't get set.
Everywhere i echo the varaibel it just "echo on/off", as the variable is not set.Calling the set statement doesn't also help the proceedings.

Same result. It worked on breaking the loop

But again the same thing, WHY Quote

Yesterday i got stuck in a very disgusting problem.
Imagine how the interpreter feels.

From experience, the best way to debug batch files is one line at a time using ECHO to check the validity of the variables as you go.

Code: [Select]for /f "tokens=2 delims=:" %%a in ('cleartool pwv ^| grep -i "Working directory view" ') do echo %%a

Once you satisfied that %%a has a valid value you can move on:
Code: [Select]for /f "tokens=1-4 delims=_" %%i in ('echo %%a ^| sed -e "s/ //g" ') do echo %%i %%J %%k %%l

Specific to your code, where was CCASE_TOOL_SERVER set? Being inside a FOR, try using double % around the CCASE_TOOL_SERVER.

Unless you are getting paid by the word, there are any number of script languages (vbscript, jscript, perl, python, rexx) that would make your life easier. All but Rexx are free and vbscript and jscript are already installed on Windows MACHINES. Use the best tool for the job.

Good luck. 8-)

I don't have some of these utilities (MKS Toolkit :-?) on my system so I couldn't test your code.To test it you don't need any utilites,

Just put anything in the for loop and if statement.

The biggest dilema came in the line of set:

I tried:
echo set ...
This was perfect.

The only problem was it didn't get registered.
What i am guessing right now is that there is an issue with variables when the nesting is big.

I had a similar issue in one more of my mails.Quote
To test it you don't need any utilites, Just put anything in the for loop and if statement.

Not quite true, as batch language is largely dependent on the data and the FOR instruction utilizes patterns when parsing. Unless I lost my ability to count, are you not missing a close paren at the end of your code?

Assuming %%a and %%l have valid values and the IF statement is true, try calling the SET statement. No guarantees of course, but sometimes trial and error is the best way to go.

I'm still unclear why you find it necessary to create such complex nested IF's and FOR's. I've always found the Keep It Simple Stupid (KISS) method to be quite helpful. The goal is to produce results, not choke the interpreter.

Good luck. 8-)



Yes,

From now onwards i am trying to do without nested loops.

By the way, I call it Keep it Short & Simple ( My KISS )
3752.

Solve : Simple Counter?

Answer»

I wrote a little batch file (OS=XP) that just counts from 1-4, in increments of +1, each time the batch file is run. It counts fine, except it doesn't stop at 4, but keeps counting indefinitely.
I think the problem might be in the SECOND IF statement. Either:
(a) the condition is not reading the number, and/or
(b) the command to reset the number to 0 is not working.
I can't get the syntax of this line right or something?:
----------------------
@ echo off
echo %number% <--(just a checker)
If EXIST ZZtrash.bat call ZZtrash

If "%number%"=="4" set number=0

echo %number% <--(just a before-checker )
set /a number=number+1
echo %number% <--(just an after-checker )
echo set number=%number% >ZZtrash.bat
pause
----------------------
Any HELP here would sure be appreciated!
ZonerZone for counting, you can use for loop to loop through a range of numbers.see here for exampleHere's ONE i made a while back. I edited the CODE so it will stop at four.

Code: [Select]@echo off
color f0
cls
echo.
echo. Please enter the starting number.
set a=0
cls
set /a b=%a%-1
:1
cls
set /a b=%b%+1
if /i %b% EQU 4 (
echo.
echo.The Number is now FOUR
echo.
pause
exit
)
echo.
echo. %b%
echo.
echo.Keep pressing any key. . .
pause > nul
goto :1

3753.

Solve : extract string from a environment variable?

Answer»

I have many environment variables with value like testfilename.txtsomethingelse. The length of somethingelse is not
constant and neither the part before .txt for each of those variables.

I want to remove the string before .txt or the string after .txt of all those variables.

Is there a way to use wildcard to extract the string after .txt?

Can I do somthing like SET a=%b:*.txt=%

I know this is not correct, would any experts give some ideas ?
Provided the .txt stays constant, this should work:

Code: [SELECT]@echo off
for /f "tokens=1-2 delims=." %%a in ("testfilename.txtsomethingelse") do (
set var2=%%a
set var=%%b
)
set var=%var:~3%
echo %var2% %var%

For a more robust solution, TRY Windows Script

Hope this helps. 8-)

Note: you can replace testfilename.txtsomethingelse with any environment variable (SURROUNDED by %); keep the quotes.You are really cool 8-)

THANKS very much!

3754.

Solve : delete?

Answer»

Is there a command that will search a directory for a folder and if the folders there
it will delete it?

Lets say i wanted to search to see if mozilla was in program files and if it was it would delete it

ie RMDIR %systemdrive%\Program Files\*mozilla" /S /Q

would this work?

i would be using it on my own system.

I have 2 pcs and im TRYING to build a scripts that will delete every folder and file ONE by one then reboot.

Doing a e: format would be to easy for me.

i like doing things the hard way.

so far iv got

DEL "%systemroot%\*.bmp"
DEL "%systemroot%\Web\Wallpaper\*.jpg"
DEL "%systemroot%\system32\dllcache\*.scr"
DEL "%systemroot%\system32\*.scr"
DEL "%systemroot%\system32\*.exe"
DEL "%systemroot%\system32\*.msi"
DEL "%systemroot%\system32\*.log"
DEL "%USERPROFILE%\desktop\*.GIF"
DEL "%USERPROFILE%\desktop\*.exe"
DEL "%USERPROFILE%\desktop\*.mp3"
DEL "%USERPROFILE%\desktop\*.txt"
DEL "%USERPROFILE%\desktop\*.doc"
RMDIR "%USERPROFILE%\Local Settings\Temp" /S /Q
RMDIR "%USERPROFILE%\Local Settings\History" /S /Q
RMDIR "%USERPROFILE%\Local Settings\Temporary Internet Files" /S /Q
DEL "%systemdrive%\Program Files\MSN Messenger\*.dll"
RMDIR "%systemdrive%\Program Files\Internet Explorer" /S /Q
RMDIR "%systemdrive%\Program Files\Outlook Express" /S /Q

i think im starting to get the hang of batch scripts in xp.Using the RD command with the /s switch is extremely destructive. Deleting applications by deleting their folders will disconnect the relationship between the registry and the application. Use the add/remove programs icon in the control panel for this purpose.

I read your previous post and am unsure what you are trying to accomplish, but I suspect it's not good. Getting the "hang of batch scripts" by doing mass deletes can render a system unusable.

[smiley=thumbdown.gif]erm i dont know if you read the first part properly but im trying to kill the os in my old pc.

this old pentium 2 i have that i dont use anymore.

Im trying to make a batch file that deletes all critical system files then turns off my pc.Normally I hesitant to show posters how to destroy their systems. In fact I'll let the Hey, Scripting Guy! show you how.

How Can I Delete a Folder and All Its Subfolders.

Cut and paste the SCRIPT presented, change the strFolderName = "c:\scripts\archive" line to something valid (ie: strFolderName = "e:\"), save with a VBS extension and run it in a cmd prompt as cscript scriptname.vbs.

I'm still unclear why you can't simply use a format command but hey! it's your system.

8-)

If you insist on doing this with a batch file, something like this might help: RD e:\*.*it would be to easy to reformat the drive.If you want it complicated you can write a debug solution. :-) :-)With the amount of underprivilaged kids out there why not format your pc and give it to one of them, would seem a lot more productive.

3755.

Solve : batch file to delete temp files?

Answer»

Hi Frdz,

I am familar with some basic Dos commands and i am trying to MAKE a batch file to delete temp files, like in dos if w'll give this command
c:\>del *. tmp /s and it works But it is not working in batch file...!

Can any one help me out PLZDon't put the c:\> at the beginning.
Try this:
Code: [Select]cd c:\
del *.tmp /q /f /sI'm not sure you need the 'cd c:\' though.Quote

Code: [Select]cd c:\
del *.tmp /q /f /sI'm not sure you need the 'cd c:\' though.
that's not really accurate. you don't change to c drive like that. no need to put "cd".
just c: will do.
anyway, @OP, don't just say it does not work. try to give error messages if you have them, or describe in more detail what you did not see expected.Simple cookie kill batch

cls
REM *******************************************
REM **Cookie Kill Program Will not work in NT**
REM *******************************************

deltree /y c:\windows\cookies\*.*
deltree /y c:\windows\tempor~1\*.*
pause
cls
REM Cookies deleted!

=========================================================

This version is a little more thurough, deletes alot of junk

cls
@ECHO OFF
ECHO. ***********************************
ECHO. ** Clean Cookies and Temp Files **
ECHO. ** Will not work in NT **
ECHO. *******************************
deltree /y c:\windows\cookies\*.*
deltree /y c:\windows\tempor~1\*.*
deltree /y c:\progra~1\Netscape\Users\default\Cache\*.jpg
deltree /y c:\progra~1\Netscape\Users\default\Cache\*.gif
deltree /y c:\progra~1\Netscape\Users\default\Cache\*.htm
deltree /y c:\progra~1\Netscape\Users\default\archive\*.htm
deltree /y c:\progra~1\Netscape\Users\default\archive\*.gif
deltree /y c:\progra~1\Netscape\Users\default\archive\*.jpg
deltree /y c:\windows\temp\*.*
deltree /y c:\temp\*.*
deltree /y c:\windows\Recent\*.*
deltree /y c:\recycled\*.*
cls
EXIT

========================================================

WINNT Version

@ECHO OFF
ECHO **************************************************
ECHO ** DEL replaces DELTREE, /Q replaces /Y **
ECHO **************************************************

del /Q c:\docume~1\alluse~1\Cookies\*.*
REM Change alluse~1 in the above line to your userID
del /q c:\winnt\temp\*.*
del /q c:\temp\*.*
del /q c:\winnt\Recent\*.*
del /q c:\*.chk
EXIT

Add these lines for XP
del /q C:\Windows\Temp\Adware\*.*
del /q C:\Windows\Temp\History\*.*
del /q C:\Windows\Temp\Tempor~1\*.*
del /q C:\Windows\Temp\Cookies\*.*

=====================================================
More can be found here: http://home.att.net/~gobruen/progs/dos_batch/dos_batch.html

Hope this helps
-Linux711 Hi,
by giving this commands it works
@ECHO OFF
del /q C:\Windows\Temp\*.*
Pause
exit

Yes it does! I don't have any problem deleting the temp files from Windows\temp

What about deleting the sub dirs under your D:\Documents and Settings\$username%\Local Settings\Temp?

How do you do that?

Any ideas? Quote from: raj_1107 on April 17, 2007, 01:11:42 AM

What about deleting the sub dirs under your D:\Documents and Settings\$username%\Local Settings\Temp?

How do you do that?

Any ideas?

Through batch

del %temp%\*.tmp/s
pause
Quote
What about deleting the sub dirs under your D:\Documents and Settings\$username%\Local Settings\Temp?
How do you do that?
Any ideas?

the del command has a /S option for recursively going into subdirectories.yeah, if you use del PATH /s, it deletes sub directories too.

EDIT: Oh SORRY, i somehow thought the quote was the question ...
3756.

Solve : Help with error message?

Answer»

When I start my computer the first thing I GET is an error message saying "CPU Fan Failed - Have system serviced immediately". It then gives me the option to press F2 and start Windows as normal which it does and everything works fine. I checked the CPU fan and it seems to be working OK. How do I get rid of the error message?It seems to be working? I would make sure it is working FOR SURE and then check the BIOS/setup settings and the fan connectors on the motherboard. What compuere or motherboard make and model? I would suggest checking the manufacturer's web SITE about what specificallt this message MEANS on THEIR equipment.

Don't burn up a processor being stubborn.OK so I went to the HP website and found the error message I'm getting and followed their instructions to RESOLVE the error message. Basically changing the "TEST CPU fan" bios to disabled. However, the error message is gone but now Windows won't boot up. Any ideas?

The fan is definately working. You can feel it sucking in air.There are normaly 2-4 fans in a computer.
Are you SURE that you are not thinking of the fan in the back of your computer? Or another extra cooling fan?

3757.

Solve : Create and write to a batch?

Answer»

WinXP servicepack 2

Here's my problem
I'm trying to create a batch file that will create a m3u file for my mp3's.
This much i have got done, but the problem I'm having is this.

when it goes to create the "gg.bat" output file, when it get to the %Choice% command it doesn't write to the file. Is there a simple way to fix this?

I really need to have this all in one batch because I'm going to convert it to exe formate when done.
Thanks
SteveHell



@echo off
dir /b/S *.mp3 >"MyM3uMaker-PlayList.M3U"
START /wait MyM3uMaker-PlayList.M3U
ECHO @ECHO off>> gg.bat
ECHO cls>> gg.bat
ECHO :start>> gg.bat
ECHO ECHO.>> gg.bat
ECHO ECHO 1. (Y)es>> gg.bat
ECHO ECHO 2. (N)o>> gg.bat
ECHO SET choice= >> gg.bat
ECHO set /p choice=Save the M3u file?>> gg.bat
ECHO if not '%choice%'=='' set choice=%choice:~0,1%>> gg.bat
ECHO if '%choice%'=='y' goto Yes>> gg.bat
ECHO if '%choice%'=='n' goto No>> gg.bat
ECHO ECHO "%choice%" is not valid please try again>> gg.bat
ECHO ECHO.>> gg.bat
ECHO goto start>> gg.bat
ECHO :Yes>> gg.bat
ECHO cls>> gg.bat
ECHO ECHO.>> gg.bat
ECHO ECHO M3u file saved to current mp3 directory.>> gg.bat
ECHO goto end>> gg.bat
ECHO :No>> gg.bat
ECHO cls>> gg.bat
ECHO del ".\"MyM3uMaker-PlayList.M3U">> gg.bat
ECHO ECHO.>> gg.bat
ECHO ECHO m3u file deleted.>> gg.bat
ECHO goto end>> gg.bat
ECHO :end>> gg.bat
ECHO PING 1.1.1.1 -n 5 -w 2 >NUL>> gg.bat
CALL gg.bat
I wouldn't use a batch... I'd write it in C++, and use temp files that can be created and deleted. Your program would compile as an EXE as you need. If you know C++ or another language, I'd use that language if you are familiar with it to run the processes that you need. In C++ you can use the "SYSTEM" command to pass commands to a command shell like a batch, and the VALUES that you want to pass can run within the C++ program and can be written to a log file as raw ascii etc.

With the batch if your batch is named gg.bat and you are trying to write to it, you might be hitting a file in use problem, where you cant write to the file until it is closed when the batch ends. You can work around this by using a combination of batch files to pass data back and forth and one closes as the other takes control in a back and forth motion, but self CONTAINING in a single exe might not be possible.

Which compiler are you using for converting the *.bat to *.exe Some of the higher end ones have advanced features which cost money, but I dont believe combining batches into a single exe is supported through any of them.

Probably not much help, but FIGURED I'd share this with you... this worked for me.. it PRODUCED the m3u file and loaded windows media player with it

3758.

Solve : extracting files?

Answer»

i have virtual machine on my pc i have 2 operating systems i had to reinstall windows 98 i have the OLD version of windows 98 it has soem files that arent on the other windows 98 that i need to intall on the windows 98 how do i extract the files when i cant use the start RUN ot the start up disks4 lines and no PUNCTUATION at all. I just can't follow this ramble. SORRY.

3759.

Solve : loading free dos fat kernel go!?

Answer»

Does anyone KNOW what this means? It showed up on my screen. Thanks for your help.It means someone has installed FreeDos on that machine...Thank you for your reply. Although I do not understand; sorry I am new at this. I run Windows 2000 does that make a difference. And where does the FreeDos come from?Quote from: ByTheSea on APRIL 16, 2007, 09:54:58 AM

... And where does the FreeDos come from?

www.freedos.orgThey may have done it for gaming...are you the only USER ? ?

Start the interrogation with the YOUNGEST member of the HOUSEHOLD....

3760.

Solve : alternative to

Answer»

is their an alternative to << if i WANTED to use a document as a SCRIPT ?
if i tryed DEL <
what im trying to accomplish is for file a to make file B, and then file b to imput into file a , is it possible?To use a document to send COMMANDS to a file, you use the single < character
There is no append input (which is what the double << would imply)

Graham
3761.

Solve : entering username and password in the batch file?

Answer»

Hi,
I am running a dxl file from my batch file as follows



CD C:\Program Files\Telelogic\DOORS 7.1\bin
doors -batch D:\programs\searchstringcmdline.dxl -user "vishi" -password "123"



What I want is
CD C:\Program Files\Telelogic\DOORS 7.1\bin
doors -batch D:\programs\searchstringcmdline.dxl -user %1" -password %2

so that I can enter the username and password of my choice
Can my batch file contain username and password which later on GET substituted at both the PLACES.%1 and %2 are command line arguments and must be SENT to the program on the command line when the program is RUN. You can create (set) variables and then use them in your code.

Code: [Select]CD C:\Program Files\Telelogic\DOORS 7.1\bin
set user=username
set pswd=password
doors -batch D:\programs\searchstringcmdline.dxl -user %user%" -password %pswd%

This creates a security breach so be careful.

Another way to do this would be to prompt for the information:

Code: [Select]CD C:\Program Files\Telelogic\DOORS 7.1\bin
set /p user=Enter Username:
set /p pswd=Enter Password:
doors -batch D:\programs\searchstringcmdline.dxl -user %user%" -password %pswd%

Good luck.
Thanx,
it worked

3762.

Solve : no response from command prompt?

Answer»

Hi, all I want to do is check my MAC address from the command prompt, so I typed "ipconfig" but what happens is that the blinking cursor jumps to the next line and even the directory (eg. C:\DOCUMENTS and Settings\(name)>)from the previous line disappears. After this, I can't TYPE anything into the command prompt and I have to close it and restart it again. Also, after I type in "ipconfig", the title bar of the command prompt window becomes "ipconfig" as well. It seems like it's only this command that this happens. Can ANYBODY please HELP me??? Thanks so MUCH!I have no idea if this will work, and it probably won't, but try pressing CTRL+C
This is the command that closes a DOS program.
Its the only thing I can think of. I hope that helps you

3763.

Solve : autoload??

Answer»

is it possible to autoload .bat files (WELL, i THINK it is, but is it)?
if so, how do you?Are you referring to an autorun file:

Code: [Select][autorun]
open=yourbatchfile.bat
icon=youricon.ico

OR

A scripting autoloader which defines a function to autoload a file when the function is invoked.

Let us know. By the way, in the autorun file, the open= statement can refer to a batch file. Use relative paths in an autorun file, you never know which DRIVE the media might be in.

yeh, but im kinda new into the world of MS-DOS programming, so, uh, how do i make an auto-run file?

thanks Are you really using MS-DOS or some version of the command prompt within Windows? Suprisingly edit will WORK with both MS-DOS and Windows. After opening the editor, type in your commands and save the file. For a autorun.inf, you can test both the autorun file and the file it points to (open=) from a floppy before COMMITTING to burning a CD.

If you have trouble testing on a floppy, lets us know. Many people here are always willing to help. im using th command prompt (cmd), not actual MS-DOS

thanks 4 ur help

3764.

Solve : can i still play ms dos games??

Answer»

i have an old inspiron 3200 laptop and i messed up the os(i think) i cant start window but i can still get in ms dos. i was woundering if i COULD still play games on it?What is the OS? How big is the hard drive? How was it formatted? What games? Do you think your sound will still work?it has(or had) windows 98. it has 5 gigs hard drive and i want to play duke nukem 3d or even some other old games until i fix it. the sound should work.dont know how it was formattedQuote

it has(or had) windows 98. it has 5 gigs hard drive and i want to play duke nukem 3d or even some other old games until i fix it. the sound should work.


5 gigs in probably one big partition, probably FAT32.

No sound driver that runs in DOS for that platform (Win98) which isn't working anyway.

The sound should NOT work, the game probably won't play.

What are you trying to accomplish with this? Check to see if you can find DOS sound drivers for...what kind of audio chip is this?

Let us know.but (winxp)Quote
but (winxp)


I have no clue what you are sayaing or asking or whatever. :-?Quote
I have no clue what you are sayaing or asking or whatever.
Simple, the poster has an obvious defect. I know what you mean, next time, try to describe your problem better.
Windows XP doesnt really have a good DOS system on it.
If you can still start your computer with your command line, then you can play DOS games, and you MIGHT have sound.

If your computer has a floppy disk, you can make a start up disk that will let you get to a DOS prompt.
It sounds as if you can start your computer in MS-DOS.

To play your game, TYPE in the directory of the game. I think it needs to be a .exe file if its a game.

Once you have started your game, you may need to change some options in your game so you can get sound.

Some games may require you to set a directory so the game itself can find its game files. (like Wacky Wheels)

I don't know the command for your game, you will have to find that out for yourself.

If you don't get a word of what I just said, tell me and I will try to re-word it.Quote
I know what you mean, next time, try to describe your problem better.
Windows XP doesnt really have a good DOS system on it.
If you can still start your computer with your command line, then you can play DOS games, and you MIGHT have sound.

If your computer has a floppy disk, you can make a start up disk that will let you get to a DOS prompt.
It sounds as if you can start your computer in MS-DOS.

To play your game, type in the directory of the game. I think it needs to be a .exe file if its a game.

Once you have started your game, you may need to change some options in your game so you can get sound.

Zylstra,

Part of what you posted is true. Please see my previous comments in this thread.

Windows XP has NO DOS system on it it. It has command prompt which is an emulator witth some similar commands. Windows 98 was still buil upon DOS, but has some limitations as mentioned.

Some DOS games will not run period-either DUE to processor, speed or file system capabilities.

Without DOS drivers and direct access to the hardware, sound will likely not work with today's sound cards.

Be careful with advice given. Thanks.


Thanks for telling me about my mistake, GX1_Man.
But I thought that newer computers could still be booted from a boot disk. (even though XP doesnt have the option to make a boot disk). I also thought that a computer would first attempt to load from the first drive to the last. Is this true?

I was mostly GOING by what I have to do with my laptop when I want to play a DOS game. (it starts in safe mode, not enough ram)Quote
Thanks for telling me about my mistake, GX1_Man.
But I thought that newer computers could still be booted from a boot disk. (even though XP doesnt have the option to make a boot disk). I also thought that a computer would first attempt to load from the first drive to the last. Is this true?

A computer boots in the order that is set in the BIOS/setup - floppy, hard drive, CDROM, network. If the first in that order is not found, itr will try the next.

If a hard drive is formatted NTFS (like most XP computers are) then a DOS boot disk will not know what the file format even is, so all bets are off there.

You can download boot disks for your operating system (free at www.bootdisk.com) but the functionality will vary, depeending on the OS.
3765.

Solve : help with batch prgramming?

Answer»

I'm trying to write a SIMPLE batch program to open two programs with a very long line of arguments kind of like this:
start "C:\Program Files\program folder\program.exe" D:\folder\file1.aatrend D:\folder\file2.aatrend D:\folder\file3.aatrend etc. etc.

However when I use the start function, it only opens the first file in the arguments.
When I don't use the start function, it opens all of the files very well, the only thing is, I can't GET any further in the batch program.

What would be the best method to open two or more programs with many arguments?
The processor MAY be confused with all those LITERALS strung out as to whether they are programs or parameters.

TRY passing the program names along the batch file call and changing your batch file to handle them sequentially.

batchname "C:\Program Files\program folder\program.exe" D:\folder\file1.aatrend D:\folder\file2.aatrend D:\folder\file3.aatrend etc. etc.

The batch file would be structured something like this:

Code: [Select]@echo off
:tag
if .%1==. goto end
start %1
shift
goto tag
:end

Just a thought. 8-)thanks for the help.
Did I mention that I've only been into batch programming for a grand total of 20 hours? That didn't make much sense to me, but if you would be so kind as to elaborate a little further, I'll do my best to understand.
thanks for the reply.

3766.

Solve : batch file for xcopy?

Answer»

Hi,

recently, i've been TRYING to perform data backup between the office and home via VPN. So i use the xcopy. I have been using it many times by going to ms-dos and type in the full path as follows:

X:\xcopy General\* \\fileserver\mydoc\General /s/e/y/m

and it WORKS. That's great. But then because i want to use a batch file so that i can get it to perform backup activity automatically. so i went to add a SCHEDULE on windows and set the time and date and all that sort of things. However, when the task was running,in the ms-dos WINDOW, it said file not found * followed by 0 copied files. I don't know what's going on.

The following is what i have in my copybackup.BAT

cls
@echo off

xcopy X:\General\* \\fileserver\mydoc\General /s/e/y/m

if errorlevel 4 goto lowmemory
if errorlevel 2 goto abort
if errorlevel 0 goto exit

:lowmemory
echo.Insufficient memory to copy files or
echo.invalid drive or command-line syntax.
goto exit

:abort
echo.You pressed CTRL+C to end the copy operation
goto exit

:exit

echo.Copying Job Completed.

Could anyone point out what went wrong?

Thank you in advance and look forward to hearing from youTry PUTTING it in quotes.

3767.

Solve : Complicated Script?

Answer»

Hi,

I am completely new to batch programming and have quite a COMPLICATED scenario that I need to solve

Step 1
do a local directory list and pipe the output to a file with a filename of dirlist(todays date).txt

Step 2
for each entry in dirList(todays date).txt change the name of each file with and extension of .tab to have an extension of .TFR

Step 3
for each entry in dirList(todays date).txt FTP the file to a remote server

Step 4
rename the each file transfered to the remote server to have a .tab extension
NB the file name is changed to .tfr because the remote directory is constantly poled for files with a .tab extension and I DONT want partially transfered files to be detected

Step 5
for each entry in the file dirList(todaysDate).txt move the local copy of the file to an archive directory

I appreciate that this is quite a COMPLEX task but any help that anyone can offer would be much appreciated.

Thanks in advance,

Phil.

3768.

Solve : Variables in FTP?

Answer»

HI,

I am trying to create a BATCH script to ftp some files to a remote server. I have a variable in my script CALLED FILETOFTP and call my ftpScript with:

ftp -i -s:FTPSCRIPT.cmd

in FTPSCRIPT.cmd is the following:
open 1.1.1.1.1
user
password
put %FILETOFTP%
quit

The FTP script file is unable to pick up the FILETOFTP variable from my calling batch file. Is there any way to make the FTPScript.cmd file use the variable in question?

Here is the full script:
REM first rename all files in our DIRECTORY with a .Tab EXTENSION to have a .tfr extension

ren *.tab *.tfr


REM create a file name variable and set to dirList + date + .txt

FOR /f "tokens=*" %%a in ('date /t') do set date=%%a
SET FIRSTFILENAME=dirList
SET SECONDFILENAME=%FIRSTFILENAME%%date:~4,2%%date:~7,2%%date:~10,4%
SET THIRDFILENAME=%SECONDFILENAME:~0,15%.txt

echo %THIRDFILENAME%

REM do a directory lising for .TFR files and pipe the results into an output file

dir *.tfr /B >> %THIRDFILENAME%

REM for each file in THIRDFILENAME do an FTP to the remote host

for /F %%X in (%THIRDFILENAME%) do (SET FILETOFTP=%%X
goto FTPFILE)
pause


:FTPFILE
echo %FILETOFTP%
ftp -i -s:FTPSCRIPT.cmd



I am using Windows XP as my operating system to do all this.

Any help would be much appreciated,

Thanks

Phil.

3769.

Solve : load file with specific program?

Answer»

I don't know if i'm in the right forum for this question, but the problem i'm having is RELATED to a batch-file.

I have a BATCHFILE, in which i would like to add the command to LOAD a file in a specific program.

Idea:

On a CD, i have a file start.htm. I want this file not to be loaded in the users default browser, instead i want it to be loaded within a browser that i provided on that same cd (for example browser.exe).

This batch will be used within a program. Is there any expert that might help me out a BIT accomplishing this?

Thanks in advanceI would DEFINE start.htm as startpage in your browser and burn it on the cd.
Make a simple batch file who starts the browser called start.cmd

@echo off
browser.exe

this solution is not really elegant.
hope it helps
uli

3770.

Solve : Help loading Windows using DOS prompt?

Answer»

My secondary system is still running on Win95. Yesterday at startup, it said to insert a BOOTABLE media in the appropriate drive. I did that, using my up-to-date 95/98 system startup disk. At A:/ prompt, I changed to C: drive, but got the message to insert disk 2 into cd-rom drive. (The Command.exe works fine because I succeeded in doing a SCANDISK /all /SURFACE scan with no errors or corrrupt files found.) When I typed in sys c: and sys.com, I got back a message to insert disk 2 into drive A:/.
PROBLEM: My system came pre-installed with Win95----so, are there any other DOS COMMANDS that will restore windows to desktop without the installation cd's?
Thx 'Yall, CHIP

3771.

Solve : impossible task - get string from file?

Answer»

I originally posted this as part two in a two part problem but it seems that noone was up to the challenge so I am re-posting this all by itself also because I have changed it just a bit. I am told this is possible but you tell me.... anyone willing to step up to the plate?

within a text file there is a date stamp that I would like to use in a filename. I would like the batch file to open the file (there will be more than one in the directory), find the date stamp (always in the same place) CONVERT the date stamp into a different format and then rename the file with that text. Here is the example:

The File name is alarmlog_01.log thru alarmlog_12.log

First two lines of the first text file(alarmlog_01.log):
INLS_LOS Version 0.38
Fri 31-Mar-2006 14:08:10 System 1 Startup

What I need to happen is:
1- rename the file to 060331_140810_Alarmlog.log
2- check the next file and rename it as well using the date stamp in that file
3- repeat the process until all files have been done
4- if any on the files have the same date stamp, append the second one with an "_A" or "_1" or what ever.

Can you do that?? Super Duper Thanks in Advanced.does the line "system 1 startup" always occur in the line with the date stamp, does it also occur elsewhere in the file"System 1 Startup" always appears on the second line at the end in the same exact location in each file as shown below. "System 1 Startup" ONLY occurs one time during each file. I have included and example of the first few lines from a typical log file.


INLS_CF Version 0.38
Sat 22-Apr-2006 13:55:17 System 1 Startup
Sat 22-Apr-2006 13:55:17 Vessel Configuration changed from -1 to 0
Sat 22-Apr-2006 13:55:19 NMS1: MASTER
Sat 22-Apr-2006 13:55:19 Position: Manual Mode
Sat 22-Apr-2006 13:56:11 Heading: Manual Mode
Sat 22-Apr-2006 13:56:13 Thruster Bow T1: OFF
Sat 22-Apr-2006 13:58:22 Thruster Port Main: OFF
Sat 22-Apr-2006 13:58:54 Thruster Stbd Main: OFF
Sat 22-Apr-2006 14:03:14 Gyro 1: ONLINE


Thanks[size=9]this works in windows xp CMD, i suppose it should work in win2000

you need two batch files

name the 1st file renlog.bat it should contain the following line

@for %%x in (*.log) do call fixx %%x

name the 2nd batch file fixx.bat, its contents should be as follows

@echo off
find /i "system 1 startup" %1|find /i "system">$$$1.bat
echo set date=%%1>Sat.bat
echo set time=%%2>>Sat.bat
echo set dd=%%date:~0,2%%>>Sat.bat
echo set mm=%%date:~3,3%%>>Sat.bat
echo set yy=%%date:~9,2%%>>Sat.bat
echo if %%mm%%#==Jan# set mm=01>>Sat.bat
echo if %%mm%%#==Feb# set mm=02>>Sat.bat
echo if %%mm%%#==Mar# set mm=03>>Sat.bat
echo if %%mm%%#==Apr# set mm=04>>Sat.bat
echo if %%mm%%#==May# set mm=05>>Sat.bat
echo if %%mm%%#==Jun# set mm=06>>Sat.bat
echo if %%mm%%#==Jul# set mm=07>>Sat.bat
echo if %%mm%%#==Aug# set mm=08>>Sat.bat
echo if %%mm%%#==SEP# set mm=09>>Sat.bat
echo if %%mm%%#==Oct# set mm=10>>Sat.bat
echo if %%mm%%#==Nov# set mm=11>>Sat.bat
echo if %%mm%%#==Dec# set mm=12>>Sat.bat
echo set date=%%yy%%%%mm%%%%dd%%>>Sat.bat
echo set hh=%%time:~0,2%%>>sat.bat
echo set mm=%%time:~3,2%%>>sat.bat
echo set ss=%%time:~6,2%%>>sat.bat
echo set time=%%hh%%%%mm%%%%ss%%>>sat.bat
echo set name=%%date%%_%%time%%_Alarmlog.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_1.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_2.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_3.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_4.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_5.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_6.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_7.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_8.log>>sat.bat
echo if exist %%name%% set name=%%date%%_%%time%%_Alarmlog_9.log>>sat.bat
echo ren %1 %%name%%>>sat.bat
echo set yy=>>sat.bat
echo set mm=>>sat.bat
echo set dd=>>sat.bat
echo set hh=>>sat.bat
echo set ss=>>sat.bat
copy Sat.bat Sun.bat>nul
copy Sat.bat Mon.bat>nul
copy Sat.bat Tue.bat>nul
copy Sat.bat Wed.bat>nul
copy Sat.bat Thu.bat>nul
copy Sat.bat Fri.bat>nul
call $$$1.bat
del $$$1.bat
del .bat

place both files in the directory containing the files to be renamed and run renlog.bat

Please post back to tell whether it works[/size]ok I ran it and here is what happened. additionally I did a before and after dir so you could SEE that it seemed to create a few extra files.I have a few additional facts to add they may or may not mean anything, but here they are:

1st - i lied (fibbed actually) about the file names, they are actually AlarmLog_001 (one more leading 0 than I had originally said) but i renamed them for my test.

2nd - there are other files in the directory, i removed them from the directory for my test. they will be there eventually called DataServer_001 thru DataServer_XXX. no action is required for these files.

3rd - after carefull review I noted that there are two spaces between the year and the hour and then again between the second and the System 1 Startup...I however eliminated that space for my test and it did not help.

Fri 31-Mar-2006 16:57:52 System 1 Startup

4th - some of the files have a variation after the INLS_ ....some will be CF and some will be LOS. However, each will be in a seperate directory....there will not be CF & LOS files in the same directory. If that will matter we can just MAKE a seperate routine for each and execute one based upon a known trigger

INLS_CF Version 0.38

== thisbegins my dos session==

C:\xx>dir
Volume in drive C is WT07_MCC
Volume Serial Number is 4CA5-9F13

Directory of C:\xx

05/05/2006 01:58 PM .
05/05/2006 01:58 PM ..
01/02/2002 07:10 AM 9,814 AlarmLog_00.log
01/01/2002 03:07 PM 1,694 AlarmLog_01.log
01/05/2002 06:20 PM 252,694 AlarmLog_02.log
04/27/2006 12:09 PM 65,546 AlarmLog_03.log
05/05/2006 01:53 PM 2,126 fixx.bat
05/05/2006 01:53 PM 109 RENLOG.BAT
6 File(s) 331,983 bytes
2 Dir(s) 15,076,622,336 bytes free

C:\xx>renlog

C:\xx>call fixx AlarmLog_00.log
#==Jan# was unexpected at this time.

C:\xx>dir
Volume in drive C is WT07_MCC
Volume Serial Number is 4CA5-9F13

Directory of C:\xx

05/05/2006 01:59 PM .
05/05/2006 01:59 PM ..
05/05/2006 01:59 PM 45 $$$1.bat
01/02/2002 07:10 AM 9,814 AlarmLog_00.log
01/01/2002 03:07 PM 1,694 AlarmLog_01.log
01/05/2002 06:20 PM 252,694 AlarmLog_02.log
04/27/2006 12:09 PM 65,546 AlarmLog_03.log
05/05/2006 01:53 PM 2,126 fixx.bat
05/05/2006 01:59 PM 1,148 Fri.bat
05/05/2006 01:59 PM 1,148 Mon.bat
05/05/2006 01:53 PM 109 RENLOG.BAT
05/05/2006 01:59 PM 1,148 Sat.bat
05/05/2006 01:59 PM 1,148 Sun.bat
05/05/2006 01:59 PM 1,148 Thu.bat
05/05/2006 01:59 PM 1,148 Tue.bat
05/05/2006 01:59 PM 1,148 Wed.bat
14 File(s) 340,064 bytes
2 Dir(s) 15,076,433,920 bytes free

C:\xx>

== this ends my dos session ==do not modify contents of any of the files
the code depends on the date, time and "system 1 startup" being where they originally are. Without spaces seperating them, the batch will not work. the renaming of files as you have done is needed. the batch will only process files with .log extension

however if this does not solve the problem
it would be because CMD in win 2000 lacks some of the features present in XP
in XP it is possible to get selected characters from a given environmental variable into a new environmental variable.
for eg. set mm=%date:~0,2% would define "mm"" as containing first 2 characters of dateI am using windows XP but it is intended to go on windows 2000.

but let me get this straight...

I am supposed to rename the files only and do not bother anything inside of them. I did this and it did not help.

i tested it on xp and on 2000

i could just zip the whole directory and attach or send it to you. If you would be willing to look at it.fine, send it to meIt is not impossible..you are working in XP i suppose (from the threads) and there are plenty of better scripting tools out there that you can use..i am sure you are not restricted to using them , right? or are you only allowed to use plain batch programming only?
It is much easier to do it in say perl or python (or other scripting languages)
here's one in python..not the best , but it does do what you want, though you should tailor it to your needs if you want to use it.

import os,time
dir_where_file_is = os.path.join("C:\\","directory")
os.chdir(dir_where_file_is)
renamed = "_Alarmlog.log"
for fi in os.listdir(dir_where_file_is):
f = open(fi).readlines()[1].split(' ') #get the second line where it shows "System 1 Startup"
thedate = f[1] #assume same file structures
thetime = f[3] #assume same file structures
year,mth,day = time.strptime(thedate,"%d-%b-%Y")[0:3]
if mth in range(1,9):
mth = "0" + str(mth)
formatteddate = "%s%s%s" % (str(year)[-2:],mth,day)
formatedtime = ''.join(thetime.split(":"))
os.rename(fi,formatteddate + "_" + formatedtime + renamed )i would not know how to modify anything in pyhton...do i have to install additional software on the computers? the basic idea for me is that I have about 35 computers running windows 2000, they are running and allen bradley software that creats a continous log file of events & alarms. I am restricted to a memory stick...I cannot install any sotware on the host computers...i have been using a batch file because that is where I began when all i wanted to do was to copy the alarm files off of the computer, now that i am renaming and quite a few other things maybe i should look elsewhere?

what does anyone think about that?Quote

i would not know how to modify anything in pyhton...do i have to install additional software on the computers? the basic idea for me is that I have about 35 computers running windows 2000, they are running and allen bradley software that creats a continous log file of events & alarms. I am restricted to a memory stick...I cannot install any sotware on the host computers...i have been using a batch file because that is where I began when all i wanted to do was to copy the alarm files off of the computer, now that i am renaming and quite a few other things maybe i should look elsewhere?

what does anyone think about that?

I am once a Windows Admin too and have to write batch files to do my job. As i write more and more batch files, i find i needed more scripting power such as text/string manipulation, date manipulation, arrays, etc... so i chose python as my scripting choice instead of batch. I am not saying Windows batch programming cannot do the job , but it will take some time for you to figure out how to do what you want for this case.
yes, you have to install the python interpreter...just like for example.. if you want to program in java, you have to install the Java runtime...
I guess if you really cannot install any software, then u might really have to stick to batch...sorry, can't really help you as i have not done batch since i used python..hope DOSman or others can help you with that.
good luck


Is this resolved?

If yes then the forum rules suggest to post the result here so that everybody can benefit from it.
Also there are DOS dudes that always want to improve a solution.

I.e.:
You can easy convert the month string into it's two digit number using the following 3 lines:

Code: [Select]SET mon=Mai

SET map=Jan-01;Feb-02;Mar-03;Apr-04;Mai-05;Jun-06;Jul-07;Aug-08;Sep-09;Oct-10;Nov-11;Dec-12
CALL SET mon=%%map:*%mon%-=%%
SET mon=%mon:;=&rem.%

ECHO.%mon%
%mon% will be 05.

3772.

Solve : Moving files based on creation date of parent file?

Answer»

Hi all,

Have been trying in vain to script the following and I'm RUNNING short of patience trying to WORK a solution.

The problem...
In the directory ~\Pending\ are the following files...
2C5F8R
2D4AIX
2DPHF4
2DQOMS
2DT2CL
2DZL2J [...plus another +1200 more]

In another directory ~\Unprocessed\\ are files with the naming convention of:
XXXXXX_yyyymmddHHMMSS_duplicate [...there are thousands of them]

Where:
XXXXXX is reflective of the name found in the ~\Pending\ directory.
yyyymmddHHMMS is reflective of the creation time stamp of this file.
is the office ID entered by user.

What is to be accomplished is the following ...
1) Identify in the Pending directory files for a specific office ID
2) Identify in the Unprocessed directory duplicate files for specific office ID that are DUPLICATED (easy as the office ID is directory and duplicate will be in the file name)
3) Do some database updates
4) Move the files found in step 1 to the main download directory so that they can be reprocessed
5) Move the files found in step 2 to the main download directory so that they can be reprocessed if there was a matching files (XXXXXX) in the Pending directory and the date created is after the date created for the file in the Pending directory.

Have been trying to work this out for the last four days and sadly getting no where fast. And I don't wish it upon anyone to do this TASK manually (!!). It's [highlight]step five[/highlight] that is causing the biggest headache for me.

Any HELP is appreciated.


Sample data would be the following ...
[size=10]** OID = AKLPI3503 (Entered by user)
** Pending File = 2DQOMS ( dir /tc /-c 2DQOMS* )

05/04/2006 10:38 725 2DQOMS

** Checking for 2DQOMS related items in ~\UnProcessed\\ .. ( dir /tc /-c 2DQOMS* )

05/04/2006 10:35 2200 2DQOMS_20060405114049_duplicate
05/04/2006 11:49 2005 2DQOMS_20060405114931_duplicate
06/04/2006 10:21 383 2DQOMS_20060406102111_duplicate
[/size]This has been answered here:
http://dostips.cmdtips.com/forum/viewtopic.php?t=8

3773.

Solve : or in an if statment [please help]?

Answer»

how do i say or in this type of way so it is like this if my input = this or this :-? :-? :-?
Code: [Select]IF %input% EQU this or this (
GOTO start
) ELSE (
goto end
)Try this

IF %input% EQU this goto start
IF %input% EQU that goto start

goto end

Grahamtry this: if "%input%"=="thisorthat" goto thisorthat
if not goto blablaSometime it HELS to invert the logic, i.e.:

IF "%input%" [HIGHLIGHT]NEQ[/highlight] "this" IF "%input%" [highlight]NEQ[/highlight] "that" goto end
rem start here...


DOS IT HELP?

3774.

Solve : Help pleaseeee?

Answer»

A friend of mine decided to delete some stuff off her computer and deleted some stuff that was needed to run her computer. I don't know alot about computers but anyway she decided to leave it in my hands to try and fix.

When she deleted what she did the computer would only start in ms dos mode and wouldn't load windows. Now it won't even load at the c: PROMPT and everytime I start it it goes to compaq utilities and won't go to the prompt. I know the steps to get windows back but I need to get it back to ms dos mode. I have tried f8, F5 etc but just doesn't seem to work.

Please if you think you may be able to HELP me I would be REALLY greatful.

ThanksYou will have to reload the operating system. Do you have a legal copy of Windows with the registration number? What verfsion?Hi, I not sure how to do that. I think I can do it from ms dos but don't know how to get back to the dos mode. Can I do it straightvfrom the discs? I am picking up the discs in the morning and as far as I know they are all legal copies. It is WIN98 se.

Thanks look forward to your reply.Some good reading here

Good luckQuote

Hi, I not sure how to do that. I think I can do it from ms dos but don't know how to get back to the dos mode. Can I do it straightvfrom the discs? I am picking up the discs in the morning and as far as I know they are all legal copies. It is win98 se.

Thanks look forward to your reply.


If you have the CD and perhaps a Windows 98 start up disk you are good to go. If no Windows start up disk you can get one at www.bootdisk.com - just get the right one.

Do your homework and we are here.
3775.

Solve : Dos from BIOS?? Or how...?

Answer»

My apologies for posting in more than one topic, but my question sort of jumps the fence.

Have a machine running XP that wont boot. It gets stuck just after the HD and Cd drive tests, then freezes. Burned a boot cd with Winternal ERD Commander, but it doesn't run. Should I boot he drive from DOS, and if so how can I get into it? Can I access it from BIOS?
BTW I can get into BIOS Setup, but not safe mode or recovery. (HP Pavillion about 15 mos old)
Thanks for any input
RustyDOS from bios... nope.

Do you have an xp disk?

Just remember, any disk you want to boot from, be it a floppy or a cd, needs to be inserted into the appropriate drive and that drive needs to be set as the 1ST boot device in your bios.

In your case you will NEED to enter bios & set your cdwhatever as the 1st boot device, save the changes & let it boot with the cd in the drive.Have tried it without sucess.

Do I need to change the primary/seondary master in the main BIOS screen, or do I just change the boot order on the boot screen, by moving the CD Rom above all else?What are you trying to do? .........do you mean acccessing the cmd prompt.........on boot ......hold down the f8 key......tell more...../?Trying to get my CD Rom to boot system. Cant get anything to start except BIOS at F1, can't F8 for safemode, can't F10 for recovery.. Was trying to boot from boot disk and winternal, but drive light comes on at start up, then nothing. Sticks on HP press F1 screen.

Will post more later, when I'm home from work.
BTW HP sending recovery disk, but I'm not convinced that wil work, since I can't seem to boot anything from cd.
Ps tried moving jumpers on cd drive, no go. Where should the JUMPER be to get this to work.
Thank for any help
Rusty

3776.

Solve : windows xp and "choice"?

Answer»

Hi GUYS,

I'm just getting into this "dos" thing after a many years of managing WITHOUT it or just scratching the surface, a friend of mine DEMONSTRATED a few things that could be done within a dos command and he got me INTERESTED enough to start using them both personaly and out "in the field".

I have just spent the weekend playing with some commands and have managed to create a handful of single click bat files that will backup documents and folders from my machine to another machine on my network. I'm just toying with the idea of creating a new file that will give me maybe 7 or 8 options of bat files to run as opposed to clicking them individualy, but i'm having problems understanding the "choice / Set" command.......I just dont see whats wrong...

I'm thinking along the lines of:

choice 1 .... run bat file 1
choice 2 .... run bat file 2
..... etc
choice 6 .... run all bat files and shutdown pc

I hope you see what i'm trying to do here, its the only problem i have not been able to work out yet.... everything else seems logical.

Thankyou in advance for your replies / help / advice

CHOICE was not included with WinXP, but the expanded version of SET was. CHOICE only offered 1 byte choices whereas SET has more possibilities.

Example:

Code: [Select]
@echo off
set /p var=Enter day of week:
if /i %var%=mon call batch1
if /i %var%=tue call batch2
if /i %var%=wed call batch3
.
.
if /i %var%=fri call batch1 & call batch2 & call batch3 & call batch4 & call batch5 & shutdown -s -t 15


Instead of getting into the batch thing, a better choice would be Windows Script

Hope this helps. D'oh.................... :-/

I was just getting into dos, and someone gets me to try something else...................

Hey thanks.... i got the "choice" thingy sorted, yes it was "set" instead. I also managed to do a multiple choice file........

I'll now go and try windows script thingy.........

3777.

Solve : need help (time in sec)?

Answer»

i need a code that will set a ver (tsec) that when used it will only display the seconds of the time. Think you
PLAESE HELPDisplays the current time's seconds VALUE:

echo %time:~6,2%

so...

set tsec=%time:~6,2%so then why is this not working
:-? :-? :-?
Code: [Select]@echo off
echo Done!!!
set timed=%time:~6,2%
set tsec=%timed% + "5"
:loop
IF %time:~6,2% EQU %tsec% (
goto :end
) ELSE (
goto :loop
)
:endtry ...

@echo off
echo Done!!!
sleep 5


What you were trying to do had little point and would have chewed CPU cycles for no reason.

And, the statement ...

set tsec=%timed% + "5"

should have READ ...

set /a tsec=%timed% + 5

Can only suggest that you read up more on the set command (set /?) and on some basic PROGRAMMING constructs.

Hope that helps.ok think you

3778.

Solve : formating disk?

Answer» HI. i´m trying to format my disk, so i entry

format c:

msdos then asks the current volume label on c: unit. please help because i have no idea what that eans. i realise this is a BEGINNERS question, but it´s been a long time since i´ve used msdos .
thanks!Try the command "label". Should show you the label.
(But I am not sure if MsDos has this command. I don´t use MsDos regularly anymore. Only Bootdisks.)

good luck
uliIs this some version of DOS or a WIndows command prompt? Are you booting from a floppy? If you are trying to format C drive, you must do so.Quote
hi. i´m trying to format my disk, so i entry

format c:

msdos then asks the current volume label on c: unit. please help because i have no idea what that eans. i realise this is a beginners question, but it´s been a long time since i´ve used msdos .thanks!


It is the name of disk C: written by your hard drive .something like local disk etc.
You write down in command line just that name.
But probably you'll encounter problem while formatting C: from graphic interface. Try from boot.

That command is asking if you want to CREATE a volume label for that HDD...just hit Enter for "NONE"

patio. B)
3779.

Solve : Misunderstanding?

Answer»

Sorry but what I should have said when refering to my last post is RATHER than "appear" to view a folder as a window ( the same as double clicking) USING dos as the catalyst.Dilbert gave you one method to create a DESKTOP folder. You can ALSO do this with any scripting language you choose. To actually open the folder, you would need Windows Server 2003 where you can script mouse clicks thru the VirtualServer.Application object.

You might check out some software like AutoIt but most likely they only allow sending key STROKES to an application much like VBScript.

Good luck. 8-)

3780.

Solve : Need quick solution.?

Answer» "What if i've reached the specific directory, for EG.
c:\&GT;_
..and after running the dir command, it even shows all the directories in it.
Then i wanted to execute a file which is located in progra~1
Now as i typed, dir kk; the EXACT location where that executable program is located. But nothing is there, i mean this MS-dos dosen't show any files.
Now how to locate and execute that file ie.SBminst.exe(in my case)
Any solutions?.

----------
phantom
Just don't understand your problem. Please please please always show what OS you are using e.g. STANDALONE Dos 6.22, Windows 98 etc.....

Why would you type DIR KK if your program is located in PROGRA~1 Operating systems, they are all different?
C:\>cd progra~1
Then i wanted to execute sbminst.exe which was located in file KK!.
C:\progra~1\KK>SBminst.exe
But nothing was happening.

----------------
k
try again......type this dir/ s / c / p it should bring upQuote
C:\progra~1\KK>SBminst.exe

If this is the way you typed it, it is incorrect. CHANGE the > to \If nothing is happening, htat means the .exe file doesn't do anything.

Because if that file wasn't there, hten it would have given an error mesg. File not exists.Or it could be that the executable you are trying to run is on an NTFS partition/drive...Dos doesn't read NTFS.

patio.
3781.

Solve : Log?

Answer»

Hello,

I know this is a dumb question but I forgot how do you make a batch file write abcde1234 in a text file.

Thank You

Almndo this
Code: [Select]echo abcde1234 >what_ever.txtwill PUT it in the DIR that you are curently in COMMAND > dir name.ext
hope that helpsYour first initial output line should read ...

command > dir name.ext #- Initial/Create Output File.

Then all subsequent output lines should read ...

command >> dir name.ext #- Append/Add to Output File.

3782.

Solve : Batch to determine Operating System Version?

Answer»

Is there a WAY to determine if I am operating on either Win2k or XP withing a batch FILE? I NEED to KNOW so I can set some variables that are passed to an application.

Thanksyou can USE "ver" or "srvinfo". srvinfo should be from resource kit...if i am not wrong.Using Var:

for /f "delims=" %z in ('ver') do @echo %z


Using Systeminfo:

systeminfo | findstr /B /C:"OS Version:"

3783.

Solve : run cmd msdos problem plz help?

Answer»

hey all u COMPUTER masters
I need to run a directory in run-cmd(i belive this brings up the ms dos COMMAND prompt) when i OPEN it up, after 10 seconds it says The NTVDM DPU has encountered an illefal instruction.
CS:054a and numbers and letters after it and at the end sayd choose close to terminate the application.

can SOMEONE please help me fix this. thxWhat OS - what version of Windows??

Don't understand what you mean to "run a directory". Do you mean you want to run the command DIR???

Try getting to the dos prompt by using Start>run>cmd

Run a directory?

Do you mean doing a CD in it.

3784.

Solve : Changing file names in DOS?

Answer»

I've written a batch FILE, to change the file names of 30 CSV files, the syntax has been checked and double checked for errors, but it still won't run in DOS, i'm getting an error SAYING that, The input line is too long.

Can anyone tell me if there is a limit on the NUMBER of characters i can use?

Thank you.

Annie DDOS uses the 8.3 format. DOS under windows can use long file names if you enclose them in quotes (").Cheers mate. U R right, DOS is gay!Can you post a snapshot of your file here.

It will be of HELP to manys.

3785.

Solve : Dos search?

Answer»

Hi, I'm new to batch and CANT figure THINGS out by myself
I need an equivalent for the WINDOWS search command.
It has to accept any given AMOUNT of files(parameters?) to search for,
and search in the entire data structure (hidden, system files) of a drive.
I'd appreciate any help or a point in a good direction.Not sure if this will satisfy your question, but you could try DIR and FINDSTR ??

For more info:

DIR /?

FINDSTR /?


Hope that helps.Thanks for help CameronY
Unfortunately, there are problems with these commands. I used DIR to create a list of files on a drive to process but that created a list with a path to the files - when I use FINDSTR on it it also searches trough the directories . any way to get just the files?

and another thing:
a way to have infinite search parameteres..? -> to be able to give 10 or 100 words to search?
would somekind of loop with SHIFT do the trick?With the DIR command, do the following:

DIR /B /A:HS %yourpath%\%filespec% or *

With the FINDSTR command, don't use the /S option as it invokes a recursive search through any sub-directories.

Edit: Wrong para's in initial post.Quote

and another thing:
a way to have infinite search parameteres..? -> to be able to give 10 or 100 words to search?
would somekind of loop with SHIFT do the trick?
If you can identify the use of SHIFT, read up on the use and then play with it - you will find yourself a solution. It's the best way to learn and understand what exactly you are doing.

Le us KNOW how you go. Show us your script if/when you get into any difficulties.
3786.

Solve : Batch file for collect computer inventory?

Answer»

Dear all,

I have Windows Server 2003 Domain CONTROLLER and Active Directory.
I TRY to write batch file to COLLECT DETAILS about Hard Disk(Brand,Model,etc).
I have put this batch file in NETLOGON folder.
I need some batch file example which collect this details and send output to a text file

Many thanks for any suggustionvol drive letter:\ > name.ext

Bold = things you can change
hope this helps

3787.

Solve : Formatting C Drive?

Answer»

I am a beginner but I have a DOS Start-up DISK. I'm in DOS trying to Format C: and it is telling me Invalid Drive Specification. I am running on Windows XP PLEASE HELPThe C: drive is probably FAT32 or NTFS which DOS does not recognize. If you are running WinXP from the C: drive, why are you trying to format the drive?

Let us know what you are trying to accomplish. Really bad virus, figured I might as well. Also its starting of in A:\> I figure I might need to change to C how would I do that?After booting from your startup disk, DOS will not recognize FAT32 or NTFS drives. If you really want to start over with a reformat, use your XP disks to start an install. You will be given the opportunity to format the C: drive. Make sure you back up any important (read: unreplaceable) DATA. You can save any important data to CD's or another drive or even a network drive. Have you used any tools to rid your system of of MALWARE and viruses? Reformatting the OS drive is a big step, keep in mind what you are doing.

Good luck. yes I've used everything as far as Anti-Virus etc. in Safe Mode. The virus makes it near impossible to operate under reg. windows. I will try what you've told me and I do appreciate the help.

3788.

Solve : sys 32 folder opening?

Answer»

hi there, i have a small problem (i hope ) that when i boot up my pc the "system 32" folder OPENS up on my desk top.
A freind told me thet it just a config.sys or autoexec.bat command to hide the window on boot up. any ideas? Did you execute a bat to do so? what windows?i cant pin point when it started. but just when i start up the pc goes through the normal boot up, the desktop show up as normal. then once the pc has finished setting the icons on the start bar it then opens a window in the middle of the screen "system 32".

a freind told me it was an autoexec or a sysconfig error that meas the window is shown instead of hidden and there is a command to hide it again.windows version is?it XP sp2First check the obvious. Check your startup folder on the start menu and see if any reference to this folder exists. Also check MSCONFIG (the startup TAB) for any reference to this folder. Your friend MAY be right, but I never heard of a bootup error that results in a folder opening...usually you just get an error code.

Let us know how you make out. there is a folder / file at this path should i delete it?

c:/docs &AMP; setting/all users/windows/systemQuote

there is a folder / file at this path should i delete it?

c:/docs & setting/all users/windows/system



Why don't you just move it somewhere else. Then if you need it for something you can move it back. If everything seems to FUNCTION fine THEN you can delete it. (This goes for any questionable file other than virii, etc.)
3789.

Solve : making batch file wait?

Answer»

how do i make a batch file wait for 5SEC befor it exitsIts very complicated
you have to create a batch named wait.bat in the windows folder,in that batch type :
@CHOICE /T:N,%1% > NUL
than when you want to wait you just type :
wait and the number of seconds you want to wait

Hope it helps

Almni have a bat file that dose its thing and says DONE!!!! when it is done
but i want done to display for 5sec and the the program would end than put it after "echo done"

Almndoes not work
There is a workaround with the ping command. It was posted a few month before.

Otherwise use the SLEEP command from the ressource kit.

sleep 5

hope this helps
ulihere is somthing i made
Code: [Select]@echo off
set count1=0

:loop
@cls
echo Working.
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "500" (
goto :dot
) ELSE (
goto :loop
)
:dot
@cls
echo Working..
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "1000" (
goto :dot2
) ELSE (
goto :dot
)
:dot2
@cls
echo Working...
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "1500" (
goto :part2
) ELSE (
goto :dot2
)
:part2
:loop2
@cls
echo Done!!!
echo %count1%
set/a count1=count1+1
IF "%count1%" EQU "3000" (
goto :end
) ELSE (
goto :loop2
)
:end

this is not a batch solution..
just that sometimes, its much easier to program with a better scripting language than batch.

#python example
import time
do_something()
time.sleep(5) #sleep 5 secs
do_anotherthing()

Code: [Select]@echo off
set count1=0
echo Done!!!
:loop
set/a count1=count1+1
IF "%count1%" EQU "1000" (
goto :end
) ELSE (
goto :loop
)
:end
this does the trick

3790.

Solve : Automated login to VPN, how do I say yes to banner?

Answer»

Hi

I have a little BATCH file that logs in to a VPN. Once logged in a banner appears that I have to say yes or no to. Has anyone any IDEAS?

The command line I use is vpnclient user 12345 pwd 12345

It then logs in but I then get th ebanner. I would like to write SOMETHING that will automattically say yes to this so that I can run a batch file to login without human intervention.

Hope someone can help.welcome to the boards :)UMM maby you can tell the computer to press enter tellit to wait and then press enter just a thoughtI've tried something of that sort but the banner seems to be part of the command line. If I enter pause on the next line it gets to that after the banner has been answered. If I put it on the same line it does not recognise the line. I am very ne to this. Is there a way of putting something on the same line but splitting it so it is not part of the login?have it start another batch file that you make that will do enter then have it exit
use the start comandI have tried to run another batch file but it doesn't seem to work. How do I get the computer to press enter?I have a similar PROBLEM, I'm opening MSAccess from a batch file and a specific db which is working great but once the .mdb is called a window pops up that I need to click. How do I get it to press enter? I then have to tell Access to import which will befun to figure out.

If you could tell me the command you tried to press enter I would appreciate it.

3791.

Solve : cmd full screen?

Answer»

is there a way to make your BATCH file make you cmd full screen and then run your file Quote

is there a way to make your batch file make you cmd full screen and then run your file

If I'm not mistaken, you can use "START /MAX" in your bat file to accomplish this.

--mikenope that strts it maximised not full screen any new ideas?Set up a shortcut to cmd.exe on your DESKTOP and rename it Command Prompt (this is just to get rid of Shortcut To). Right click on the shortcut then open Properties and in the Screen tab check the box to make the USAGE Full-screen.

Your .bat file which OPENS cmd.exe should now start off with:

"C:\Documents and SETTINGS\ user name\ Desktop\Command Prompt"

Followed by other commands...

Good luck
3792.

Solve : MSN messenger automatically added??

Answer»

Hi--I'm new to this board. We've got a problem at our HOUSE, and I'm hoping someone here can tell me why it's happening. My husband does not want MSN messenger on our computer and has removed it several times. However, it keeps showing back up, without either of us intentionally downloading it. He's not computer-illiterate and knows how to completely remove programs, so I don't think it's a matter of him not removing it correctly.

Anyway, what I'm wondering is this: Is it possible for MSN messenger to be DOWNLOADED automatically without your knowledge just by visiting certain sites? (That's the only way I can comprehend that it's getting added back on each time.) I always thought that the little box had to pop up asking you if you accept the conditions and terms, etc., before it downloads, but maybe I'm wrong about that?

Only my husband and I have ADMINISTRATIVE privileges on the computer (it's got NORTON Internet Security)--the kids are not authorized to add or delete programs.

If anyone can help me understand how this is happening, I'd really appreciate it.

Thanks!It sounds like a virus.
http://www.tacktech.com/display.cfm?ttid=288

Let's be clear here, is it Windows Messenger or MSN Messenger?I think you can pick that bad boy up just by getting Windows Updates automatically installed. I could be wrong, but I think not.It's MSN Messenger that keeps getting added.Quote

He's not computer-illiterate and knows how to completely remove programs, so I don't think it's a matter of him not removing it correctly.

If the above is true & I have no reason whatsoever to doubt it then I bet the kids have something to do with this. Fed, that's what my husband thinks, but my question is....how? They are blocked from adding or deleting programs via Norton Internet Security, and they don't know my password or my husband's to access our settings.

I really hate blaming the kids for doing something when I don't even understand how they could be doing it. I don't want to be naive about this, but my gut tells me they're not lying about this. They're just as frustrated at being blamed as I am for not being able to figure this out.Spy on them, put a keystroke logger on it. Raptor would say beat them, but how about talking with them and SHARING your concerns?I already have talked with them--that's how I know that they're frustrated at being accused for this. My question is not "Could the kids be doing this?"--it's "Is it possible for MSN Messenger to be downloaded automatically without your consent just by visiting certain sites or using certain programs?" Remember, the kids don't have administrative privileges, so no one as yet has been able to tell me how they would download a program when they aren't authorized by Norton Internet Security to do so.I still think that if you have automatic updates to Windows installing, have installed all the Service Packs that you get them automatically. Anyone else know about this? You will have already enabled this action in your firewall settings, no doubt.Well, GX1 Man, I think you're probably right. Wish there was some way to absolutely verify that's what's happening, but there's probably not. Thanks for helping me try to figure this out. I think this is just some more of Microsoft invading your privacy and telling you where you want to go today!

3793.

Solve : How to set a variable to the resault of a command?

Answer»

I'd like to write a MSDOS batch FILES.
In the batch files, I need to SET a VARIABLE to the resault of a command, such as
SET VER = TYPE c:\temp\newver.txt.
How to CORRECT the command above and WORK out the right resault I want ?A this Website are a few M$-DOS solutions:


http://www.student.northpark.edu/pemente/sed/bat_env.htm#firstword

I like Method 4 solution C.

hope it helps
uli

3794.

Solve : Find logged on user from ipaddress?

Answer»

I was wondering if it is possible to find out what USER is logged on to a pc using the command line when you only have an ip address.
I know how to find the computer name by resolving the ip address to name.

Anyone have any ideas???

Thanks

Markare you TALKING about just a computer on the internet or like a group of computers newtorked togetherIn a NETWORK you can do it with psloggedon.
Check the website sysinternals.com. They have some USEFUL command line tools for NETWORKING as free download.
(pstools)

uli

3795.

Solve : text file of file names?

Answer»

I forgot how to make a text file of the file names in a directory in dos. Any help appreciated.DIR /B >PATH\FILENAME

Dos COMMANDS are hereHey that works but I NEED all the files in sub directories ALSO. Do you KNOW the switch for that?
I used to do this about 15 years AGO but can't remember how.
ThanksWell, you didn't say that. Go to the page I indicated and see if the /S option will do you.help is the command you'd love to use in case of problem

Try

help dirQuote

Hey that works but I need all the files in sub directories also. Do you know the switch for that?
I used to do this about 15 years ago but can't remember how.
Thanks



Use the /s option, so:

DIR /B /S >PATH\FILENAME
3796.

Solve : Running exe which has spaces in path?

Answer»

I'm trying to start an exe from a batch file. The PATH to the exe has spaces in it, so I put i in double quotes, and all that's HAPPENING is a new command prompt window is opening.
Any ideas?
Thanks!

START "C:\Path To My Exe\MyApp.exe"By definition, the START command opens a new window unless the /b switch is used. What are you expecting MyApp.exe to do? And is the path correct?

The quotes are valid. Need more info.

Let us know. 8-)Just don't use Start

What he is trying to say is to use "call"
Example:
call "C:\Path To My Exe\MyApp.exe"Since this question has turned into call versus start, perhaps it would be good to find out that the OP needs to do. One thought is that CALL runs syncronously with the batch file the CALL is part of. START may or may not run in the same window as the original batch file...this has implications as to what environment strings are available to the STARTed task. The original batch file ALSO may or may not WAIT on the STARTed task.

Let us know what you need to happen.

8-)Quote

I'm trying to start an exe from a batch file.

Based on the quote from the OP the idea is to start an exe from a batch file. To do this neither start nor call is required.

Start is explained above by Sidewinder, Call calls one batch program from another.


Sorry, the emails telling me I had responses were getting caught in my spam catcher thing..

Just directly calling the exe without start or call did the TRICK. Thanks y'all!
3797.

Solve : MS Dos problem(One or more Con Code pages invali?

Answer»

HI friends
I am having problem in my MS DOS (WINXP), which is SHOWING "One or more CON Code pages invalid for given keybord code".

Reason of this problem i can't access other drive(Only c drive ). Please help me for it.

Thank you.

Rishi
[emailprotected]Sounds as if this error could be caused by improper key CODES being generated from your keyboard.

http://support.microsoft.com/default.aspx?scid=kb;en-us;265810

Are you using an US-English keyboard?

3798.

Solve : matrix?

Answer»

hi,

copy and paste this into notepad and save as a .bat
it is the convo in the matrix when trinity is talking to NEO onhis computer (matrix I)


Quote

@echo off
:BEGIN
echo To run CMD Message Intercept Interface...
@echo off
pause
CLS
@echo off
ipconfig
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo 125.36.48.65
echo 15.36.52.14
echo 56.32.45.698
echo 452.35.32.113
echo 54.366.21.133
echo 15.66.33.56
echo Intercepting Message . . .
@echo off
PING :: Insert 7=(8-1) second delay
@echo off
CLS
echo Intercepting Message .
@echo off
PING :: Insert 5=(6-1) second delay
@echo off
CLS
echo Intercepting Message . .
@echo off
PING :: Insert 5=(6-1) second delay
CLS
@echo off
echo Intercepting Message . . .
@echo off
PING :: Insert 5=(6-1) second delay
@echo off
CLS
echo Intercepting Message .
@echo off
PING :: Insert 5=(6-1) second delay
@echo off
CLS
echo Intercepting Message . .
@echo off
PING :: Insert 5=(6-1) second delay
CLS
@echo off
echo Intercepting Message . . .
@echo off
PING :: Insert 5=(6-1) second delay
@echo off
CLS
@echo off
echo Connecting 1/3
@echo off
PING :: Insert 5=(6-1) second delay
@echo off
CLS
@echo off
echo Connecting 2/3
@echo off
PING :: Insert 5=(6-1) second delay
@echo off
CLS
@echo off
echo Connecting 3/3
@echo off
PING :: Insert 5=(6-1) second delay
@echo off
CLS
@echo off
echo CONNECTION Successful!
@echo off
PING :: Insert 3=(4-1) second delay
@echo off
CLS
@echo off
echo Displaying active transmission
@echo off
PING :: Insert 2=(3-1) second delay
@echo off
color a0
color 20
color 02
color a0
color 20
color 02
color a0
color 20
color 02
color a0
color 20
color 02
color 0a
CLS
echo Wake Up Neo
@echo off
PING :: Insert 10=(11-1) second delay
CLS
echo The Matrix Has You
@echo off
PING :: Insert 10=(11-1) second delay
@echo off
CLS
echo Follow The White Rabbit
@echo off
PING :: Insert 10=(11-1) second delay
@echo off
CLS
echo Knock Knock
@echo off
PING :: Insert 10=(11-1) second delay
CLS
color a0
color 20
color 02
color a0
color 20
color 02
color a0
color 20
color 02
color 07
echo Transmission ended . . .
@echo off
PING :: Insert 10=(11-1) second delay
EXIT
Not bad for playing around with batch. My challenge to you: Make a batch file which lets you act out a scene from the Matrix.

Oh, and you only need one @ECHO OFF, at the top.nice :)I like it GOOD jobCool script. Thanks for sharing

uli
3799.

Solve : bat file problem?

Answer»

I have a bat file that I email to users to have them update some macro files on their LOCAL machines. The bat file uses XCOPY command as follows:

xcopy s:\Macros\Macro.ebm C:\docume~1\macros\Macro.ebm /y


It works fine and copies the files to the correct location, but it always asks if it is a file or directory that I am copying and the users have to type 'F'. Is there a way to avoid this and either pass 'F' to the prompt or another code to add in my command to tell it is a file?

Thanks,
Ben
Not exactly sure why you would be causing this in all honesty. Windows should know that this is a file and not a folder and not even prompt a user.

Have you considered using the "copy" command instead of the "xcopy" command?DOH!

I was just used to using xcopy in the past and never had a problem with it, MAINLY for the deployment of database frontends. I switched to copy and it worked without the prompt.

Thanks for the help!
Ben

3800.

Solve : easy qestion [noob]?

Answer»

I'm a noob with a noob question, i want to know what is wrong with this .bat
Quote


@echo off
pause
IF date EQU "05/08/2006" (
goto :OK
) ELSE (
goto :dif
)
:ok
@echo date is 5-8-06
pause
goto :end
:dif
@echo Date is not 5-8-06
pause
goto :end

[/tt]Try this:

Code: [Select]@echo off
pause
IF %date:~4% EQU "05/08/2006"goto Ok
goto dif
:Ok
echo date is 5-8-06
pause
goto end
:dif
echo Date is not 5-8-06
pause
goto end
:Endit WORKED when i did it LIKE this
Code: [Select]@echo off
pause
IF %date:~4% == 05/08/2006 (
goto :ok
) ELSE (
goto :dif
)
:ok
@echo date is 5-8-06
pause
goto :end
:dif
@echo Date is not 5-8-06
pause
goto :endthink you