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.

5401.

Solve : If not running?

Answer» HELLO,

I would like to create a batch that checks a a file is RUNNING let say abc.exe and if it is goto :ab.

Thank You

AlmnQuote
If not running

Quote
let say abc.exe and if it is

Confusion reigns; I went with if NOT running. Change to errorlevel 0 if I GOT it wrong.

CODE: [Select]for /f %a in ('tasklist ^| findstr /i "abc.exe"') do if errorlevel 1 goto ab

8-)

Posted code is for XP Pro.
5402.

Solve : What version??

Answer»

There are soooooo many VERSIONS of DOS that I dont even know. I would like to know which on is the newest or which one I should USE for a compuer that only uses DOS. (Or USEING VPC)The last officially distributed standalone DOS was 6.22 by Microsoft and 7.0 or 2000 by IBM. To see the version running on a machine type in VER and press enter.I just wanted to make sure I had the newest one. Oh thank god my hunt for this thing is finally over. Thank you very much.

5403.

Solve : .bat file wait time?

Answer» HELLO everyone..

i want to create .bat file that executes shortcuts in time intervals of 20 seconds, and i have no idea how to set wait time. i've tried -t: 20 ; sleep 20 ;.. nothing works.

example

start 1.lnk
<--- ??!
start 2.lnk

many thanks for your help

stojko
Depending on what OS you have, you can use the CHOICE command in some versions of DOS and Windows 9x. Other versions of Windows can use the SLEEP command which may have come with the OS or can be downloaded in the appropriate RESOURCE Kit. In a pinch you can ALSO use the PING command.

Good luck. 8-)

SIDEWINDER has good suggestions. PING should already be in whatever OS you are using, so that can be used without having to download anything else. To use PING, your code would look like:
Code: [Select]start 1.lnk
ping -n 21 LOCALHOST >NUL
start 2.lnk
You use 21 instead of 20 because the first reply should be almost immediate, and then about 1 second between each of the rest.
5404.

Solve : passing special characters from a txt file?

Answer»

Hi

i have a batch file that takes password from a txt file but the problem is the password contain special character "!" and thus giving me an error, any suggestions for that I'm sure we can help you, but we need some more details as to what the problem is.

Is this running in a command prompt under a CERTAIN version of Windows?
How does the batch file get the password from the text file?
What does it need to do with the password?
What is the error you are getting?The version of the OS is Microsot Windows XP
The version of DOS is 5.2.3790
I have stored the passwords in a bat file say for ex y.bat
The file which requires password a.bat(say) have code that specifies token number .

now at token 15 and 23 in y.bat I have stored the username and password that a.bat requires.

Somehow I dont control these usernames and passwords, they are given to me by third person.

Earlier these SCRIPTS were working fine , last week after the password change it started CORRUPTING .I have updated the password in y.bat

The actaul problem lies that the password contains "^" (carot) special character and therefore i get a error message the password is not authenticated.How are the passwords written to the file? And how are the passwords read back from the file?

The '^' character can have special meaning in a batch file, so depending on how they are written or read from the file we will have to figure out a WAY to escape or substitute that character.Could not get your question how are the passwords witten to the file. they are wiritten as a simple txt format in NOTEPAD file.

5405.

Solve : Developing BAT file?

Answer»

Hello. I am trying to develop a BAT file to speed things up every morning when I log in to my client's network. This is what I have to do every day when I start up my laptop:

(1) Open Outlook, then enter username and password.
(2) Connect printer by doing: Run \\Path1\ then select printer, then connect, then enter same usename and password
(3) open shared drive by doing: Run \\Path2\ and enter same usename and password

I know that the batch file is going to have these commands:
start \\Path1
start \\Path2

But I have no idea how to (1) select the printer and connect it, (2) include the username and password on all 3 above

Any help will be appreciated! Thanks!1. Either write your own script using VBScript or any other scripting language or use a free product like AutoIt. Batch files have a TOUGH time inputting data and keystrokes into a Windows program (Outlook).

2. This can be scripted but need to know whether this is a DOS or Windows type printer CONNECTION. If it's a DOS connection, you can use the NET USE command.

net use printername \\servername\devicename

If it's a Windows connection, you would need a script defining a network object and using the AddWindowsPrinterConnection method.

3. Not sure what you mean by open a shared drive. Usually you just connect and map the drive into your system.

net use driveletter: \\computername\sharename password

Note: password is optional.

Hope this helps. 8-)Sidewinder, thanks so much for your help. Unfortunately, I need to ask you for more detail, as I am not too familiar with these concepts...

I will look into AutoIt and see if I can learn how write script for the Oulook "problem" (guessing this ACCOMPLISHES the same function as a BAT file).

The printer connection is a Windows connection. I am using XP Media CENTER (not sure if this is important). Can you explain the AddWindowsPrinterConnection method? Can it be integrated with the batch file or with the script, or is this a completely different process?

I will try mapping the drive and see if it stays connected so that I don't have to enter username and password every day.

Thanks!the mapped drive will stay there however to prevent having to enter the password everyday you need to create a batch file like sidewinder suggested and then save it to the startup folder... this means whenever you log in the batch file will FUN and you wont have to enter a username or password to open the network drive.

5406.

Solve : telnet batch file?

Answer»

Hi

Hi ALL
I need HELP regarding a batch file through which I telnet and run some application if telnet is successful.

Thankx in advance.windows telnet have limited facility for scripting. its either you download tools from internet that can do this, or write your own USING languages like perl, python,java , vbscript...etc.
Thanks ghost

can U give me a sample perl script to do the same so that I can go through it.Google is your best friend.. type "Net::Telnet examples" in google. Go for the first result, it shows examples on how to use the moduleThankx ghost

I need to CLARIFY 2 more things

1. I am doing telnet thru the batch file and interactively typing the user name and password and I need to test the status code of telnet command then execcute another command if successful. How to achieve this? I will write the algorithm below:
telnet
if telnet is SUCCESSFUL
execute command
else
EXIT

2. Is it possibe to trap ctrl-D character in batch file.Quote

Thankx ghost

I need to clarify 2 more things

1. I am doing telnet thru the batch file and interactively typing the user name and password and I need to test the status code of telnet command then execcute another command if successful. How to achieve this? I will write the algorithm below:
telnet <hostname>
if telnet is SUCCESSFUL
execute command
else
EXIT

2. Is it possibe to trap ctrl-D character in batch file.


1) don't get you. A batch file's purpose is for automation. If you want to do it interactively, just open a command prompt and type telnet will do. And, by doing interactive, your eyes will do the error checking WHETHER its succesful...right?
2) it is BEYOND simple batch to catch keyboard characters, AFAIK. Maybe some assembly code and feeding these code into debug can do the trick..but it's out of scope for me..

5407.

Solve : Can only run DOS commands from \system32\?

Answer»

Running Winxp SP2 with all the new updates. Went into DOS using cmd to run ipconfig. Received this message 'ipconfig
is not recognized as an internal or external command, operable program or batch file'. Then tried 'ipconfig' from 'run' and the DOS screen opened and closed with no result. Tried several other commands in the DOS window, help, attrib etc. and received the same message. If I change to the \windows\system32 directory the commands WORK fine. I could type the command using the full path, but this is tedious. Have no idea what has changed. Assume something in the registry.

Any help would be greatly appreciated.

You can CHECK your path by typing path at a command prompt. I SUSPECT the system32 directory is not included. To change your path:

Right click My Computer==>Advanced TAB==>Environment Variables

Find the path variable in the system variables section and edit it.

8-)

Thanks Sidewinder. That did the trick. I had looked at the environmental variables earlier and MISSED it.

5408.

Solve : need a batch file to convert multiple sound?

Answer»

I need some help please. I am just learning to make batch files. I am using win xp sp2. I have a bunch of wav files on a cd that I need to convert to u-law. I am using sox to convert them but at this time, I can only convert one at a time. What I need it to do is convert all of them to seperate files.

Here is what I have so far

cd c:\sox12181
sox.exe -V d:\archhangup.wav -r 8000 -c 1 c:\ulfiles\archhangip.ul

This converts one file named archhangup to u-law

sox.exe -V d:\*.wav -r 8000 -c 1 c:\ulfiles\.ul

This converts them all into 1 ulaw file which I don't want.

sox.exe -V d:\*.wav -r 8000 -c 1 c:\ulfiles\*.ul doesn't work

can anyone help?

ThanksNot sure if you have a typo, but this may help:

Code: [Select]cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

Your post spells archhangup and archhangip. If this is not a typo another solution would be needed.

8-)no, it didn't work. It was a typo when I was WRITING this. what I want to do as a example

On a CD I have 100 different wav files and I want to convert each of them to u-law. I am using a program named sox to do the conversion. I can convert them one at a time if I enter this command...

c:\sox12181>sox.exe -V d:\test.wav -r 8000 -c 1 c:\ulfiles\test.ul

test.wav - is the name of the wav file that I am converting to u-law

ulfiles - is the name of the directory on my hard drive that I am saving them to

Now what I really want to do is convert them all WITHOUT having to do them one at a time.

Thanks again


Quote

Not sure if you have a typo, but this may help:

Code: [Select]cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

Your post spells archhangup and archhangip. If this is not a typo another solution would be needed.

8-)
Please EXPLAIN where or what the error was. I am not familiar with your SOX program but I can find no error in the batch portion of the file.

8-)I open a text editor and copy

cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

and make it converter.bat

when I run it, you see a command line blink real fast but there is not output into the directory

If I run c:\sox12181> for /f "tokens=1-2 delims=." %%i in ('dir /b *.wav') do (sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul)

at the command line, I get "%%i was unexpected at this time"

sox can be found here http://sox.sourceforge.net/

I really do thank you for your suggestions.

Quote
Please explain where or what the error was. I am not familiar with your SOX program but I can find no error in the batch portion of the file.

8-)
Yeah, when running a FOR statement at the command line, you only need the single %.

The PROBLEM is with the path or lack of it for the DIR command:

Code: [Select]cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b d:\*.wav') do (
sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul
)

8-)Thank you very much!!! this worked

cd c:\sox12181
for /f "tokens=1-2 delims=." %%i in ('dir /b d:\*.wav') do ( sox.exe -V d:\%%i.wav -r 8000 -c 1 c:\ulfiles\%%i.ul)
5409.

Solve : Append to DOS File Name?

Answer»

Is there a way to append portions of an existing DOS file name to a new DOS file name? For example, the original file name is RHD_GOK_0001_YP.pdf. I would like to CREATE a new DOS file name called 012345_00009_YP_000_00001.pdf, where the BOLDED YP and 00001 were from the original file name.

I would like to run this in batch as I have thousands of files that need to be renamed on an on-going basis.

Any help would be appreciated. :-?You can use FOR /F with a DIR to break apart a filename if there is going to be a common delimeter like the UNDERSCORE (_) character. If you can give more information, I'd be glad to help you with a batch file. For example:
Do the file names always have the same delimeters?
Do the file names always have the same number of parts?
How do you decide what to rename them to?Thanks for the ASSISTANCE!

The beginning file name will always have the same delimiters however, what will change is the GOK_0001_YP will change to some other combination but their length will always be 3(GOK), 4(0001) and 2(YP) respectively. For example, the next time the file name may be ATK_0099_WP, etc. The file names (old and new) will always have the same number of parts. The new beginning file name (012345_0009) and the _000 shown after the _YP is a product number which will always be the same SIZE and appended to the same location as shown in my original question. The new product number changes every month.

The GOK_0001_YP is how we get the product in, the 012345_0009 is how we ship the product out.Okay, I think I understand.
We have existing file names that are in the format of
aaa_bbbb_cc
and we want to rename them to
012345_00009_cc_bbbb
or do we want to pad the last set with a 0 like
012345_00009_cc_0bbbb
??

Let me know and I'll put together a quick batch file for you.

5410.

Solve : copy files from csv list?

Answer» HOLA,
All I need to do is copy files with one or another extension, from many many different sub- directories in a root directory, to an OUTPUT directory.
The list will be of the sub-directories to look in (I don't want files from all of the sub-directories)
Any help appreciated.
XP sp2

TimI'm not exactly sure what you mean, but this should GET you started
I'll assume your "files with one or another extension" are GIVEN in a batch file variable
I'll assume your "output directory" is given in a batch file variable
I'll assume your CSV file list is named dirs.csv

Code: [Select]@echo off
setlocal
set fileExtensions=.doc .xls
set outputDir=D:\output
for /f "delims=," %%a in (dirs.csv) do call :CopyFiles %%a
goto :EOF

:CopyFiles
for %%b in (%fileExtensions%) do xcopy "%*\*.%%b" "%outputDir%\"
goto :EOF
5411.

Solve : Copy folder?

Answer»

How may i copy a folder from one path to another path?
i did try xcopy command... but SEEM the folder is not being copy...
pls adviced...the xcopy is the tool to USE. what exact syntax did you use.?Quote

the xcopy is the tool to use. what exact syntax did you use.?
"xcopy C:\abc c:\def" this is what i use...check the xcopy help again (type xcopy /? )... look for /S and /E switch options..Try
Code: [Select]xcopy c:\abc c:\def\ /s
5412.

Solve : batch file needed to pass in user name?

Answer» HEY guys,

I need a batch FILE to pass in a username to a program after it starts it.

So I have start mike.exe and I want it to pass in monty as the user name to this program.

Any thoughts on how to do this?

ThanksCan your program mike.exe take in any arguments?I don't actual know. Is there anyway to find out?
The name of the program is KEA!
Though when I start it up it asks for my usernamewhere did you get this program...maybe they have an instruction manual or something.
another "BLIND" way to find out, you can TRY typing:
kea -h or kea /? to see if it gives you any command line help.
lets say the kea can take in arguments.

What commands would you be using? How would you pass in the user name?if kea can take in commands, eg kea -u john -p password

in your batch, just type in "kea -u john -p password" will doIf it takes arguments for the username and password, that would be the best way to do it, as suggested by ghostdog. If it does take arguments, they will be specific to each program. It could be what ghostdog suggested:
kea -u john -p password
or it could be like
kea /user:john /pass:password
or almost anything else.

If you know it FIRST asks for a username, then a password, you could automate it like
echo john >in.txt
echo password >>in.txt
kea <in.txtgreat guys thanks a lot
5413.

Solve : Need help with DOS?

Answer»

I am trying to create a batch file to compare 2 file names from different directories.
I have been reading and trying different things, but with no luck.
I can create the batch file, but I keep getting errors about the IF command

This is what I am trying to achieve
I am wanting to compare the filenames only from C:\program files\my folder\my app *.mde to Z:\upgrades\my app *.mde
(the * is for LIKE version 6.1 or 7.3 and so on)
I am wanting to check to see if the version numbers are the same, and if they are not, I would like to warn the user of a new edition and give them an option of
1. Upgrading - which would delete the current file and copy the newer version in the same folder, then give them a mesage "Copy Complete" or
2. Wait till later - which would not change anything , but open the current file

Any help would be appreciated, what I have to go through to make this change on every PC is very time comsuming, which none of use have a lot of time anymore!
Gratefull for Your TIME!
DaveTry something like this:

@echo off
setlocal
set SourcePath=C:\program files\my folder\
set DestPath=Z:\upgrades\
set FileSpec=My app*.mde

for /f "delims=" %%a in ('dir /b /a-d "%SourcePath%\%FileSpec%") do if exist "%DestPath%\%%na%%xa" (
echo Same file exists
) else (
echo New edition of "%%na%%xa".
set /p Answer=Press 1 to upgrade now, or 2 to upgrade later:
if {%Answer%}=={1} delete %DestPath%\%%na%%xa"© "%SourcePath%\%FileSpec%" "%SourcePath%\%FileSpec%"
if {%Answer%}=={2} start "%SourcePath%\%FileSpec%"&goto :EOF
echo You are supposed to enter 1 or 2
)
I am having trouble with this,when I run this I get this

Code: [Select]C:\>mytest.bat

C:\>setlocal

C:\>set SourcePath=C:\MM3M3

C:\>set DestPath=Y:\dsd19\upgrade

C:\>set FileSpec=MM6.mde

C:\>for /F "delims=" %a in ('dir /b /a-d "C:\MM3M3\MM6.mde") do if exist "Y:\dsd19\upgrade\%na%xa" (echo same file exist ) else (
echo new edition of "%na%xa"
set /p Answer=Press 1 to Upgrade Now, or 2 to upgrade later:
if {%Answer%}=={1} delete %DestPath%\%%na%%xa"&copy "%SourcePath%\%FileSpec%" "%SourcePath%\%FileSpec%"
if {%Answer%}=={2} start "%SourcePath%\%FileSpec%"&goto :EOF
echo complete
)
The system cannot find the file 'dir /b /a-d "C:\MM3M3\MM6.mde".

C:\>
I can get it to function without 'dir /b /a-d
And the second problem is the return of "%na%xa" instead of the filename.

This is what I have got in the bat file
There should be an * in PLACE of the 6 in the filename, I changed it to get it to find the file, is an * used as a wildcard. Since that is what would be different in each file name?

Code: [Select]setlocal
set SourcePath=C:\MM3M3
DestPath=Z:\dsd19\upgrade
set FileSpec=MM6.mde

for /f "delims=" %%a in ('dir /b /a-d "%SourcePath%\%FileSpec%") do if exist "%DestPath%\%%na%%xa" (
echo Same file exists
) else (
echo New edition of "%%na%%xa".
set /p Answer=Press 1 to upgrade now, or 2 to upgrade later:
if {%Answer%}=={1} delete %DestPath%\%%na%%xa"&copy "%SourcePath%\%FileSpec%" "%SourcePath%\%FileSpec%"
if {%Answer%}=={2} start "%SourcePath%\%FileSpec%"&goto :EOF
echo You are supposed to enter 1 or 2
)

Any Ideals or than me being total lost?

Oops. Forgot the closing single quote in the FOR /F.

Code: [Select]@echo off
setlocal
set SourcePath=C:\MM3M3
set DestPath=Z:\dsd19\upgrade
set FileSpec=MM6.mde

for /f "delims=" %%a in ('dir /b /a-d "%SourcePath%\%FileSpec%"') do if exist "%DestPath%\%%na%%xa" (
echo Same file exists
) else (
echo New edition of "%%na%%xa".
set /p Answer=Press 1 to upgrade now, or 2 to upgrade later:
if {%Answer%}=={1} delete %DestPath%\%%na%%xa"&copy "%SourcePath%\%FileSpec%" "%SourcePath%\%FileSpec%"
if {%Answer%}=={2} start "%SourcePath%\%FileSpec%"&goto :EOF
echo You are supposed to enter 1 or 2
)
Still have an 2 ISSUES, one may take care of the other
1
set FileSpec=MM6.mde can I use * as a wildcard for the digit following MM

2
in the return I am still getting
new edition of "%na%xa"

The comparesome is still wrong, I can change the file name to the same and it still says new edition of "%na%xa".

Is "%na%xa" supposed to be a filename?

ThanksYes, you should be able to use a wildcard.

Sorry about the return ... I need to remember to test my code if it is more than a LINE or two.
Replace the "Echo New edition ..." with

Code: [Select]echo New edition of "%%~na%%~xa"

5414.

Solve : Silent Uninstall for installshield app?

Answer»

Hello I am trying to do a silent uninstall for my Cisco VPN CLIENT. I went through the steps that I found online and i made a ISS file and everything. Here is my command

Code: [Select]IDriver.exe /M{5624C000-B109-11D4-9DB4-00E0290FCAC5} /s C:\REMOTE ACCESS\Cisco-Client3.6.4-K9\setupuninstall.iss
This runs and the computer does something but it does not uninstall the cisco VPN silently.

Any help would be APPRECIATED. Thank you.I am not familiar with IDriver.exe, but I have successfully used the Windows Installer to install and un-install programs. Does your Cisco VPN client have a .MSI file? If so, try
msiexec.exe

You can get help by MSIEXEC /?

5415.

Solve : batch or script to remove ALL user folders in XP?

Answer»

I have 200 students logging into around 30 PC's and every time one logs in XP creates a copy of the users folder in documents and settings, after a week or so the older machines are full up so I need a small batch file or script to SILENTLY remove ALL folders in the D&S folder EXCEPT admin and "all users"

Anyone have any idea's? I could probably figure it out in shell scripting but I am a bit stumped in Windows

Please HELP as it would save a LOT of time sat deleting stuff manually every week

Many Thanks in advance to the Champion who helps me outThis is actually easier in batch than say VBScript due to the hidden directories.

Code: [Select]@echo off
cd /d c:\documents and settings
for /f "delims=" %%i in ('dir /a:-hd /b') do (
if /i not %%i==Administrator if /i not "%%i"=="All Users" rd %%i /s /q
)

Hope this helps. 8-)

PS. I suspect you want to keep the Default User, LocalService, and NetworkService.Thanks, gonna go modify it a bit and give it a whirl, hopefully I can SET up a telnet on all the PC's with this in the system folder to save me getting off my lazy *censored* like I can with all the Mac's on the network

Will report BACK and thanks againwhat is that /d switch? what it do?The /d switch on a cd command allows you to change both the drive and the directory in one command. Not SURE how many Windows versions support this switch.

8-)

5416.

Solve : Microsoft Paint. HELP NEEDED pleaseee?

Answer»

hi=) i was just wondering how do you type on microsoft paint? for example you drew pictures for a comic and want people in your pictures to be talking. how BOUT u type the THINGS u want them to say? thank you for you HELP! What version of Windows / MS Paint are you using?
CLICK on the "Text" button which looks LIKE the letter "A", then click (or click and drag) where you want your text to go.

5417.

Solve : shutdown.bat to shutdown pc after a set time?

Answer»

shutdown -l -s -f -m \\computername -t 5 -c "Pc shutting down in 5 seconds" -d up:125:1

that is what i put in the bat file. Now i get it supposed to logoff the user, shutdown after 5 seconds and i dont get what the -d up:125:1 is for but its there. I ran it but it wont shutdown the pc. I just see writting all over the screen. Looks like its looping or something. I'm new to bat files so ye , i pulled this off somewhere. Just wandered where im going wrong. Any help will be appreciated, thank you.

oh im running xp service pack 2. dos ver 5.1 ANYTHING i left out plz let me know.check the help for shutdown by typing shutdown /? on your COMMAND line. Get a feel of what those switches mean.im doing the same thing and found that if i type
shutdown -r -m \\computername
into a cmd prompt it restarts the computer fine.
However if i try and make this a batch file it just loops the cmd over and over without actually doing anything.... is there a simple mistake im making here???I assume you are using XP ? the shutdown command does not allow -l to be used with -m
you have -l and -m ... i guess that's where its not working..
Code: [Select]shutdown -l -s -f -m \\computername -t 5 -c "Pc shutting down in 5 seconds" -d up:125:1

Also, -l is for logging off....and not shutdown...there's a difference . shutdown is -s
if you specify -l and -s , exactly what do you want to do ? logoff or shutdown??

remove the switches you don't need, and it will be alrightBe sure you aren't naming the batch file "shutdown.bat" or something like that. And / or specify extensions in your batch file, like:
Code: [Select]shutdown.exe -s -f -m \\computername -t 5 -c "Pc shutting down in 5 seconds"
The -d is the reason code for the shutdown.shutdown.exe -s -f -t 5 -c "Pc shutting down in 5 seconds" -d up:125:1

that the final one. and it works. THANX everyone for the help. I did everything all your replies said. Thanx guys. It works now.ok im still confused what is the code to shutdown in computer in a time period?? :-? and i need to no a batch file that will open up a folder for me that has all of my WORK in it?

can i get the code from the beginning plzunlovedwarrior: It is usually better to start your own question. Go to the forum and click on "Start a new topic" to ask your questions.I posted the final code already. In my previous post in the topic is the code.

edit: here it is Code: [Select]shutdown.exe -s -f -t 5 -c "Pc shutting down in 5 seconds" -d up:125:1 will shut down after 5 seconds. I cant find the link to the site where it EXPLAINS what each thing does. the s shutsdown, t is timer c is the message.Here is the link to the site that explains what each thing does:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/shutdown.mspxthanks guys, does exactly what i wanted now. cheers.

5418.

Solve : string parsing (with batch)?

Answer»

Hello,

I have a PATH in a variable and WANT only the file / folder name, not the whole path.

example:
-iso c:\folder\folder\file name

output should be: file name

The problem is I can`t work with spaces as delimeter cause sometimes folder and filenames are with spaces.
The number of subfolders differs.
Is there MAYBE a trick to filter out the token after the last \?

thanks in advance for any help
uliQuote

Hello,

I have a path in a variable and want only the file / folder name, not the whole path.

example:
-iso c:\folder\folder\file name

output should be: file name

The problem is I can`t work with spaces as delimeter cause sometimes folder and filenames are with spaces.
The number of subfolders differs.
Is there maybe a trick to filter out the token after the last \?

thanks in advance for any help
uli

The for loop help explains that %~nI expand %I to file name. For more info, type for /?. Maybe its want you want.I think ghostdog is right. You probably want %%~na%%~xa (assuming your variable is %%a in a FOR loop)
You will have to give more details or POST your code if you NEED more help.thats it.
I should learn to work with qualifiers.

Many thanks :-)

uli


5419.

Solve : drive listing?

Answer»

With a DOS "DIR" command one can get a listing of files and directories of a specified drive. Which DOS command allows to get a listing of drives (drive letters)?

REGARDS,
CzJasQuote

With a DOS "DIR" command one can get a listing of files and directories of a specified drive. Which DOS command allows to get a listing of drives (drive letters)?

Regards,
CzJas
if you are on XP, can use FSUTIL. Check out fsutil /? . eg fsutil fsinfo drives... I am on WIN 2000 Professional ...A simple one would be.

for %%a in (a c d e f g h i j k L m n o p q r s t u v x y z) do (
if exist %%a echo %%a exist
)
5420.

Solve : connection?

Answer»

Hello,

I would like to know how to repair\renew\release a connection on an WINDOWS xp pro machine and a limited account. This connection is wired.

Thank You

AlmnI think you will have to know the username and password of an administrator account. If you have a user account that is a local administrator you can use the RUNAS command to do it from a limited account. Do:
runas /user:administrator "ipconfig /release"
runas /user:administrator "ipconfig /renew"

Or just start a command prompt with RUNAS like:
Start -> Run -> "runas /user:administrator cmd.exe"
and you can run IPCONFIG as you wish.

I'm not sure how to do the "repair". I tried using RUNAS to start ncpa.cpl, but it didn't seem to WORK properly.

If you DO NOT have an administrator login, then I don't know of a WAY to use these TOOLS.

5421.

Solve : pause: press any key to continue (timer on that)?

Answer»

Sidewinders CODE should work. It sounds like you are running it from a shortcut or an icon or the Start -> Run box. Since it sounds like you are NOT running it from the COMMAND prompt (which would MAKE it a lot easier for you to troubleshoot), try turning ECHO on, and add a pause at the end so you can see what it is doing. Like this:
Code: [Select]echo on
taskkill /F /IM outlook.exe
taskkill /F /IM thunderbird.exe
CHOICE /C:YN /T:N,20 continue yes or no
ECHO.%ERRORLEVEL%
IF ERRORLEVEL 2 goto end
IF ERRORLEVEL 1 GOTO Label1
:Label1
taskkill /F /IM acrotray.exe
taskkill /F /IM explorer.exe
:end
pauseIt finally works. LOL you know what happened? Maybe i shouldnt say. Ok i got that choice.com file which was mentioned in the 2nd post already. now i ran it and nothing happened. Anyway i read on another site that i must put it in my windows\system32 FOLDER so i did and it works. hehe thanx guys.

Yes his code is right. Thanx to all who helped out. You help was not in vain. Thanx guys.

5422.

Solve : Pulling DOS from system?

Answer»

Is there any way I can make DOS disks from my system INCASE I need to reformat my hard drive. I have system disks but not the DOS disk.What OS is your comptuer running? Is it running Windows, or just DOS only? Please post DOS VERSION, and Windows version, if any.Quote

Is there any way I can make DOS disks from my system incase I need to reformat my hard drive. I have system disks but not the DOS disk.
you can GO to http://www.bootdisk.com/. There are various kind of dos disk you can BUILD.
5423.

Solve : Varible Drives Unknown?

Answer»

Normally a pc should have a drive C:

But how do you allow other drive letters in your code in a batch FILE

Say if you made copy C:\myfoler C:\myfolder
but they didnt have a C:\ only an E:\
how would you allow for different drives?

Then next, what if you had a mapped drive and the other pc was off, how would you stop the rest off the code from running after the copying failed?I'm not sure I understand the first part of your question. You can use any available drive letters in your batch file as you have them listed here. Like
Code: [Select]copy c:\myfolder e:\myfolder Or maybe I don't understand? Can you please explain:
Quote

Normally a pc should have a drive C:

But how do you allow other drive letters in your code in a batch file

Say if you made copy C:\myfoler C:\myfolder
but they didnt have a C:\ only an E:\
how would you allow for different drives?

For the network drive, you can do an IF test first. For example, if your network drive is Z:, you could do:
Code: [Select]if not exist z:\ echo Network drive not found&goto :EOF
echo Network drive found, running rest of batch fileI am good at confusing people today.

This batch file will be put on different pc's, and I KNOW from WORKING on pc's that sometimes someone might set a local drive on a pc to E:\ instead of C:\.
I have installed SCSI drives before and sometimes you cannot change the drive path of E:\ to C:\.

Only 1 hard drive with an only 1 unkown directory
(unknown being in your code)
C:\ maybe
D:\ maybe
E:\ maybe
etc.

I am wanting to make 1 batch file to use on all of the pc's here and I would like not have to modify it because of a pc not having a drive C:\. When you have a lot of pc's to tend to sometimes you forget whos got what.

What I am getting to is
is there a WAY to specify an unknown local drive.
If your code refers to drive C:\ and there ISNT one, only a drive E:\

I wonder if you could use an if statement to check for drive letters, or is there a better way?

Hope this helpsUse the %systemdrive% variable.
Try this in a batch file (or the command prompt):
Code: [Select]@echo My computer is running Windows from the %systemdrive% drive.That will do the trick
Your the Man!Thanks!
5424.

Solve : Cacls and a batch file...?

Answer»

For the original question, you only need the second line. Change:

Code: [Select]for /f "delims=" %%a in (caclslist.txt) do (echo y|cacls "%%a" /p guest:n)
for /f "delims=" %%a in (caclslist.txt) do echo y|cacls.exe "%%a" /p guest:n|find /i "processed">>cacls.log 2>NUL
into

Code: [Select]for /f "delims=" %%a in (caclslist.txt) do echo y|cacls.exe "%%a" /p guest:n|find /i "processed">>cacls.log 2>NULGreat, thanks for all your help. TOOK a little messing around but it's now working perfectly. Going through all this I was wondering if there was any site or book you could recommend to check out to learn some of this stuff. I know bits and pieces but not really enough to get by... obviously. Anything you can recommend would be appreciated.

Thanx againI don't know of any books, but try looking through all the commands on these 2 sites.

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx
http://www.ss64.com/nt/

They are both good references.

Good luck!Thanx for the links. I'll be SURE to work my way through them. There were a couple things I was wondering for now though. What does the '2>NUL' do and also, what's with the "delims="?

ThanxThe 2>NUL is redirecting output.

By default the '>' symbol will redirect output from STDOUT which is usually non-error messages meant for the screen. You can redirect to a file with ">filename" which is the same as "1>filename", or you can redirect the output to the "black hole" of NUL with ">NUL". But besides STDOUT, there is also STDERR, which are error messages and are separate from STDOUT. To redirect error messages, you use "2>". If you want to redirect both standard and error messages to NUL you can use ">NUL 2>&AMP;1" which basically means send STDIO to NUL and send STDERR to the same handle as "1>".

Here is more info on redirection:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx

The "delims=" in a FOR statement means there are no delimeters, so everything on the entire line will be placed into the variable. This is USED if you don't want to break the line apart, but keep it all togehter. In the case of your question, it was used to deal with any possible spaces in the file names.

I hope that CLEARS things up a little bit.Quote

Thanx for the links. I'll be sure to work my way through them. There were a couple things I was wondering for now though. What does the '2>NUL' do and also, what's with the "delims="?

Thanx
2>Nul means redirecting standard error to nul. meaning to suppress errors.
For more info, check out http://www.robvanderwoude.com/index.html. This site also a lot of great resources and examples on batch.

delims= means delimiters. for more infor, check the for /?Cool, thanx again for all the help guys. I think I'm all set now. Hopefully I'll be able to help some people on here once I figure out what the *censored* I'm doing.
5425.

Solve : Help with batch file to delete documents needed!?

Answer»

This should be an easy thing for someone that actually knows a little something about BATCH files! I just want to delete some MS Word documents from a folder. The files are named according to date, i.e., 0616, 0617, 0618, so this is how I would like to identify the files to be DELETED (delete all files in a specific folder that begin with 0616). Of course, I would like to not have to respond "y" for every file deletion!

This was my first TIME posting, so I hope I did it right!on the COMMAND prompt, type del /? . There's an option for not prompting you for yes or no.
to delete files begining with 0616, USE wildcard "*" , eg 0616*
i did that del /? and i came with this

Code: [Select]Del /Q /S 0616*
it works too. /q is quiet mode so it dont ask you. and the /s deletes all files from sub directory. put the batch file in the folder that the files are.Got it and it works like a champ. Thanks!

5426.

Solve : errorlevels in xp?

Answer»

hey all,

does any one know the errorlevel code for "The system could not find the path specified" in xp?


have tried to google but found nothing.

please helpWhat are you TRYING to do when this error occurs?
I don't know where these codes are DOCUMENTED, but I was able to capture these errorlevel codes at the console using XP Home.

Code: [SELECT]....is not recognized as an internal or external command,
operable program or batch file.

errorlevel 9009

Code: [Select]The system cannot find the path specified

errorlevel 3

These codes may not be STANDARD across the various Windows versions.

sidewinder, nice one.


thats the one we're after. cheers

thanks all!!!!!




5427.

Solve : Set Size of Command Prompt Window - Batch File?

Answer»

Are there parameters (like color) that I can use to set the size of the command prompt window (Windows XP) that shows when a batch file is running?
I want the messages that I echo to the user to sit centered in the command prompt window and the BEST way to do that is make sure that every time the batch file runs the window opens to a specific size.

Thanks for the help,

PoSo you MEAN like this?

Paste the following code in notepad and save it as a batch file. (copy whole code)

Code: [Select]@echo off
echo normal mode
pause
cls
mode 20,30
echo mode 20,30
pause
cls
mode 30,20
echo mode 30,20
pause
cls
mode 44,10
echo mode 44,10
pause
cls
mode 80,15
echo mode 80,15
pause

Basically to change the cmd window, the command is MODE ##,##You COULD also get CMDOW, a Command Line Utility which ALLOWS you to resize the window of command prompt (or any window, for that matter) to the pixel.

It also has a LOT of other helpful tools, such as min/maximising windows and move the position of a window (which is something you could utilize also) so I would definitely take a look into it.

5428.

Solve : Change modified by??

Answer»

Hey I was wondering if there was a way, using a batch file to change who a file reports as last modifying it?
Say, person XYZ had modified the file when you go: "dir /s /q" is there a way to manually change that to anything you want, even if it would be nonexistant?

Thanks,Why do you want to do this?
Quote from: contrex on June 07, 2007, 01:09:10 AM

Why do you want to do this?

Well at school I have this chat program and it writes this log file to the drive with hidden and system attributes. YET the last person that added to it has their NAME added as modified by, which can be viewed by 'dir /s /q drive:' among other means. I need to make it so that it is anonymous. Also for when I put the chat file on there it would be better if they couldn't trace it to my login.

I don't want to do anything too bad, I just want to know if its possible, and don't say its not just because you think im a rebel...

ThanksI apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion.

Almost anything is "possible", whether it is DESIRABLE is another matter.

Quote from: contrex on June 07, 2007, 01:34:03 AM
I apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion.

Almost anything is "possible", whether it is desirable is another matter.


Would you say you had sufficient knowledge to be able to accomplish the task or not?Quote from: DeltaSlaya on June 07, 2007, 01:42:13 AM
Quote from: contrex on June 07, 2007, 01:34:03 AM
I apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion.

Almost anything is "possible", whether it is desirable is another matter.


Would you say you had sufficient knowledge to be able to accomplish the task or not?

I don't see how my knowledge or lack of it is relevant; your tone begins to annoy.
Quote from: contrex on June 07, 2007, 01:49:09 AM
Quote from: DeltaSlaya on June 07, 2007, 01:42:13 AM
Quote from: contrex on June 07, 2007, 01:34:03 AM
I apologise in advance if I am second guessing the moderators here, but it is not (I believe) the policy of this board to encourage or facilitate misuse of a school's or employer's IT facilities, and what you are asking definitely falls into that category. "Vandal" would be a better term than "rebel" in my opinion.

Almost anything is "possible", whether it is desirable is another matter.


Would you say you had sufficient knowledge to be able to accomplish the task or not?

I don't see how my knowledge or lack of it is relevant; your tone begins to annoy.

Sorry if it came out like that, it's just that I really wouldn't mind being able to achieve this.

Thanks.I will go as far as to say this. In general, changing file attributes, ownerships and permissions on a multi user system requires administrator privileges. If you ain't the administrator, it's because the computer owner doesn't want you to be able to do these things. If you seek to gain those privileges without permission, that makes you a hacker, and we don't like them on here.

I might well know how to jemmy open a door or bypass a burglar alarm, but I would be very irresponsible to post a how-to on a web forum.

And yes, I do know how to do what you describe. Part of my job involves protecting a system against such threats, so I am aware of steps that misusers might take.


Quote from: contrex on June 07, 2007, 02:07:12 AM
I will go as far as to say this. In general, changing file attributes, ownerships and permissions on a multi user system requires administrator privileges. If you ain't the administrator, it's because the computer owner doesn't want you to be able to do these things. If you seek to gain those privileges without permission, that makes you a hacker, and we don't like them on here.

I might well know how to jemmy open a door or bypass a burglar alarm, but I would be very irresponsible to post a how-to on a web forum.

And yes, I do know how to do what you describe. Part of my job involves protecting a system against such threats, so I am aware of steps that misusers might take.



I'm trying to change neither ownerships or permissions. Also I'm definitely not trying to HACK anything .
Just change person X to person Y, and I want to know how ...

Thanks lolQuote
I'm trying to change neither ownerships or permissions.

Your own words:-

Quote
Say, person XYZ had modified the file when you go: "dir /s /q" is there a way to manually change that to anything you want, even if it would be nonexistant?

the "name" revealed by dir /q is the owner of the file

Quote
C:\>dir /?
Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

[drive:][path][filename]
Specifies drive, directory, and/or files to list.

/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files A Files ready for archiving
S System files - Prefix meaning not
/B Uses bare format (no heading information or summary).
/C Display the thousand separator in file sizes. This is the
default. Use /-C to disable display of separator.
/D Same as wide but files are list sorted by column.
/L Uses lowercase.
/N New long list format where filenames are on the far right.
/O List by files in sorted order.
sortorder N By name (alphabetic) S By size (smallest first)
E By extension (alphabetic) D By date/time (oldest first)
G Group directories first - Prefix to reverse order
/P Pauses after each screenful of information.
/Q Display the owner of the file.
/S Displays files in specified directory and all subdirectories.
/T Controls which time field displayed or used for sorting
timefield C Creation
A Last Access
W Last Written
/W Uses wide list format.
/X This displays the short names generated for non-8dot3 file
names. The format is that of /N with the short name inserted
before the long name. If no short name is present, blanks are
displayed in its place.
/4 Displays four-digit years

Quote
Also I'm definitely not trying to hack anything

I say you are. if you don't even know how to find out about file ownership, what it is, and who can change it, which is hardly secret knowledge, how can you be so sure what is or is not hacking?

5429.

Solve : Need help with batch file to backup user data?

Answer»

Hi All, I'm new to scripting and writing batch file. I would really appreciated if someone can help me with this batch file i'm working on. The purpose of this file is to backup the user data to a network location. As of now, it'll do it job of backing up. I NEED some minor tune up with the batch file.

Here's the batch file:

:MAP user U_DRIVE_ARCHIVE
net use k: \\htbwfs05\%username%_u$

Delay 20

:killing outlook process
taskkill -f -im outlook.exe

:Backup
cd C:\Program Files\Microsoft\SyncToy
Synctoy /min -R"Network Backup

if exist \\htbwfs05\%username%_u$\desktop goto continue

:next - Create desktop and favorites folder if does not exist
md \\htbwfs05\%username%_u$\desktop
md \\htbwfs05\%username%_u$\favorites

:continue - create zip file of desktop and favorites
set folder=%date:~10,4%%date:~4,2%%date:~7,2%
"C:\program Files\winzip\wzzip.exe" -a -p -r "K:\desktop\desktop%folder%.zip" "%userprofile%\desktop\."

set folder=%date:~10,4%%date:~4,2%%date:~7,2%
"C:\program Files\winzip\wzzip.exe" -a -p -r "K:\favorites\favorites%folder%.zip" "%userprofile%\favorites\."

:Remove map drive
net use K: /delete

:resume desktop
taskkill -f -im hidedesk.exe

pause

Here's are some question i have.
1. Is there a way i can set the focus on the hidedesk.exe window? as of now the hidedesk window will hide the desktop but once Synctoy kick in, it'll be on top of the hidedesk screensaver.
2.Is there away to do incremental backup to the user desktop/favorites folder beside using xcopy? The method im using above is what i got from reading a post from GuruGary(sp?). What it does is making a new zip file for every DAY that i'm running the batch file. The ideal thing that i hope it can do is to do incremental backup to the same zip file and change the date when i'm running it. Alternatively, i can just use the xcopy command to do incremental backup using the following command:
xcopy "%userprofile%\desktop\." /d /s /e /f /y "K:\desktop"
xcopy "%userprofile%\favorites\." /d /s /e /f /y "K:\favorites"

Any help would be much appreciated.Quote from: Stormryder on June 05, 2007, 11:28:50 AM

Here's are some question i have.
1. Is there a way i can set the focus on the hidedesk.exe window? as of now the hidedesk window will hide the desktop but once Synctoy kick in, it'll be on top of the hidedesk screensaver.
2.Is there away to do incremental backup to the user desktop/favorites folder beside using xcopy? The method im using above is what i got from reading a post from GuruGary(sp?). What it does is making a new zip file for every day that i'm running the batch file. The ideal thing that i hope it can do is to do incremental backup to the same zip file and change the date when i'm running it. Alternatively, i can just use the xcopy command to do incremental backup using the following command:
xcopy "%userprofile%\desktop\." /d /s /e /f /y "K:\desktop"
xcopy "%userprofile%\favorites\." /d /s /e /f /y "K:\favorites"
For question 1, try launching the "hidedesk.exe" program again. If that doesn't work, then try something like this (you may have to change the title depending on the actual title of the window):
Code: [Select]echo set WshShell = CREATEOBJECT("Wscrip.Shell") >ActHideDesk.vbs
echo WshShell.AppActivate "HideDesk" >>ActHideDesk.vbs
cscript ActHideDesk.vbsFor question 2, is there a reason you don't want to use XCOPY? The ZIP programs all work a little bit different, so WITHOUT knowing your brand and version there isn't an easy way to help you fix it. But it seems to me like the xcopy method should work well. If not, let us know why, or post the details of your zip program.Thank you for the reply.
My solution for the first question is by inserting a delay in the batch file that i use to open up the hidedesk.exe.
For the 2nd question, i guess i'll just have to use xcopy to do the incremental backup. Btw, the winzip version i'm using is WinZip 10.0.
5430.

Solve : Replacing a String of text with something else with a BAT file?

Answer»

Alright, so I'm trying to make a batch file that finds a string in a .INI file and replaces it with another. The string in the .INI file looks like this:
"DOB=06 03 2007" (but without quotation marks)

I've created the part of the batch file that gets the current date of business from the timestamp and places it into a variable named DOB with the same format as the string above. I just need to
a.) Find the string in the .INI file
b.) replace the above string in the .INI file with the DOB variable.

Bottom line, this will basically updates the date of business to the current date on the system. Can anyone help me with this?
Thanks.

Maybe to help out, here's what I have so far:
-------------------------------------------------------------------
set Year=%date:~-4,4%
set Day=%date:~-7,2%
set Month=%date:~-10,2%
Set DOB=DOB=%Month% %Day% %Year%

C:
For /f "delims=" %%a in ('FindStr /C:"DOB=" C:\Temp\File.INI') do (
Echo %%a
Pause
)
Goto :EOF
-------------------------------------------------------------------

This will echo the line "DOB=06 03 2007" (without Quotes) currently. So, I've found the line and have been able to capture it completely, but I still can't seem to replace it with the current date or the DOB variable.So, if your file read

apples
pears
bananas
DOB=06 03 2007
cheese
ham
eggs

To me, that date says 6th March 2007, but hey, i'm European, I'll assume you're using US date format

so if you processed it today 5th June

you'd want it to read, afterwards...

apples
pears
bananas
DOB=06 05 2007
cheese
ham
eggs

Is that right?

That is exactly correct. Everytime I run this batch file, or fire it off, it'll basically overwrite that string with the correct date.
Thanks.This uses your date code, so should be good for your locale. Suggest you test it on dummy data before letting it LOOSE on your real stuff!!!! cut out not needed stuff to suit...

I used the %temp% system variable because I don't use C:\TEMP, so you may have to *censored* around with that...

Code: [Select]@echo off
setlocal enableextensions
setlocal enabledelayedexpansion

REM set up test file
echo Purchase Order # : 123456 &GT; "%temp%\file.ini"
echo Filing code : ZQ >> "%temp%\file.ini"
echo Item Name : Reverse Action Flange Clamp >> "%temp%\file.ini"
echo Item Price : $45.50 >> "%temp%\file.ini"
echo DOB=01 01 2000 >> "%temp%\file.ini"
echo Customer name : Joe Smith >> "%temp%\file.ini"
echo Customer address 1 : 123 Main St >> "%temp%\file.ini"
echo Customer address 2 : Hackensack NJ >> "%temp%\file.ini"
echo Customer address 3 : 123456789 >> "%temp%\file.ini"
echo Customer phone : (200) 123-45678 >> "%temp%\file.ini"

set Year=%date:~-4,4%
set Day=%date:~-7,2%
set Month=%date:~-10,2%
Set DOB=%Month% %Day% %Year%
set newline=DOB=%DOB%

REM show test file before processing
echo. & echo Before... & echo. & type "%temp%\file.ini" & echo.

REM delete output file if it exists
if exist "%temp%\file.ini.new" del "%temp%\file.ini.new"

REM for each line in input file
for /F "delims=" %%L in (%temp%\file.ini) do (

REM copy input line to output line
set outputline=%%L

REM EXCEPT if input line contains DOB=
REM in which case replace with new line
REM Meaning of && operator is that statement to right of &&
REM is only executed if operation to left of &&
REM is successful. Opposite is || operator (execute if NOT sucessful)
REM sending echo to nul to avoid screen clutter
echo %%L | findstr "DOB=">nul && set outputline=%newline%

REM WRITE output line to output file
REM need delayed expansion as we are in a FOR loop
echo !outputline! >> "%temp%\file.ini.new"
)

REM delete input file
del "%temp%\file.ini"

REM replace input file with output file
copy "%temp%\file.ini.new" "%temp%\file.ini">nul
del "%temp%\file.ini.new">nul

REM show altered file after processing
echo After... & echo. & type "%temp%\file.ini" & echo.

Code: [Select]Before...

Purchase Order # : 123456
Filing code : ZQ
Item Name : Reverse Action Flange Clamp
Item Price : $45.50
DOB=01 01 2000
Customer name : Joe Smith
Customer address 1 : 123 Main St
Customer address 2 : Hackensack NJ
Customer address 3 : 123456789
Customer phone : (200) 123-45678

After...

Purchase Order # : 123456
Filing code : ZQ
Item Name : Reverse Action Flange Clamp
Item Price : $45.50
DOB=06 06 2007
Customer name : Joe Smith
Customer address 1 : 123 Main St
Customer address 2 : Hackensack NJ
Customer address 3 : 123456789
Customer phone : (200) 123-45678




here's a vbscript. not the BEST, but does what you want.
Code: [Select]Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile ("c:\temp\test.txt", ForReading)
TheDate=Date
theYear = DatePart("yyyy", TheDate)
theMonth= DatePart("m",TheDate)
theDay = DatePart("d",TheDate)
If theMonth < 10 Then
theMonth = "0" & theMonth
End If
If theDay < 10 Then
theDay = "0" & theDay
End If
Do Until objTextFile.AtEndOfStream
strNextLine = objTextFile.ReadLine
If InStr(strNextLine,"DOB") Then
dob=split(strNextLine,"=",-1)
Wscript.Echo dob(0) & "=" & theMonth & " " & theDay & " " & theYear
Else
WScript.Echo strNextLine
End If
Loop
Hey Contrex...

Just so I get this correct, I'm basically recreating the file from scratch and when the system finds that one file, it basically puts in the correct date into that line, right?
Thanks for all your help.Not sure what you are asking here. The batch file creates a temporary copy of the original file, except that the line starting eg DOB=01 01 1999 will be altered so that the date part is today's date according to your system's date format convention (mm dd yyyy). Then the original file is deleted and the new one copied into its place.

The batch file will read a file called file.ini located in your system temp folder. You can alter this behaviour by editing the batch file as desired. Your system temp folder is held in the system variable %temp%.

Here is a short version with demo and comments deleted. You need to edit it to suit your needs.

Quote

@echo off
setlocal enableextensions
setlocal enabledelayedexpansion
set Year=%date:~-4,4%
set Day=%date:~-7,2%
set Month=%date:~-10,2%
Set today=%Month% %Day% %Year%
set newline=DOB=%today%
if exist "%temp%\file.ini.new" del "%temp%\file.ini.new"
for /F "delims=" %%L in (%temp%\file.ini) do (
set outputline=%%L
echo %%L | findstr "DOB=">nul && set outputline=%newline%
echo !outputline! >> "%temp%\file.ini.new"
)
del "%temp%\file.ini"
copy "%temp%\file.ini.new" "%temp%\file.ini">nul
del "%temp%\file.ini.new">nul


5431.

Solve : Read a .txt file and delete line feed from the end of the file?

Answer»

Hello,

I have a requirement where my tool can take only those files having no line feed at the end of file.

Now the line feed char is char(10)

So how can I read that file and then find the end of file and DELETE that last line feed char.

cheersSounds like homework to me...


Just look into findstr and/or for and you might find something.yeah I tried using Findstr and tried FINDING Char(10), but it did'nt work.

So I wanted to ask about, How we can go to end of the file and then delete last linefeed just like pressing Backspace.

I tried using For with eof() and if reached end of file then char(08) which is a backspace char.

Please help me with this, as I have to do this in 500 txt files hence I want to use batch program.Whip something up with QBasic. If you haven't got it, here it is

http://www.geocities.com/TimesSquare/Arena/5451/qbasic/downloads/qbasic.zip

Open the file for reading as binary. Open another file for WRITING as binary. Read the file in byte by byte, WRITE them out one by one to the new file, when you get to the last byte, which would be 0A hex, just say no! Don't write it. Then close both files. It's that simple.


If this is your homework, you should be working it out for yourself. if it is your work, and you cannot do this, you got the job under false pretences, and why should we earn your pay for you?


Or am I being unfair?


Quote from: contrex on June 06, 2007, 04:07:43 AM

Or am I being unfair?

Not at all. That rule EXISTS for a reason.
5432.

Solve : Help with a bat file?

Answer»

I need to move a bunch of xml files from one dir to another then select about 500 of them and copy them back to the original directory. Here is what I have so far:

REM NAVIGATE INTO THE DATA DIRECTORY
CD C:\Program Files\Numara Software\Track-It! 7.0\Track-It! Server\DATA

REM MOVE ALL THE XML FILES TO THE TEMP DIRECTORY
MOVE /y *.XML .\Temp

REM NAVIGATE TO THE TEMP DIRECTORY
cd temp

REM CREATE A TXT FILE LIST OF ALL XML FILES IN THE TEMP DIRECTORY
dir /B *.xml > FullList.txt

REM SHORTEN LIST TO 500
{~?~?~?~?~?~?~~?~?~}

REM COPY BACK FILES ACCORDING TO 500 LIST
{~?~?~?~?~?~?~~?~?~}

Problably need to create a loop to go through the list and copy files with a varible that increases by one upon each loop. Once the varible hits 500 the copy process ends and I have my 500 files.

Can you help???
ThanksFirst of all, batch files USE REM for comments, not the '.

Next, I think it can be done, but I'd have to know: On what basis should the list be shortened to 500? On file name? Size? LAST Modified?

The rest is surprisingly easy to do.Doesnt matter which are copied over first. Eventually all will be but, the problem is the program that uses these files can only use a max of 500 at a TIME or the app blows up. This is why I have to put the over flow into a temp until the previous 500 have been processed.Okay, I'm getting to work on this now. I can't say how long it'll take, but I doubt it'll take too long.

EDIT: Running into a little trouble. I'm trying to find a way to count how many files have been copied. Not going well. Also, having trouble getting the darn thing to copy the files if I don't know the file name.

I know this can be done, but I don't think I'll be able to do it right now.I'm pretty new to this to, but if the problem is just the number it can handle when you move them back could you do something like just moving them back up in GROUPS based on name?

was thinking something like this:

move /y a*.xml c:\...\location\...
move /y b*.xml c:\...\location\...
move /y c*.xml c:\...\location\...

might be a lot of extra lines but i think it would do what you need. I'm sure there is an easer I just don't know it yet.

Good LUCK!
Casey242Code: [Select]CD C:\Program Files\Numara Software\Track-It! 7.0\Track-It! Server\DATA should be Code: [Select]CD "C:\Program Files\Numara Software\Track-It! 7.0\Track-It! Server\DATA", right?

5433.

Solve : BIOS upgrade?

Answer»

I am trying to upgrade the BIOS on an old Emachines 633 before loading WINXP and I get an error that says the flash routine can't proceed with a memory manager present. I've booted the system with the WinME startup disk to a command prompt only. I've looked at the AUTOEXEC.BAT file and CONFIG.SYS and don't see where it is loading HIMEM.SYS but it must be. Any thoughts on how to stop it loading a hi memory manager ??Do you have a link to the info on the BIOS flash ? ?

Many doorstops have been created this way.

If it was a Win ME machine originally XP could be a slow painful experiment.Why do you need the BIOS upgrade before you
install XP ?Hint: Look up the original specs of the machine...i don't think there is a flash powerful enough in the World for this which is why i requested a link...And how about some info on the computer processor, memory, etc. ? I believe that model originally shipped with a Celeron 633 with 64 meg RAM.bios flashes need "clean" boot disks with no memory managers; you can get drdflash.exe which will MAKE a clean boot floppy here

http://www.bootdisk.com/

Quote


To install Windows XP 'Home' or 'Professional' onto your new PC, it will need to meet the following specification:

PC with 300 megahertz (MHz) or higher processor clock speed recommended; 233-MHz minimum required;
(Intel Pentium/Celeron family, AMD K6/Athlon/Duron family, or compatible processor recommended)
128 megabytes (MB) of RAM or higher recommended
(64 MB minimum supported; may limit performance and some features)
1.5 Gigabyte (GB) of available hard disk space
Super VGA (800 × 600) or higher resolution video adapter and monitor
CD-ROM or DVD drive
Keyboard and Microsoft Mouse or compatible pointing device

Systems with this specification (or better) should be capable of running Windows XP successfully.


Quote
eMachines eTower 633irx
REVIEW DATE: 12.19.00
# Celeron/633, 64MB SDRAM, 4MB Intel 810 graphics, 19.5GB hard drive, CD-ROM, CD-RW, $900


Thanks to all who replied. Your help is greatly appreciated. I only wanted to upgrade the BIOS to the latest stuff even though the only thing I've done to this machine is increase the original 32 Meg RAM to 256MB. Loaded WinXP Pro. last night with no problems. Yeah, it's a little slow with a 633 MHz Celron processor but I only use this machine in the summer at my camper in PA for surfing the net, reading E-mail and playing online chess. I also run Knoppix Linux from a bootable CD on this machine to play around with. Eventually I'll go fulltime to Linux once I've learned mmore about it.Quote from: oldrunner55 on June 05, 2007, 01:12:39 PM
Yeah, it's a little slow with a 633 MHz Celron processor

I first used XP with a 750 MHz AMD Duron and it RAN just fine it seemed to me. I went from 256 to 512 MB of RAM but it was certainly useable with 256. People today are so spoiled with all that power...

Edit the CONFIG.SYS on your boot disk. You really PROBABLY don't need anything in your config.sys for flashing your BIOS, but at least take out any lines referencing "himem" or "emm386". Quote from: GuruGary on June 05, 2007, 03:00:27 PM
Edit the CONFIG.SYS on your boot disk.

He already told us it's a CD-ROM
5434.

Solve : Loging the Constance of a bat file?

Answer»

i NEED some CODE that can log a BATCH files text You need some English LESSONS! Please explain clearly what you WANT to do. The word "please" is useful as well.

5435.

Solve : Kill the previous step - Batch File?

Answer»

I have a small batch file that is designed to let the user know that the email client is going to close and then starts the program that gracefully kills the email client.

The problem with this program, Close Goldmine.exe is that if the user doesn't have GoldMine open on their desktop, Close Goldmine.exe doesn't terminate. If it doesn't terminate than the remainder of the batch file doesn't carry out.

Is there a way to either kill the Close Goldmine.exe step in the batch file or program it to run for only a certain number of seconds?

I've tried using taskkill and pskill in the batch file but they don't execute because Close Goldmine.exe is still running.
For this same reason I can't call another batch file to kill this step.

Any ideas?When you say
Quote from: powlaz on May 31, 2007, 12:30:38 PM

The problem with this program, Close Goldmine.exe is that if the user doesn't have GoldMine open on their desktop, Close Goldmine.exe doesn't terminate.
Does that mean that the GoldMine program isn't running at all on their computer, or it just isn't one of the open Windows on their Desktop?

Assuming the former, run a test for it, and if it is not running, then you can skip that section of the batch file. Something LIKE:
Code: [Select]tasklist /fi "imagename eq goldmine.exe" | findstr /i goldmine
if errorlevel 1 goto :Next
echo Your email client is going to close
closegoldmine.exe
:Next
rem the rest of your scriptGary, thanks for keeping pace with me here. I know I've got a lot of threads going.

What I meant by Quote
The problem with this program, Close Goldmine.exe is that if the user doesn't have GoldMine open on their desktop, Close Goldmine.exe doesn't terminate.
is . . .

Before everyone logs out to go home for the night they are supposed to shut down the programs they are using. On of them is GoldMine.
A lot of them don't. This screws up the backup process.
Someone created the Close GoldMine program to quickly and gracefully sever any open connections to the dBase database AND close the program window. So if the user doesn't terminate their session, this little program will.

The idea is for GoldMine to not be running at all on the local machine.

Close GoldMine.exe is an awesome little program with one big fault - if the user DOES PROPERLY close (end, X-out-of, terminate) all of their open programs (like GoldMine) when Close GoldMine.exe goes to run it finds that GoldMine is not there and it . . . hangs out. It does nothing. It stays open.

So on a computer that was properly logged off once the batch file reaches the part where Close GoldMine.exe is called - it hangs. I guess what I NEED is an "IF" statement. Can you help me with that?

If GoldMine (gmw6.exe) is open
then run Close GoldMine.exe
If GoldMine (gmw6.exe) is not open
then don't run Close GoldMine.exe, just go to the next line in the batch file.

Can you translate that into DOS for me?

Thanks,

Matt

Quote from: powlaz on June 04, 2007, 11:07:24 AM
So on a computer that was properly logged off once the batch file reaches the part where Close GoldMine.exe is called - it hangs. I guess what I need is an "IF" statement. Can you help me with that?

If GoldMine (gmw6.exe) is open
then run Close GoldMine.exe
If GoldMine (gmw6.exe) is not open
then don't run Close GoldMine.exe, just go to the next line in the batch file.

Can you translate that into DOS for me?


This one line should do it. Is "Close GoldMine.exe" the name of the program? If it has a space in the name you'll need the quotes I think, and maybe the full path to the executable would be advisable, unless it's in the same folder as the batch file.

tasklist | findstr "gmw6.exe" && run "Close GoldMine.exe"

If gmw6.exe is in the list of running tasks generated by Tasklist, then, the line will execute whatever is to the right of the &&. If it doesn't find it, it'll do nothing. Findstr is case sensitive, so check in Task MANAGER that it it spelled correctly.






Contrex - this looks perfect. I tried it last night and it did exactly what I wanted. Now I don't need to fret about scheduling Close Goldmine.exe.

. . . of course I will need to WORRY about scheduling the batch file. Thanks for getting me over the hump!!

Matt
5436.

Solve : MS DOS in Win XP?

Answer»

Hello, all. Obviously this is my first post but I have used the faq's quite a bit before today.

First of all, this work is being done on a rather old system. However, it has been updated to Winxp sp2. I have a question about running dos in this operating system. I have created a batch file witch I would like to get autoexec to run when computer starts up. So I have two questions. First one, I cannot use the edit command in the command prompt. I go to start menu, run, and type cmd to get command prompt. I type edit autoexec.bat to edit the file. I get the ERROR saying 'edit is not recognized as an internal or external command, operable program or batch file.' Why am I getting this? I have tried changing directories and a few other dos commands and they work. I figure this is a winxp only error. My second question is about the batch file I have created to put in autoexec. I want it to delete some files but I can only get it to work if I place the batch file in the same directory as the files I want to delete. For some reason when I give the command, del C:\xxx\xxx\xxx, I get the error saying the file could not be found. Why? I gave it the correct directory. The files exist and they are not HIDDEN files. What does it take to get this to work on winxp?For you second question, try
Code: [Select]del "C:\xxx\xxx\xxx"instead, that is, puting quotes around the path

Hope that helps
Welcome to the CH forums.

Edit exists in the C:\Windows\System32 folder so the Path Environment Variable must contain this, if it does not then the correct folder\sub-folders will not be searched. Check your path Environment Variable by entering Path at the command prompt.

Hard to diagnose your problem with Del without seeing your command line. Do any of the entries contain blanks? If they do then enclose the command line in double quotes.

Good luck & please post back with your results/comments.





Helper, thanks for the tip on the quotations. That did the trick.

Dusty, thanks for the tip for the path environment variable. Once I added sys32 to the LIST, edit now works.

ALSO, to the both of you thanks for the fast replies!

So now everything works like I want it to when run autoexec.bat. The only problem is, autoexec.bat is not running at startup. I don't understand why. Its location is C:\autoexec.bat. Anyone know why? I have tried running it hidden and not hidden-doesn't matter. I even moved it to the windows folder, still no luck.Windows XP does not really use an autoexec.bat. What you can do is create your batch file, and then put a shortcut to that batch file (or even the batch file itself) in the "Startup Group" which is typically located in "C:\Documents and Settings\All Users\Start Menu\Programs\Startup".ubuntu, GuruGary is right, windows uses "autoexec.nt", also >>this<< says to use, in windows 95, or higher, "sysedit".Thanks GuruGary. I moved my autoexec.bat to that startup location and now everything works like I want it to.

Helper, I had read that same page you pointed out before. I did try the sysedit and it would not work either. It works now that I added the system32 folder to the path. Since I moved my autoexec to the startup folder as Gary mentioned, sysedit fails to load the autoexec file. But that is because I moved it. Sysedit looks for C:\autoexec.bat. I moved it back to that location just to check it out and it does work.

Thanks for the help. Great Forum and excellent faq pages!

5437.

Solve : how to proceed with app without killing the process???

Answer»

ive got a problem. i wrote a script that allows to execute many programs from one APP, but it stops when it executes first app. how can i skip to the next line without shutting this first program down?

P.S. sorry for my terrible english!USE the START command like this in a batch to return after launching program:-

start, then two quotes, then the program full path and NAME (in quotes if there are SPACES)

Code: [Select]start "" "C:\Windows\Notepad.exe"
start "" "C:\Program Files\Internet Explorer\IEXPLORE.EXE"

5438.

Solve : Batch file opens more dos prompts?

Answer»

I am RUNNING a BATCH file which executes an install in silent mode. However it opens up a SECONDARY dos prompt window which i need to close by hand in order to keep going.

Since i am doing this for an unattended install this isn't good, is there anyway to run a file where it ISNT allowed to open extra prompt windows.if we saw the code we might be able to help you.
Nevermind figured it out, for one reason or another start WAIT was messing things up.

thanks anyways

5439.

Solve : Can I trigger MS Access to open from a batch file??

Answer»

If so...how? I am USING windows XP and I want to open MS Access from my BATCH file. Can't figure out how....THANKS.Nevermind...I figured it out....thanks!

5440.

Solve : question on xcopy to perform incremental backup?

Answer» HI,

I was wondering if i could get some help here. I have data folder which contains all the emails messages my mail-server has received on a daily basis. What i'd like to do is to be able to back them up with xcopy i created in a batch file. However, i don't know how to back them up in an incremental fashion meaning that i want only what's been changed or NEW messages be backed up. I don't want to back up what's already been backed up as it would waste too much space in memory.

So, this is what i've come up with in a batch file

xcopy C:\Program Files\qmail\data C:\backup_emails /M/E/H

Just wanna check whether the above xcopy command will perform incremental backup for my email messages.

Thank you in advancelook here

http://www.icpug.org.uk/national/features/041107fe.htm
Thank you Contrex for your reply.

I tried it out but got stuck on SUBST x: c:\BLAH blah. What happens if my computer doesn't have virtual drive? Is it something i can create?

Thank you in advanceQuote
xcopy C:\Program Files\qmail\data C:\backup_emails /M/E/H

Just wanna check whether the above xcopy command will perform incremental backup for my email messages.

I wouldn't worry about all that

c:\>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.

[snip]

/M Copies only files with the archive attribute set,
turns off the archive attribute.

[snip]

/E Copies directories and subdirectories, including empty ones.
Same as /S /E. May be used to modify /T.

[snip]

/H Copies hidden and system files also.

[snip]

The first time you run your batch, The /M switch ensures that Xcopy will copy everything that has the archive bit "set", (a bit which is "set" has a value of binary 1). After it has copied each file, it will "unset" (ie change to binary 0) the archive bit for that file.

The next and subsequent times that the batch is run, the /M switch ensures that Xcopy only copies those files which have arrived since the last run, again, marking them as copied.

Thus the incremental backup is achieved.

The /E switch makes Xcopy dig down into subfolders, and the /H switch makes it copy hidden and system files (if it finds any)

So, YES, that looks as if it will do what you want.

5441.

Solve : how do you make a file that opens a file from any area in the computer.?

Answer»

You need to

1. Think about exactly what you want to do.
2. Break it down into small SIMPLE tasks.
3. Write it down. Use pen and paper.
4. Think about how you are going to do it.
5. If you don't understand something, write little test batch files TILL you get it right.
6. READ lots of stuff about batch code.
7. Learn to use Google.
8. Lurk here

http://groups.google.co.uk/group/alt.msdos.batch.nt/topics?hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off

9. Realise that just blindly copying bits of code that you don't understand is not the right way to learn batch programming.


5442.

Solve : Need help !!!?

Answer»

echo
(
echo for /f "tokens=*" %%z in (c:\log) do (
echo copy "%%z" c:\a.bat
)> log.txt

i want the batch when it execute it will copy to a log.txt that contain the above but it seem cannot is there anyway i can do ITI've got 2 ideas for you.
1) Redirect the output of your entire batch file to your log.txt. For example, if your batch file is called COPYLOG.BAT, then execute it like:
Code: [Select]copylog.bat >log.txt
2) Use redirection inside your script. I THINK you have too many echo statements and one too many open parenthesis in your code so I'm not sure EXACTLY what you want to do, but I think you want something like:
Code: [Select]for /f "tokens=*" %%z in (c:\log) do copy "%%z" c:\a.bat >log.txt
Also note that copying multiple files to C:\a.bat will result in just the last file being copied to a.bat as all previous copies will be overwritten.

If it is the ACTUAL code you want in your log file then you could do something like:
Code: [Select]echo for /f "tokens=*" %%%%z in (c:\log) do echo copy "%%%%z" c:\a.bat >log.txt
Or if you want the code and you really want it on multiple lines, you can do:
Code: [Select]echo for /f "tokens=*" %%%%z in (c:\log) do ( >log.txt
echo copy "%%%%z" c:\a.bat) >>log.txtsry late reply yesterday got storm

i tested it and it works

but what if i want to copy out only part of the portion from the batch for example at least 5 sentences when it was execute the

1st idea didnt work but using 2nd it work but have to type too many thing is there a SHORTES way

anyway thx GuruGayyOnly a portion of the lines from your C:\log? Yes. If you want to skip the first 20 lines, you can add the "skip=20" in your for loop, like:
Code: [Select]for /f "skip=20 tokens=*" %%%%z in (c:\log) do ...Is that what you were asking?

If you don't know how many lines there are, but still just want the last 5, then you can loop through the file to count the lines and calculate your SKIP=, then have a 2nd loop using your calculated value for SKIP.
k i got it now thx and it works

5443.

Solve : Help, I have a Thinkpad brick/paper-weight!?

Answer»

I have a 1999 IBM Thinkpad that originally had Windows 98 on it. I reloaded it with Windows 2000 but did not like it due to how slow it make it run. I'm attempting to go back to Win98 by using my IBM Recovery CD that came with the computer. I know it works, because I used it once before with no problem before I loaded Win2000.

Problem: When I boot the laptop with the Recovery disk in the CD ROM drive, it will not grab it and start the "recovery" process. Instead, Win2000 would continue to load as NORMAL. I've done the following below trying to fix this and get the CD to start "recovery."

1. I checked the CD drive, it is working and would run in Windows2000 and also in MS-DOS when selecting files or doing "DIR" commands.

2. I checked the boot sequence in my BIOS and it is set to CD first, floppy second, and hard drive last. I don't have the ability to disable the hard drive, or any item for that matter. I can only change the sequence or order they are accessed.

3. I removed Win2000 by reformatting the drive and partitioning it. So now it is a blank FAT32 drive with no OS on it.

4. I boot the laptop using a Win98 start-up floppy disk and can view the files on the Recovery CD using DIR commands, but when I attempt to run any of them they don't start the process EITHER. The ".exe" commands are the only ones that do anything when I type their name at the E: prompt (CD drive letter), but none of them thus far have started the "recovery" process successfully.

I don't know DOS well enough to know if I'm not typing a specific command sequence to get it to start "recovering", but I can't figure out why the Recovery CD will not begin as usual in the first place. It's not the CD, because I have a backup which won't work either.

I also have a Knoppix and Helix boot CD, and they will not start either, they begin to spin-up, but would allow Win2000 to load as usual, or do nothing after I reformatted the drive.

What can I do? Is there a sequence of DOS commands I can type to have it run every EXE file on the CD until something HAPPENS? It appears my Recovery CD and my boot CDs are not starting for some reason, but the CD drive seems perfectly normal/in good working order.

Help, I have a Thinkpad brick/paper-weight! Thanks!I may be wrong here, but I have a feeling that a Win98 "recovery" disk, as opposed to a "full install" disk, is designed to recover a damaged existing installation. If that is zapped, it won't work any more, and you may need to get a full install CD. Furthermore, it may depend on a hidden "recovery partition" that may not be there any more!

Quote

A recovery or recover CD is one designed to restore your PC to default "factory condition". There is usually a (mirror) "image" stored on a partition on the hard disk. When you insert the recover CD it reads that image and resets your PC, Windows, drivers and everything else to how it was on the day it shipped to you. It is a low cost option to providing you with a proper Windows CD.

Quote
Recovery CDs are the bane of the industry. Fight them. MOST computer manufacturers [in the UK] provide you with only a recovery CD when you buy a PC. Don't settle for that. Always insist on a full Windows CD with all the necessary drivers; you've paid for it!

Top 10 Reasons to not have a Recovery CD

http://www.bestpricecomputers.ltd.uk/profile/recovery_CD.htm



Double post, the other thread has been locked.
Not sure if this is the best board for the problem, but let's wait a while to see where the problem is.Quote from: SandW on June 02, 2007, 11:53:21 PM
...

I don't know DOS well enough to know if I'm not typing a specific command sequence to get it to start "recovering", but I can't figure out why the Recovery CD will not begin as usual in the first place. It's not the CD, because I have a backup which won't work either.

If it were me, I'd be looking - on the CD - for a file named setup.exe , and trying to execute that.

Contrex is probably right.
But just for the heck of it, boot with your floppy again.
Did you say that your CD drive becomes E: drive? If so, do
dir /a/o/p e:\*.exe
How many files are displayed? Too many to list here? If not, please name them for us.

If it was too many to list here, then do
dir /a/o/p e:\set*.exe
What did you find? Name them (it) for us.


Quote
I also have a Knoppix and Helix boot CD, and they will not start either, they begin to spin-up, but would allow Win2000 to load as usual, or do nothing after I reformatted the drive.

Did these ever work?
Could you ever boot this machine with them?
How about other computers... could you ever boot another computer with them?

Can you double check them again - got another computer or a friend that will let you try to boot with these? Just to be sure that they really will/still boot.

Quote
What can I do? Is there a sequence of DOS commands I can type to have it run every EXE file on the CD until something happens?

With the above metioned dir e:\*.exe , you will at least get a list of all the .exe files in the root dir of the CD. Tell us the filenames before you try running them.

Quote
It appears my Recovery CD and my boot CDs are not starting for some reason, but the CD drive seems perfectly normal/in good working order.

Help, I have a Thinkpad brick/paper-weight! Thanks!

If it were me, I'd want to try all those CDs in another computer, and prove that they either will or will not boot, first.


Hi. Yes, all the CDs actually work, and work in my other computer. Below is what I did and results thus far, some progress, but still not good-to-go.

1. Went to IBM site and downloaded newest BIOS version and loaded to laptop. Returned all settings to factory settings as website suggested. Apparently when I loaded Win2000, it corrupted my BIOS to some degree but it wasn't evident until trying to revert back to Win98. Strange and scary at the same time isn't it?

2. Also dowloaded the PC Doctor UTILITY and completed complete diagnostic on system, all checked OK.

3. Loaded the Knoppix CD and wiped the drive and repartioned and formatted to FAT32. All sectors TESTED good.

4. Put "Recovery" CD in and reboot, it initialized successfully and seemed to complete the "recovery" process, right down to the last success sign of saying, "your computer has been successfully recovered, please reboot after removing the Recovery CD."

5. Reboot machine w/ all CDs removed and now I get an "I/O error" that prevents Win98 from completing to load.

I read on the IBM site that for older laptops that have "recovery" issues with the CD (which I thought I overcame with step 4) that the hard drive may have to be reformatted in FAT16 prior to running the Recovery CD. The note is vague though and seems to apply to hosts that won't start the Recovery process at all, not ones with my "I/O error" after going thru the whole process.

The default Recovery settings splits the hard drive into two halves, and loads the OS onto one partion, and leaves the other logical partition for personal files/storage. I tried it twice thus far, allowing it to do that, and making it use the single FAT32 partition I create as well (it gives the option). Both give me the same result with the "I/O error" upon reboot after recovery.

I'm game for trying to format my hard drive to FAT16 to see if this is the final fix for the Recovery process, but don't know how to do this. Does anyone know if FAT16 reformatting is available from the 3.5" floppy Win98 boot disk?

Any other suggestions I'll do as well, just name them.

thanks, AndrewQuote from: SandW on June 03, 2007, 01:13:21 PM
I'm game for trying to format my hard drive to FAT16 to see if this is the final fix for the Recovery process, but don't know how to do this. Does anyone know if FAT16 reformatting is available from the 3.5" floppy Win98 boot disk?
Yes, you should be able to do this.

Boot to your Win98 Boot Disk, and run the FDISK command. The first screen that comes up should say something like "Do you want to enable large disk support". If you choose 'N' at this screen, it runs fdisk in FAT16 mode, while choosing 'Y' runs fdisk in FAT32 mode. So choose 'N', then delete all existing partitions. The new partitions that you create should be FAT16. Also be sure that you set your boot partition to "Active".
5444.

Solve : Hide Command Prompt?

Answer»

I am working on a batch file that echos a message to the user (amongst other things). Is there a way to make the command prompt window disappear or minimze and then REAPPEAR later in the script?

I want it to tell the user " This program is running"
Window hides
Program runs
Window pops back up with new message "The program is done"

I think I can handle everything except the part where the window disappears and reappears. Or minimizes and maximizes.
Any suggestions on how to do this?

Also, is there a way for the command prompt window to open up without the Close, Minimze/Maximize buttons? Quote

Is there a way to make the command prompt window disappear or minimze and then reappear later in the script?

You could use CMDOW for this

Cmdow is a Win32 commandline UTILITY for NT4/2000/XP/2003 that allows windows to be listed, moved, resized, renamed, hidden/unhidden, disabled/enabled, MINIMIZED, maximized, restored, activated/inactivated, closed, killed and more.

http://www.commandline.co.uk/cmdow/

unzip & place cmdow.exe on your PATH.

Make a batch file minimize its own window:
Assumes the title is unique

Code: [Select]TITLE MinimizeMePlease
FOR /F %%A IN ('CMDOW ˆ¦ FIND "MinimizeMePlease"') DO CMDOW %%A /MIN

make it come back as it was before (restore)

Assumes the title is still the same

Code: [Select]FOR /F %%A IN ('CMDOW ˆ¦ FIND "MinimizeMePlease"') DO CMDOW %%A /RES

Quote
Also, is there a way for the command prompt window to open up without the Close, Minimze/Maximize buttons?

There is a program called Wintopmost that disables the close button, but it COSTS $642 for a site license, I'm checking out if there are any free alternatives



I did come across this but I'm not sure why I didn't take it. Any way to do it from within the command prompt?

I'll have to try CMDOW. Thanks.Quote from: powlaz on May 31, 2007, 01:30:54 PM
Any way to do it from within the command prompt?

Code: [Select]TITLE MinimizeMePlease
cmdow "MinimizeMePlease" /minIf you mean, without any external or additional programs, it is rather DIFFICULT, hence the profusion of little programs to do the job, such as another free one, Window.exe, available from

http://www.steve.org.uk/Software/windowhide/
5445.

Solve : batch file for finding the file path?

Answer»

hey contrex thaks for ur contribution.
can u just tell me hw to store the file path into a variable after displaying.looking into ur code i dont know where the path is getting stored before displaying.

plz help meIt is not getting stored anywhere. What you see is the output of DIR.

I explain the relevant batch file code

Code: [Select]REM ask user for filespec to use with dir /b /s
set /p FILE="What is the file NAME (include extension)?"

REM For each letter of the alphabet
for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

REM if a volume of that letter exists, perform DIR (file spec) /b /s on that volume
REM drive letter is obtained by expanding loop variable %%D

if exist "%%D:\" DIR %%D:\"%FILE%" /b /s
)


If you want the filename paths to appear in a variable you could redirect the output to a file
and read the file

Code: [Select]@ECHO off

REM you need this to use variables in a loop
setlocal enabledelayedexpansion

REM clear temp file first
if exist %temp%\filesearch.txt del %temp%\filesearch.txt

REM ask user for filespec to use with dir /b /s
REM possible inputs
REM readme.txt
REM *.doc
REM file name with spaces.txt
set /p FILE="What is the file name (include extension)? "

echo.
echo searching...
echo.

REM For each letter of the alphabet
for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

REM if a volume of that letter exists, perform DIR (file spec) /b /s on that volume
REM drive letter is obtained by expanding loop variable %%D

if exist "%%D:\" (

REM inform user of drive being SEARCHED
echo searching drive %%D:\

REM perform DIR and redirect output to file
DIR %%D:\"%FILE%" /b /s >> %temp%\filesearch.txt
echo.
)

)

echo.
echo search finished.
echo search results:
echo.

REM (1) count number of matching files found
REM use set /a to set counter to 0
REM shows how to count in batch
set /a count=0

REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (
set /a count+=1
)

REM (2) show results to user
REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (

REM make variable equal to found file path
set filepath=%%L

REM show line to user
REM must use ! and not %
REM because of delayed expansion
REM in loop
echo !filepath!

)
echo.

IF %count% EQU 1 echo %count% result found
IF %count% GTR 1 echo %count% results found

echo this is the last match that was found
echo.
echo %filepath%
echo.

Here, the found file and path is in the variable called "filepath"

If more than one match is found, only the last one will be stored at the end of the batch run.








Quote from: contrex on May 30, 2007, 11:52:12 AM

It is not getting stored anywhere. What you see is the output of DIR.

I explain the relevant batch file code

Code: [Select]REM ask user for filespec to use with dir /b /s
set /p FILE="What is the file name (include extension)?"

REM For each letter of the alphabet
for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

REM if a volume of that letter exists, perform DIR (file spec) /b /s on that volume
REM drive letter is obtained by expanding loop variable %%D

if exist "%%D:\" DIR %%D:\"%FILE%" /b /s
)


If you want the filename paths to appear in a variable you could redirect the output to a file
and read the file

Code: [Select]@echo off

REM you need this to use variables in a loop
setlocal enabledelayedexpansion

REM clear temp file first
if exist %temp%\filesearch.txt del %temp%\filesearch.txt

REM ask user for filespec to use with dir /b /s
REM possible inputs
REM readme.txt
REM *.doc
REM file name with spaces.txt
set /p FILE="What is the file name (include extension)? "

echo.
echo searching...
echo.

REM For each letter of the alphabet
for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

REM if a volume of that letter exists, perform DIR (file spec) /b /s on that volume
REM drive letter is obtained by expanding loop variable %%D

if exist "%%D:\" (

REM inform user of drive being searched
echo searching drive %%D:\

REM perform DIR and redirect output to file
DIR %%D:\"%FILE%" /b /s >> %temp%\filesearch.txt
echo.
)

)

echo.
echo search finished.
echo search results:
echo.

REM (1) count number of matching files found
REM use set /a to set counter to 0
REM shows how to count in batch
set /a count=0

REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (
set /a count+=1
)

REM (2) show results to user
REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (

REM make variable equal to found file path
set filepath=%%L

REM show line to user
REM must use ! and not %
REM because of delayed expansion
REM in loop
echo !filepath!

)
echo.

IF %count% EQU 1 echo %count% result found
IF %count% GTR 1 echo %count% results found

echo this is the last match that was found
echo.
echo %filepath%
echo.

Here, the found file and path is in the variable called "filepath"

If more than one match is found, only the last one will be stored at the end of the batch run.









Hi Contrex,
That was a great help from you .Thankyou so much. One more doubt.how can i get the file extension after storing the filepath into the variable.i want to just display the file extension after displaying the file path.do i have any option like give only the file name without extension and search for it.if its found then dispaly the path and extension of the file seperately?any help will be HIGHLY appreciated.
thanx in advance

PrajithQuote
do i have any option like give only the file name without extension

Use wildcards, as with DOS command line. EG to find files called "example" of whatever extension, supply

example.*

Quote
and search for it.if its found then dispaly the path and extension of the file seperately?

see modified code below

Code: [Select]@echo off

setlocal enabledelayedexpansion

REM clear temp file first
if exist %temp%\filesearch.txt del %temp%\filesearch.txt

REM ask user for filespec to use with dir /b /s
set /p FILE="What is the file name (include extension)? "

echo.
echo searching...
echo.

REM For each letter of the alphabet
for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

REM if a volume of that letter exists, perform DIR (file spec) /b /s on that volume
REM drive letter is obtained by expanding loop variable %%D

if exist "%%D:\" (

REM inform user of drive being searched
echo searching drive %%D:\ for %FILE%

REM perform DIR and redirect output to file
DIR /a-d %%D:\"%FILE%" /b /s >> %temp%\filesearch.txt
echo.
)

)

echo.
echo search finished.
echo search results:
echo.

REM (1) count number of matching files found
REM use set /a to set counter to 0
REM shows how to count in batch
set /a count=0

REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (
set /a count+=1
)

REM (2) show results to user
REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (

REM make variable equal to found file path
set filepath=%%L

REM show line to user
REM must use ! and not %
REM because of delayed expansion
REM in loop
echo file path: !filepath!
echo.

REM you will need to edit, this is just to
REM show you how to use the file info

echo here are the different elements of
echo information about the file
echo.
echo drive: %%~dL path: %%~pL filename: %%~nL extension: %%~xL
echo.
echo drive: %%~dL
echo path: %%~pL
echo filename: %%~nL
echo extension: %%~xL
echo drive, path and name: %%~dpnL
echo.

)
echo.

IF %count% EQU 1 echo %count% result found
IF %count% GTR 1 echo %count% results found

echo this is the last match that was found
echo.
echo %filepath%
echo.

Quote from: contrex on June 01, 2007, 01:30:17 AM
Quote
do i have any option like give only the file name without extension

Use wildcards, as with DOS command line. EG to find files called "example" of whatever extension, supply

example.*

Quote
and search for it.if its found then dispaly the path and extension of the file seperately?

see modified code below

Code: [Select]@echo off

setlocal enabledelayedexpansion

REM clear temp file first
if exist %temp%\filesearch.txt del %temp%\filesearch.txt

REM ask user for filespec to use with dir /b /s
set /p FILE="What is the file name (include extension)? "

echo.
echo searching...
echo.

REM For each letter of the alphabet
for %%D in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (

REM if a volume of that letter exists, perform DIR (file spec) /b /s on that volume
REM drive letter is obtained by expanding loop variable %%D

if exist "%%D:\" (

REM inform user of drive being searched
echo searching drive %%D:\ for %FILE%

REM perform DIR and redirect output to file
DIR /a-d %%D:\"%FILE%" /b /s >> %temp%\filesearch.txt
echo.
)

)

echo.
echo search finished.
echo search results:
echo.

REM (1) count number of matching files found
REM use set /a to set counter to 0
REM shows how to count in batch
set /a count=0

REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (
set /a count+=1
)

REM (2) show results to user
REM for each line in output file
for /f "delims==" %%L in (%temp%\filesearch.txt) do (

REM make variable equal to found file path
set filepath=%%L

REM show line to user
REM must use ! and not %
REM because of delayed expansion
REM in loop
echo file path: !filepath!
echo.

REM you will need to edit, this is just to
REM show you how to use the file info

echo here are the different elements of
echo information about the file
echo.
echo drive: %%~dL path: %%~pL filename: %%~nL extension: %%~xL
echo.
echo drive: %%~dL
echo path: %%~pL
echo filename: %%~nL
echo extension: %%~xL
echo drive, path and name: %%~dpnL
echo.

)
echo.

IF %count% EQU 1 echo %count% result found
IF %count% GTR 1 echo %count% results found

echo this is the last match that was found
echo.
echo %filepath%
echo.


Hi Contrex,

Thanks for your tremendous help.i bothered you because it was a very critical situation .
anyways thanx once again for your help.

Prajith
5446.

Solve : Stuck with a simple batch file?

Answer»

Hi,

I have a batch file:


call a.bat
... some stuff...
command 1
command 2


a.bat looks like:
... set env. vairables...
call b.bat
...set env. vairables...

The problem i am facing is, when i run my batch file, a.bat runs and that's all.
I have to press enter, then command 1 & 2 start to execute.

Further command 1 & 2 start parallely.
2 doesn't wait for 1 to complete.

ThanksA small update:

When i press

it types
ERROR!

and then proceeds ahead.Code: [Select]call a.bat
... some stuff...
command 1
command 2

a.bat looks like:
... set env. vairables...
call b.bat
...set env. vairables...

PLEASE post the entire contents of the calling file and both the a & b bat FILES. If you are truly getting a message "ERROR!", we'd never know it from what's posted. Should be interesting what "...some stuff..." refers to.

Ooops,

My apologies.

I was just digging from where the !ERROR was coming.

Somewhere in recursive calling of batch files, there was a cmd commnad.

That's why my commands were getting executed after TYPING exit.

Thanks Sideee BTW,

Can this somehow happen that 2 commands get called in parallel. Quote

Can this somehow happen that 2 commands get called in parallel

I'm not sure how unless the two commands are started, in which case they would run in separate processes (windows).

A call statement CREATES a return mechanism which allows some secondary external code UPON completion to follow an address pointer back to the next sequential instruction after the call

Running external code from a process without a call mechanism would simply transfer control to the external code with no pointer back to the original process.



if we had fewer emoticons and more information, we might get somewhere.
The emotions tell the story that information is over
5447.

Solve : how to get file extension from a file name?

Answer»

hi all,

how to get a file extension from a file name.requirement is like if i give a file name it should search the file and returns the file extension.how to code it?plz help me as i am new to scripting.

ThanxWelcome to CH.

What programming language would you like this to be and what OS are you USING?Code: [Select]For /F %%a In ('dir /A-D /B') Do (
echo %%~xa
)Quote from: CARBON Dudeoxide on May 31, 2007, 11:50:43 PM

Welcome to CH.

What programming language would you like this to be and what OS are you using?

I want to create a BATCH file for this.My OS is win2000.is this being set for homework somewhere this week? It sure is cropping up all over the place!
5448.

Solve : My first ever batch file, need help?

Answer» HEY everyone i've got to create a batch file that will attempt to telnet through every port on another computer. Sorry if that sounds stupid but this is my school project. I know i need a for statement that runs 65000 times i guess but i don't know how to do it. Sorry if this sounds pointless check out the FOR command, the /L PARAMETER will do incrementing loops

now go and do your homework !!!
Grahami've tried the for loop but i really don't understand where i would put like the 1-65000 part. My only programming experience is with turing and thats what im used to after i find that i think i can just ECHO "telnet (ip) (variable that is going up from 1-65000)"from the DOS help
FOR /L %variable IN (start,step,end) DO command [command-parameters]

The set is a sequence of numbers from start to end, by step amount.
So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would
generate the sequence (5 4 3 2 1)

so something like this
FOR /L %%a IN (1,1,65000) DO telnet (ip) %%a

Let me know if I passednope, when i run it i just get the LINE of code repeated over and over, and the final number is ALWAYS 1ok if i just change it to
FOR /L %%a IN (1,1,65000) DO %%a
it successfully dispays all the numbers so now i have to figure out how to get the "telnet (ip)" part in theregetting closer, i tried
FOR /L %%a IN (1,1,65000) DO TYPE telnet (ip) %%a
and that seemed to work except after each port is CHECKED i get the error
The system cannot find the file specifed.
Error occured while processing: telnet.
The system cannot find the file specifed.
Error occured while processing: (ip).
The system cannot find the file specifed.
Error occured while processing: 129.

Is this because im running the program at home which isn't connected to the network im telnetting, in other words will this work once i running on a computer that's connected to the server?Take out the word "TYPE". If you just want to test it without actually doing the telnet, then use ECHO instead of TYPE.
Code: [Select]FOR /L %%a IN (1,1,65000) DO telnet (ip) %%awhen i take out TYPE the output goes back to only having telnet (ip) 1, it stays at 1 and won't go upok awesome it worked, now once i find a port i have to actually figure out what to do once im in lol thanks for the help guys
5449.

Solve : What is %%a?

Answer»

I see it everywhere.

Also in DOS is the FOR statement always written as FOR /F?Quote from: powlaz on May 31, 2007, 02:02:06 PM

What is %%a

I see it everywhere.


It is a FOR variable. You can have 52, a to z and A to Z. You see %%a a lot probably because a is the first letter of the alphabet.

Quote
Also in DOS is the FOR statement always written as FOR /F?

No.

FOR %variable IN (set) DO command [command-parameters]

%variable Specifies a single letter replaceable parameter.
(set) Specifies a set of one or more files. Wildcards may be used.
command Specifies the command to carry out for each file.
command-parameters
Specifies parameters or switches for the specified command.

To use the FOR command in a batch program, specify %%variable instead
of %variable. Variable names are case SENSITIVE, so %i is different
from %I.

If Command Extensions are enabled, the following additional
forms of the FOR command are supported:

FOR /D %variable IN (set) DO command [command-parameters]

If set contains wildcards, then specifies to match against directory
names instead of file names.

FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]

Walks the directory tree rooted at [drive:]path, executing the FOR
statement in each directory of the tree. If no directory
specification is specified after /R then the current directory is
assumed. If set is just a single period (.) character then it
will just enumerate the directory tree.

FOR /L %variable IN (start,step,end) DO command [command-parameters]

The set is a sequence of numbers from start to end, by step amount.
So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would
generate the sequence (5 4 3 2 1)

FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ("string") DO command [command-parameters]
FOR /F ["options"] %variable IN ('command') DO command [command-parameters]

or, if usebackq option present:

FOR /F ["options"] %variable IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ('string') DO command [command-parameters]
FOR /F ["options"] %variable IN (`command`) DO command [command-parameters]

filenameset is one or more file names. Each file is opened, read
and processed before going on to the next file in filenameset.
Processing consists of reading in the file, breaking it up into
individual lines of TEXT and then parsing each line into zero or
more tokens. The BODY of the for loop is then called with the
variable value(s) set to the found token string(s). By default, /F
passes the first blank separated token from each line of each file.
Blank lines are skipped. You can override the default parsing
behavior by specifying the optional "options" parameter. This
is a quoted string which contains one or more keywords to specify
different parsing options. The keywords are:

eol=c - specifies an end of line comment character
(just one)
skip=n - specifies the number of lines to skip at the
beginning of the file.
delims=xxx - specifies a delimiter set. This replaces the
default delimiter set of space and tab.
tokens=x,y,m-n - specifies which tokens from each line are to
be passed to the for body for each iteration.
This will cause additional variable names to
be allocated. The m-n form is a range,
specifying the mth through the nth tokens. If
the last character in the tokens= string is an
asterisk, then an additional variable is
allocated and receives the remaining text on
the line after the last token parsed.
usebackq - specifies that the new semantics are in force,
where a back quoted string is executed as a
command and a single quoted string is a
literal string command and allows the use of
DOUBLE quotes to quote file names in
filenameset.

Some examples might help:

FOR /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k

would parse each line in myfile.txt, ignoring lines that begin with
a semicolon, passing the 2nd and 3rd token from each line to the for
body, with tokens delimited by commas and/or spaces. Notice the for
body statements reference %i to get the 2nd token, %j to get the
3rd token, and %k to get all remaining tokens after the 3rd. For
file names that contain spaces, you need to quote the filenames with
double quotes. In order to use double quotes in this manner, you also
need to use the usebackq option, otherwise the double quotes will be
interpreted as defining a literal string to parse.

%i is explicitly declared in the for statement and the %j and %k
are implicitly declared via the tokens= option. You can specify up
to 26 tokens via the tokens= line, provided it does not cause an
ATTEMPT to declare a variable higher than the letter 'z' or 'Z'.
Remember, FOR variables are single-letter, case sensitive, global,
and you can't have more than 52 total active at any one time.

You can also use the FOR /F parsing logic on an immediate string, by
making the filenameset between the parenthesis a quoted string,
using single quote characters. It will be treated as a single line
of input from a file and parsed.

Finally, you can use the FOR /F command to parse the output of a
command. You do this by making the filenameset between the
parenthesis a back quoted string. It will be treated as a command
line, which is passed to a child CMD.EXE and the output is captured
into memory and parsed as if it was a file. So the following
example:

FOR /F "usebackq delims==" %i IN (`set`) DO @echo %i

would enumerate the environment variable names in the current
environment.

I couldn't have said it any better myself.
5450.

Solve : NO COMMANDS WORK EXCEPT CLS?

Answer»

i have this late 1980s c.1988 IBM with MS DOS 4.0 and i haven' t turned it on in a long time (not since around 2003) and i am windering how to re-install the required software to run it. any ideas?Boot to your DOS 4 install DISKETTE, and follow the prompts.

Also, if CLS works, then so should the other internal COMMANDS like:
DIR
COPY
DEL
CD
TYPE
MD

With DIR, CD and COPY, you can get around your drive, look for files, run programs and copy files.go to sys32
and check if the files are there
but before u do that go to file options
and make it show hidden files and system files
tell me if u can see
any .exeQuote from: lordoftheplat on May 31, 2007, 03:48:00 AM

go to sys32 and check if the files are there but before u do that go to file options and make it show hidden files and system files tell me if u can see any .exe

Lordoftheplat: I don't think he is going to have system32 or any file menu under DOS 4.Quote from: GuruGary on May 31, 2007, 07:43:59 AM
Lordoftheplat: I don't think he is going to have system32 or any file menu under DOS 4.

lol
I know (I can tell) that 1988 is like 10 years before most people using this forum were born, but take it from an oldster that MS-DOS version 4 was widely regarded as the crappy version that came between version 3.30 and version 5.00. Version 6.22 is the reference version still.



Quote from: contrex on May 31, 2007, 01:55:04 PM
I know (I can tell) that 1988 is like 10 years before most people using this forum were born, but take it from an oldster that MS-DOS version 4 was widely regarded as the crappy version that came between version 3.30 and version 5.00. Version 6.22 is the reference version still.

Agreed. In fact I still have computers running the following versions of DOS:
MS-DOS 3.31
MS-DOS 5.00
MS-DOS 6.00
MS-DOS 6.22
Notice how I skipped MS-DOS 4.x ... since it was pretty worthless.