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.

5251.

Solve : Scheduled task - batch file not started?

Answer»

I written a simple .bat file saved on a USB flash drive j: that connected on a sbs2003.

It backup some data files from server to j:



REM this program was mytest28.bat it backs up the 4 data files on s-hkrgct server

REM . it is in flash drive, must use j: drive letter

REM NAME is backuptripssql-data.exe



net stop sqlagent$tma

net stop mssql$tma



del \dbyestoday\*.* /q

move \yestoday\*.* \dbyestoday\

move \today\*.* \yestoday\

cd \today

copy d:\tma\sql_data\

net start mssql$tma

net start sqlagent$tma

It WORKS after scheduled it through Control Panel – Scheduled Task. It doesn’t WORK after COMPILED it to .exe file (it is saved on j: drive too). But it works when I double click this .exe file.



There are some .exe files of scheduled backup and system reports on the LIST of Scheduled Tasks.

Can I put scheduled task .exe file on flash drive? Or some reason?


Peter

5252.

Solve : Enable messenger service?

Answer»

What MS-DOS command I write can automatically enable messenger SERVICE Then, I can use NET SEND command to send a MESSAGE to another computer??

TQ!!! sc start MyService
net send {name | * | /DOMAIN[:name] | /USERS} message

Where MyService is the messenger service.if turning on the messenger service for 6 hours, i can't use NET SEND command to send a message to another computer, but the service status of messenger service is still "STARTED". The startup type is still "AUTOMATIC".

What MS-DOS command I can reset messenger service and send a message to another computer after 6 hours???

TQIs this what you do in school when you're not trying to DELETE the admin passwords?
contrex, I suspect U do not understand question.......

Are u expert??

PLEASE dun write rubbish here.........

5253.

Solve : list of all computer in network?????

Answer»

hi is there any command to get LIST of all the computer in LAN?

if so how?
I don't know about a command, but famatech.com, the makers of Radmin, make some free utilities that will scan your network (or a specified RANGE of IP's) and tell you what ones are dead or alive, the names if applicable and other info. Pretty NEAT and free!!!!.I'm not sure what you want to do, but you could make a batch file and PING all ips 192.168.1.2-192.168.1.255, and have it list the ones in which it pinged successfully. Would take a little while though, but it's pretty much the same thing as a program like lansurveyor would do.
if you are the administrator of the network, you should have a list of the ip address range that your company is using.i am not administrator nor i know abt BACH file

can you tell me some software utility that do that

gimmie pad linkGreat software:

http://www.solarwinds.com/products/lansurveyor/
C:\windows\system32\ddeshare
click that
shares then select computer

it does give you the list of computers in your network
not sure if it works with lan

Or you can try netstat on CMD
not sure if it will work but worth a trynet view

5254.

Solve : using double quotes as delimiter in a for loop?

Answer»

Hi,

how can I use the double QUOTE (") as a DELIMITER?
if I type it in the delims list it takes it as the end of the delimiter list

Code: [Select]set STRING=partone "part two"
for /f "tokens=1,2 delims="" %i in ("%string%") do echo (%i) (%~j)I WOULD like to have for result
Code: [Select](partone) (part two)
thanks
yp

5255.

Solve : Automatically click "ENTER" twice to delete admin password?

Answer»

What MS-DOS command i can write to click (PROCESS)automatically "ENTER" twice to delete admin password in the BAT file. Therefore, computer won't ask user to manually click "ENTER" twice to delete it.

TQ!! WhyWhat MS-DOS command i can write to click (process)automatically "ENTER" twice to delete admin password in the BAT file?

Any idea??

User dun need to manually click "ENTER" twice to delete it......should be faster...

TQ!!sound like hacker trickOf COURSE, at the beginning, I already set the admin password for my computer.

LATER, I want to click manually "ENTER" twice to delete the admin password after clicking the BAT file.

BUT, I don't want to manually click "ENTER" twice to delete it.

WHAT MS-DOS command i can write to AUTOMATICALLY "ENTER" twice to delete it???

MY CODE in the notepad::


REGEDIT /s Autoadminlogonz.reg
regedit /s Forceguestz.reg
regedit /s msgz.reg


c:
netsh.exe firewall set opmode mode=enable profile=all
@echo off
color F
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!DON't FORGET!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "PLEASE CLICK "ENTER" TWICE TO DELETE ADMIN PASSWORD "
net user Administrator *


TQ
someone close this topic.y close this topic?


ANY IDEA??

TQ!!!!Well we give stuff to other people when we know it's going to be used for bad purposes...hweontey, we suspect you are a hacker. Only hackers spell things with a z like forceguestz and msgz.

Quote from: contrex on November 03, 2007, 08:40:46 AM

hweontey, we suspect you are a hacker. Only hackers spell things with a z like forceguestz and msgz.

I don't get why pplz do this. I think it's much easier and smoother to just say 'people' instead of 'ppl' and 'thanks' instead of 'thx'Here in the UK we call it "textspeak", kids in SCHOOL even turn in essays written like that, not knowing how to write in proper English.

Since no valid reason has been offered on why this needs to be done Topic Closed.
5256.

Solve : how TO Automatically click "ENTER" twice to delete admin password?

Answer»
MY CODE in the notepad::


regedit /s Autoadminlogonz.reg
regedit /s Forceguestz.reg
regedit /s msgz.reg


c:
netsh.exe firewall set opmode mode=enable profile=all
@echo off
color F
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!DON't FORGET!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "PLEASE CLICK "ENTER" TWICE TO DELETE ADMIN PASSWORD "
NET user Administrator *


At the beginning, I already set the admin password in the another BAT file for my computer.

LATER, I want to click manually "ENTER" twice to delete the admin password after clicking the BAT file.

BUT, I don't want to manually click "ENTER" twice to delete it.


WHAT MS-DOS command i can write to AUTOMATICALLY "ENTER" twice to delete it???


Double Post.
Topic Closed.
5257.

Solve : need to run CD rom drive in DOS?

Answer»

First post, and PROBABLY a very basic QUESTION for SOMEONE:
I have a VAIO with Win2000. There's some kind of error and Windows won't start. I started in "Windows" (no version specified) and it gave me a DOS prompt.
I have the Win2000 CDrom and was GOING to try to reinstall; how do I start the CDrom from the DOS prompt?
ThanksThe normal way is to go into the BIOS SETUP and make it boot from the CD-ROM drive. Can't you do this?

5258.

Solve : Wget with source code?

Answer»

i made a batch that uses WGET to copy the HTML and Copy the SOURCE into a text file. This works only if it is the INDEX though. like if I want http://lightstormlabs.com, it will get the HTML of the index and the TXT of the index, but if I want http://lightstormlabs.com/products.html, it will only give me the HTMLread the wget manual. what you want is some spidering actions. wget has options which you can specify the depths you want to go into

5259.

Solve : Automatically editing a text fiel using a batch file?

Answer»

My co-worker and I end up editing a text file every time we image a Sales PC. It is not easy and we frequently make mistakes. There are only 5 variables but 4 are used multiple times and it would be nice if we could come up with a way of using batch file (or something similar) that we could just type the 5 variables and let it insert them in the correct places. I have PLAYED around some and am not having any luck. Any help would be greatly appreciated.post an example of the text file showing the variables and where they go, editing anything confidential if you need to.
Quote from: contrex on OCTOBER 31, 2007, 12:22:27 PM

post an example of the text file showing the variables and where they go, editing anything confidential if you need to.


I have replaced the ACTUAL terms with the variable placeholders (%1, %2, etc.).

Quote
use CRMBase
delete from au_st_sys_user
delete from au_system_user
delete from au_employee where emp_code = '%1'
insert into au_employee ( emp_code, first_name, last_name, create_emp, last_mdfy_emp, row_id, rec_mdfy_ind, rec_del_ind ) values ( '%1', '%2', '%3', 'aurum', 'aurum', 2, 'N', 'N' )
insert into au_user_class ( class_code, rec_del_ind ) values ( 'AurumSales', 'N' )
insert into au_system_user ( emp_code, login, pwd, create_emp, last_mdfy_emp, row_id, rec_mdfy_ind, rec_del_ind, class_code ) values ( '%1', '%1', '8_49_76_69_71_72_72_7F_30_2C_A_17_1A_6_ 5_14', 'aurum', 'aurum', 2, 'N', 'N', 'AurumSales' )
update au_system_user set exp_date = CURRENT_TIMESTAMP
update au_system_user set exp_date = exp_date + 60
insert into au_st_sys_user ( st_id, emp_code, st_emp_code, auth_key, authority_flag, enable_esd_ind, create_emp, last_mdfy_emp, row_id, rec_mdfy_ind, rec_del_ind ) values ( %4, '%1', '%1-R', '%5', 'TT', 'Y', 'aurum', 'aurum', 2, 'N', 'N' )
delete from au_system_id
insert into au_system_id ( emp_code, system_id, auth_key, class_code ) values ( '%1', '%4', '%5', 'AurumSales')
go
here's a vbscript, if you are able to use it
Code: [Select]Set wshArgs = WScript.Arguments
var1=wshArgs(0)
var2=wshArgs(1)
var3=wshArgs(2)
var4=wshArgs(3)
var5=wshArgs(4)
Set objFSO=CreateObject("Scripting.FileSystemObject")
s="use CRMBase" & vbCrLf & _
"delete from au_st_sys_user" & vbCrLf & _
"delete from au_system_user" & vbCrLf & _
"delete from au_employee where emp_code = '" & var1 & "'" & vbCrLf & _
"insert into au_employee ( emp_code, first_name, last_name, " & _
"create_emp, last_mdfy_emp, row_id, rec_mdfy_ind, rec_del_ind ) values ( '" & var1 & _
"', '" & var2 & "', '" & var3 & "', 'aurum', 'aurum', 2, 'N', 'N' )" & vbCrLf & _
"insert into au_user_class ( class_code, rec_del_ind ) values ( 'AurumSales', 'N' )" & vbCrLf & _
"insert into au_system_user ( emp_code, login, pwd, create_emp, " & _
"last_mdfy_emp, row_id, rec_mdfy_ind, rec_del_ind, class_code ) values ( '" & _
var1 & "', '" & var1 & "', '8_49_76_69_71_72_72_7F_30_2C_A_17_1A_6_ 5_14', 'aurum', 'aurum', 2, 'N', 'N', 'AurumSales' )" & vbCrLf & _
"update au_system_user set exp_date = CURRENT_TIMESTAMP" & vbCrLf & _
"update au_system_user set exp_date = exp_date + 60" & vbCrLf & _
"insert into au_st_sys_user ( st_id, emp_code, st_emp_code, auth_key, authority_flag, " & _
"enable_esd_ind, create_emp, last_mdfy_emp, row_id, rec_mdfy_ind, rec_del_ind ) values ( " & _
var4 & ", '" & var1 & "', '" & var1 & "-R', '" & var5 & "', 'TT', 'Y', 'aurum', 'aurum', 2, 'N', 'N' )" & vbCrLf & _
"delete from au_system_id" & vbCrLf & _
"insert into au_system_id ( emp_code, system_id, auth_key, class_code ) values ( '" & _
var1 & "', '" & var4 & "', '" & var5 & "', 'AurumSales')" & vbCrLf &_
"go"

Set objOutFile = objFSO.CreateTextFile("c:\outfile.txt",True)
objOutFile.Write(s)
objOutFile.Close
Set objOutFile=Nothing

usage: on command PROMPT type : cscript /nologo myscript.vbs var1 var2 var3 var4 var5Worked like a champ -- Thanks.
5260.

Solve : autoexec.bat question?

Answer»

Hi everyone,

i GOT a autoexec.bat commad which show below:

cd\union\pm
ren hostordr.ord hostordr.321
COPY hostordr.321 hostordr.ord
del hostordr.321
uk_host
cd\

This command is suppose to create a new storage address for hostordr.ord whenever i reboot the system, so that the address is not constantly rd/wr and hence prevent the specific address from bad sector.

the question i want to ask is

1. Supposingly over numerous time of rebooting system, my whole harddisk should be fully occupied by old hostordr.ord files am i right? But when i run scandisk i only see first few CLUSTER of the HD being occupied, but not all of the HD.
So is this command actually always writing to a new storage address or is constantly using a specific memory location only?

2. I discover some bad sectors when running scandisk in DOS OS, does the bad sectors arrise because of my autoexec command?

3. Is there a better way for my command to always update hostordr.ord to a new storage address when reboot?

Quote from: ck123 on November 01, 2007, 07:02:57 PM

Hi everyone,

i got a autoexec.bat commad which show below:

cd\union\pm
ren hostordr.ord hostordr.321
copy hostordr.321 hostordr.ord
del hostordr.321
uk_host
cd\

This command is suppose to create a new storage address for hostordr.ord whenever i reboot the system, so that the address is not constantly rd/wr and hence prevent the specific address from bad sector.

the question i want to ask is

1. Supposingly over numerous time of rebooting system, my whole harddisk should be fully occupied by old hostordr.ord files am i right?

No. This sequence of lines first RENAMES a file then makes a copy with the original name then deletes the copy so you end up with the same number of files as before.

ren hostordr.ord hostordr.321
copy hostordr.321 hostordr.ord
del hostordr.321

Quote
But when i run scandisk i only see first few cluster of the HD being occupied, but not all of the HD.


See above.

Quote
So is this command actually always writing to a new storage address or is constantly using a specific memory location only?

When a file is renamed, the FAT (File Allocation Table) is updated, but the file data is not altered. Copying the file will mean a new area of the DISK is used, then when the file is deleted, the data remains but, again, the FAT is updated to show that area is available for reuse if needed later.

Quote
2. I discover some bad sectors when running scandisk in DOS OS, does the bad sectors arrise because of my autoexec command?

No.

Quote
3. Is there a better way for my command to always update hostordr.ord to a new storage address when reboot?

1. The autoexec does not do what you think it does.
2. You do not need to do this anyway. Reads & writes do not wear out the disk. Bad sectors found by Scandisk may be a sign that disk is failing though.


5261.

Solve : Can't del directory.?

Answer»

Yes there was a file named "Folder.dat"
After I removed that I was able to remove it.
But I would like to know if there was any WAY to do that with dos?
If there is a comment to empty a file.

Thanks for helping once again:

Jonas If folder.dat was a hidden file then it would not show up for an ordinary DIR or a wildcard delete. You would have to do dir /AH to SEE hidden files, and attrib -H *.* to strip off the hidden ATTRIBUTE prior to attempting to delete all files, and then finally you can delete the folder.

5262.

Solve : echo without newline?

Answer»

If you have ever wanted to do an echo in a BATCH file without forcing a new line, then you might like to try this little util that I wrote myself, called echonr.

usage echonr string

Quote

G:\>(
More? echonr "HELLO "
More? echo world
More? )
hello world

G:\>(
More? echonr "hello world "
More? echo %date%
More? )
hello world 06/11/2007

G:\>(
More? echonr hello world today is
More? echonr " "
More? echonr %date%
More? echonr " "
More? echonr "and the time is "
More? echo %time%
More? )
hello world today is 06/11/2007 and the time is 19:19:30.93


Written in FreeBasic & compiled using FreeBasic compiler 0.16 for Win32

Source code (!):

Quote
print command$;

If somebody would like to try compiling it in QuickBasic, we might find out if it works in DOS.






[getting disk space - attachment DELETED by ADMIN]
5263.

Solve : Windows Batch Help Needed?

Answer»

Hi,

I have a script that dynamically creates another bat script that then performs some xcopy commands. However it does not include the DIRECTORIES in the xcopy bat script unless they have a sub dir. I need it to include them even if they dont have sub dir as long as they are not on the 'exclude' list.

Thanks for all help as I'm STUMPED as to why this is happening.



*************Current Directories that exist:**********************

D:\Hyperion\essbase\app\BU_CRTT\Crtt01\
D:\Hyperion\essbase\app\CapExp\Capital\
D:\Hyperion\essbase\app\CORPGA\Incstmt\
D:\Hyperion\essbase\app\testplan\

Note: In my current results it does not include a line for 'testplan' as it does not have another dir under it.


******** Current Batch athat creates Current Output********************


set ess_app_dir_source=D:\Hyperion\Essbase\App
set outFile_CopyAppDir=%~dp0CopyAppDir.bat
set excludeDirsAppCopy=$DM_APP$,migrationutils,ESSHFM,z_test


@ECHO off

setlocal

echo REM Begin to copy 'App' dir to backup location > %outFile_CopyAppDir%

pushd "%ess_app_dir_source%"

for /f "tokens=*" %%a in ('dir /b /ad 2^>NUL') do call :PROCDIR "%%a"

popd

if not exist "%outFile_CopyAppDir%" echo Could not find anything to process&goto :EOF

echo PROCESSING writing to %outFile_CopyAppDir%

goto :EOF

:PROCDIR

for %%a in (%excludeDirsAppCopy%) do if /i "%%a"=="%~1" goto :EOF

pushd "%~1"

for /f "tokens=*" %%a in ('dir /b /ad 2^>NUL') do call :PROCESS "%%a" "%~1"

popd

goto :EOF

:PROCESS

for %%a in (%excludeDirsAppCopy%) do if /i "%%a"=="%~1" goto :EOF

echo xcopy "%ess_app_dir_source%\%~2" "%ess_app_dir_bkup%\%~2" /Y /S /E /i >> "%outFile_CopyAppDir%"

goto :EOF


**************Current Output*****************************:

REM Begin to copy 'App' dir to backup location
xcopy "D:\Hyperion\essbase\app\BU_CRTT" "E:\EssbaseBackup\Daily\App\BU_CRTT" /Y /S /E /i
xcopy "D:\Hyperion\essbase\app\CapExp" "E:\EssbaseBackup\Daily\App\CapExp" /Y /S /E /i
xcopy "D:\Hyperion\essbase\app\CORPGA" "E:\EssbaseBackup\Daily\App\CORPGA" /Y /S /E /i

***************Desired Output**************************

REM Begin to copy 'App' dir to backup location
xcopy "D:\Hyperion\essbase\app\BU_CRTT" "E:\EssbaseBackup\Daily\App\BU_CRTT" /Y /S /E /i
xcopy "D:\Hyperion\essbase\app\CapExp" "E:\EssbaseBackup\Daily\App\CapExp" /Y /S /E /i
xcopy "D:\Hyperion\essbase\app\CORPGA" "E:\EssbaseBackup\Daily\App\CORPGA" /Y /S /E /i
xcopy "D:\Hyperion\essbase\app\testplan" "E:\EssbaseBackup\Daily\App\testplan" /Y /S /E /i

5264.

Solve : Pause Command Question?

Answer»

I used the search button and looked is 20 of the pages and still couldn't find what I am LOOKING for.
I know about the "pause" and "pause>nul" commands
Pause: Suspends processing of a batch program and displays the message. "Press any key to continue . . ."
And doesn't continue till the person presses a key.
Pause>NUL does the same just doesn't display a message but it waits for a key to be hit.
Is there a subcommand under pause like pause>NUL that puts a timer on how LONG the wait is?

I looked at wait.exe and it is great but if I put that in an autorun then it wouldn't work because the person I’m giving it to wouldn't have wait.exe in there computer. And I did see the ping way but I couldn’t GATHER enough INFORMATION on it to try it out.

Can someone please help me out here. If you have any questions please CONTACT me.

Quote from: Dark Blade

ping -n 1 -w 1000 1.1.1.1 >nul
echo 3
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 2
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 1
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo.
echo 0

Except replace 3 with whatever number you want. You don't even have to include the numbers if you want.

This was on another thread. It is very useful.Quote from: Sharamall on November 06, 2007, 07:45:51 PM
Quote from: Dark Blade
ping -n 1 -w 1000 1.1.1.1 >nul
echo 3
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 2
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo 1
echo.
ping -n 2 -w 1000 1.1.1.1 >nul
echo.
echo 0

Except replace 3 with whatever number you want. You don't even have to include the numbers if you want.

This was on another thread. It is very useful.
Like I had said, I couldn't gather enough inforation about it to test it. What I ment by that was, I don't no what most of that is. Can you break it done for me? I know what ping is but everything else is a blure....
5265.

Solve : Help on BATCH FILE?

Answer»

Hello,
My Scenario is as follows:

Folder_PATH: 2007\NOV\06
(Daily one folder gets created dynamically via batch file and places three files (A,B,C) in XLS format)

In 06 Folder: I have three Files with three sheets in each
File: A (with sheet1,sheet2,sheet3)
File: B (with sheet1,sheet2,sheet3)
File: C (with sheet1,sheet2,sheet3)

All the sheets in the files headers are same i.e Sheet1!A (Header) = Sheet1!B (Header)

So my basic requirement is

File: D consisting of [sheet1(file A, file B, file C))

All the data in the files A/B/C of sheet 1 would consolidate in to file D of sheet1.

Kindly help me with the Batch file script please.

Thanks
Chandu

what do you need help with?Hey,
I need the batch file or script for doing this. If you provide me the script or the solutions for this according to the scenario then I would use it for my CURRENT scenario.

Kindly make it please

Thanks
ChanduExcel files are automation objects. While batch commands can manipulate the ENTIRE XLS files (move/copy/del) they cannot GET inside the XLS files to process the information on individual workbooks and worksheets.

You would need to use a Windows Script language that can deal with automation objects such as VBScript, JScript, REXX, or Python.

Try CHECKING out the Windows Script Center for more information.

5266.

Solve : Batch Processing Excel Spreadsheet Data?

Answer»

Can DOS commands be used in a batch file to read and write data (numeric and text) in Excel spreadsheets?

The problem: I have multiple data sets created as Excel worksheets in individual Excel workbooks and I need to extract the data values from corresponding cells in each workbook/worksheet, derive summed and average values of the numeric data, concantenate some text "values," and write results to a new worksheet.

Currently, this MEANS copy/paste each worksheet into a very large "master" workbook, and use the standard Excel functions to sum across all of those worksheets, etc. This works fairly well, but it is manually intensive and prone to error.

However, I have not seen anything to suggest that DOS commands can address specific worksheets within an Excel work book, or point to specific cells within the worksheet, so I am not at all sure that it can be done.

Any thoughts on this will be much appreciated.hi,

By saving your Excell project into a CVS (COMMA Separated file) you will be able to do a DOS loop on this file by using comma as delimiter. Then you could have each cell info into separate variables (that could be summed using the SET /a command). Then you can write your file back to the same format and import it in Excell.

I used to use this file format to automatically generate graphics in Excell, but I was using a more advance programming langage (not DOS scripting which is limitating).

Hope this will help!
ypTo YP,

Many thanks.

I'll have to try some simple test cases first to see if I understand your approach.

Since I am by no means a programmer even this may be a challenge, but I can SOMETIMES muddle through with help from the forum and a couple of very basic DOS reference books.

I suspect that this may be a lot easier using some higher level language, but I am not ready to GO there just yet.

TAQuote from: Aero_Tai on November 01, 2007, 11:14:38 AM

Can DOS commands be used in a batch file to read and write data (numeric and text) in Excel spreadsheets?
Not directly. You can use vbscript
5267.

Solve : Screen Output plus Logging in batch file?

Answer»

Hi

I WANT to run my batch script and at the same time print the echo's on screen as well as log them into a file. I could do it INDIVIDUALLY, i.e. either print the output on screen or log to a file but not both at the same time. How it can be achieved?

Any help is appreciated.

regardsyou can do a logging function in your batch file:

Code: [SELECT]:FCT_LOG
echo %1
echo %1 >> file.txt
GOTO :EOF

that you will call once when needed:

Code: [Select]CALL :FCT_LOG "message to log"

this will at least prevents that you duplicate all your messages

hope this helps
ypHi, Thanks a LOT for the input. I would definetly use your idea, it looks promising. But luckily I use cygwin so I just created one more bat file and called the original as under;

file2.bat ! TEE txt.log

regards

5268.

Solve : How do I look the dir information??

Answer»

I need to look at the files and including SUB folders files with data and time.

How do I get the files with current date ?

SureshkumarA single "dir" COMMAND will show you this INFORMATION. I hope this was of some help.If you want subfolders use: dir /s

If the LIST is very long you could redirect it into a file: dir /s >temp.txt

Cheers, Kris.Quote

If the list is very long you could redirect it into a file
..or use a switch "|more"
5269.

Solve : Help to decipher what this batch is doing??

Answer»

Can anyone help me translate the logic of this in English? I'm confused on what this is saying.

Thanks

************************************

@echo off

setlocal

echo REM Begin to copy 'App' dir to backup location > %outFile_CopyAppDir%

pushd "%ess_app_dir_source%"

for /f "tokens=*" %%a in ('dir /b /ad 2^>NUL') do call :PROCDIR "%%a"

popd@echo off
:: ensure local changes to ENVIRONMENT stay local
setlocal

echo REM Begin to copy 'App' dir to backup location > %outFile_CopyAppDir%

:: save the current working DIRECTORY
pushd "%ess_app_dir_source%"

:: STARTING from the middle, the dir statement lists directories in the current working folder
:: the >nul means send screen output to the nul 'bucket'
:: 2> means send any error output to the bucket; but > is reserved, so the ^> means
:: dont do the redirect within the FOR, but with the dir command when it is executing
:: the /f "tokens etc means - use the output of the command in the brackets
:: the call statement means call a subroutine within this batch, using the replaceable
:: parameter %%a (now HOLDING each directory name) as a paramenter to the
:: subroutine (Procdir)
for /f "tokens=*" %%a in ('dir /b /ad 2^>NUL') do call :PROCDIR "%%a"

:: restore the original saved working directory
popd

If you ARENT sure what these do, enter the following lines in a command window

setlocal /?
echo /?
pushd /?
popd /?
for /?
dir /?
call /?

and it will display help on each topic

Good luck
Graham

5270.

Solve : can not open cmd prompt..?

Answer»

wat wrong wif my computer, it can not open..
when i type cmd/command at run..nothing heppen?
wat's wrong?ANYONE...pliss help meIs this a work device or a personal device. It is possible to have the command prompt DISABLED with a GPO or other methods.the computer that i'm talking about is use for personal only, it's home use, i'm i need to format?uh u try this already:
CLICK start/program/accessory/commadprompt
IF you're using Windows XP:

If you have Windows XP Pro
Download this fix:
http://homepage.ntlworld.com/spencer.greys.../XPProfiles.exe
Save it to desktop and double click on it.
Let it extract to C:\Windows\system32 folder

If your operating system is Windows XP Home click on this link:
http://homepage.ntlworld.com/spencer.greys...XPHomeFiles.exe
Save it to desktop and double click on it.
Let it extract to C:\Windows\system32 folder

If your unsure if your running Home or Pro
Go to Start>Run Type in:
winver
Hit OK

Reboot the computer.
both 2 of the URL cannot be found, do u have other solution PLEASE...help please...I'm sorry for that.
First link:
http://homepage.ntlworld.com/spencer.greystrong/XPHomeFiles.exe
Second link:
http://homepage.ntlworld.com/spencer.greystrong/XPProfiles.exe

5271.

Solve : Increasing Dos Memory?

Answer»

I am running Windows XP and using the DOS cmd emulator. Unfortunatly i am prompted to INCREASE the current dos memory. As of yet I have been unable to figure or find out how. Any advice or help would be appreciated. Go to C:\WINDOWS\System32
Right click on command and click on Properties.
Click on the Memory tab, and set Conventional Memory to Auto.You sure?

Quote

i am prompted to increase the current dos memory
...never heard about such thing...
Post EXACT message.I appologise, the exact wording is free up.

...requires a min of 590K of free space...free up x amount more

memory settings already at auto

What anti-virus and anti-spyware programs do you have installed? nothing other than WHATEVER windows would run on its own
Quote
...requires a min of 590K of free space...free up x amount more
I really would like to see EXACT wording...
I don't believe, you are getting any message about DOS MEMORY in Windows XP."UB requires a MINIMUM of 590k vytes of free dos memory to run. You need to free up 6-15k more bytes of Dos memory."

Quote
using the dos cmd emulator
Are you using some 3rd party DOS emulator?
I have no clue what UB is...Sounds like the error message is generated by an application "UB"?

This might be relevant.

Good LUCK
5272.

Solve : exclude files while deleting?

Answer»

hey all,

I'm writing a loop to do sereval tasks.

I help support over 1000 tills and Pc's. they sometimes have errors in which I need to rebuild 'POS' folders to get the till program to run.

This envoles

1, copying the enitia CONTENTS of a dir to a remote machine's c:\pos folder. (no PROBLEM there)
2, removing a few files from known loactions (no problem there)

(this is the tricky bit)
these POS folders have files CALLED pos1.sts, pos1.ERR, pos1.tcf and pos1.cfg inside. The problem is they have these files for every till. ie, pos2, pos3, pos4, ect.....

I need to remove all .sts, .err, .tcf and .cfg files but the ones not affilated with the till in question (ie, on till 1 i'd need to remove all pos2.*, pos3.* ect...)

I could do this by makeing the user enter the till number, use that as a lable and for each lable do whats required for the till.

But i'd really like to just have one loop with values set for the different tills.

example;

goto %1 rem %1 being the till number you wish to run it for.

:till1

set /a till=pos1
set /a ip=%2.12 rem %2 being the STORES network address
goto loop

:till2

set /a till=pos2
set /a ip=%2.13
goto loop

:loop
net use \\%2.11
copy \\%2.11\c$\master.pos\*.* c:\pos\*.*

del c:\%till%.lck
del c:\pos\%till%.sts
del c:\pos\%till%.err

This is the bit i'm unsure of. - i'd like to remove all pos*.sts, .err, .tcf, .cfg files but ones that start %till%.
goto fin


:fin
echo. Pos rebuild Complete
exit


any ideas??

5273.

Solve : windows 2000?

Answer»

I had a dos bootable disc that i PUT in the computer which was RUNNING windows xp very slow and needed to be formatted so I formatted the hard drive now when I put in the windows 2000 pro it will not boot the set up it just say strike f1 to reboot or f2 for setup utility how do I install the operating system windows 2000 on the computer? please help!
THANK YOU SO MUCH!!!use your windows 2000 cd.. or rerange the boot order of your disk drives in bios so that your diskette drive LOADS before the harddrive.. if that doesent work rerange it so your cd loads firstDouble Post
Topic Closed.
See your other THREAD for replies...

5274.

Solve : Need help in running a batch file!?

Answer»

Dear Friends,

I need to execute a command in batch file format. The command during execution, prompts the user to enter a password. How can i GIVE the password through batch file? Could anybody help me?

EXAMPLE:

This is my batch file (test.bat)

myCA.exe "Software" SHA1 "test.p10" "test.template"

and this command will PROMPT for a password like this:
Enter the passphrase:

???My requirement is: the batch file should be able to give the passphrase when the command prompts for it.

Thanks in advance!!!Depending on how the program is written, there are a couple of things you can try.

Send the passphrase thru the pipe:
Code: [Select]echo passphrase | myCA.exe "Software" SHA1 "test.p10" "test.template"

REDIRECT the passphrase from a file:
Code: [Select]myCA.exe "Software" SHA1 "test.p10" "test.template" < passphrase.txt
It would be necessary to put the passphrase into a file. This method additionally hides the passphrase from the casual reader.

As mentioned, either method is dependent on how the myCA program was written.

Good luck.
HI Sidewinder,

Thank you very much for your valuable suggestions. I dont have an idea regarding how "myCA.exe" could have been implemented. But consider the below mentioned code:

/***************************/
/*Test.c */
/***************************/
int main() {

int i;
printf("\n Enter the number ");
scanf("%d",&i);
...
...
...
getch();
return 0;
}

Now, If i want to execute this Test.exe as a batch file. It will prompt the user to enter a number. But I would like to give it through batch file. Could you guide me.

Thanks in advance!!!

These are the kind of questions where you just have to try solutions until you find one that WORKS.

Both the pipe and redirection make data available on the STDIN device. I was able to find that scanf and getch get input from standard input. Whether standard input and STDIN are referring to the same device is best left to testing.

Try both the pipe and redirection on the myCA program. Possibilities include one, both or neither working. Same with your C program; compile and link it and see if either the pipe or redirection works.

Even if there is no automated solution, you'll at least know that and will have to arrange for manual input.

5275.

Solve : How to make your batch file appear when logging on?

Answer»

I have tried and tried but it won't work
Please help me with MAKING your BATCH file appear
when you log on.

Tell me commands if you can.

From ??Not sure I understand the question. Do you want this batch file to execute during a boot or are you running a network logon script?

MENTIONING your OS would be HELPFUL. Most posters on the DOS board are running some flavor of Windows.


make a shortcut and put it in your startup folder (or just put the actual file in the startup folder)

5276.

Solve : Enable " Wake-Up by PCI card"?

Answer»

What MS-DOS command I can write directly enable " Wake-Up by PCI card" in the BAT file??Quote from: chelsea007 on November 08, 2007, 08:20:42 PM

What MS-DOS command I can write directly enable " Wake-Up by PCI card" in the BAT file??
What exactly does Wake Up do.
Welcome aboard...
Say again?Quote from: Broni on November 08, 2007, 09:59:48 PM
Welcome aboard...
Say again?
If it is re regist
See REPLY on your email
If not I just wanted to know what ' Wake-Up by PCI card ' actually doesI know, I don't understand it, either..." Wake-Up by PCI card" can be enabled or diabled in BIOS after selecting power management set up.

What MS-DOS command I can write enable it in BAT file?Most NIC Manufacturers who have NIC's with this feature have software for the network adapters to be able to flash and edit the stored ROM settings.

For instance 3COM has a DOS Utility that allows you to Flash or enable and disable features like PXE Boot, Wake On Lan, Show CTRL+S option at boot to allow for you to manage it without the need for the software to edit settings.

If you are looking to run a BATCH to enable or disable your feature, you will likely find that your batch file wil LOOK something like below, where the 3comPCIMGT100.exe and the command switch of -WE is used for WOL ENABLE and WD for Disable.

cls
@echo. This will enable the WOL
@echo.
3comPCIMGT100.exe -WE
cls
@echo. WOL has been enabled
pause


Your BEST BET is to find DOS support for your NIC and see if there is a utility that can run in DOS to run a program and switch as shown above.

Good Luck!

Dave
5277.

Solve : problem connecting to server drive?

Answer»

Having PROBLEMS connecting two of my office computers to the server. I get a CMD does not support UNC paths as current directories. Every morining I have to run cmd and log in / connect to the server files as an admin. I'm not sure why this only happens with two computers. The other two computers have not problem connecting. Im running Windows 2003 server and XP on the computers. Can someone give me some feed back. Thanks, Joe

How are you authenticating for the UNC connections and do you have mapped drives or a temporary mapped drive to copy data from point A to B

I have seen before where it doesn't like xcopy \\server1\data\*.* c:\backup /s/d/y and the fix is to set up a pre-authenticated mapped drive by mapping \\server1\data as Z: or some drive letter not conflicting with your existing configuration and then you can call xcopy z:\*.* c:\backup /s/d/y to copy the latest data/folders to the backup location and not be a bandwidth hog, since you are only copying over newest or RECENTLY edited or created files/folders.

Only problems I have also seen is where you do not have EXCLUSIVE access to coping a file that may be cached or in use in some way like a *.mdb etc

You can also create authenticated drive mappings in your batch, but this is a HUGE Security Risk if anyone should view the batch file etc, they get the admin password!!!

HOPE this helps..

Dave

5278.

Solve : Batch loop (Resolved) oops - error fix?

Answer»

Using the Command Prompt in Win XP. Date format is Day mm/dd/yyyy

I want to be able to display the name of the current month using a batch file. The relevant part of the file is:

@echo off
cls

set datemonth=%date:~4,2%
if %datemonth%==11 set datename=Nov

echo %datemonth% %datename%

But do I need 12 'if' statements to handle each of the 12 months or is there a better way with a loop or some kind of array?

Thanks Code: [Select]@echo off
cls

set datemonth=%date:~4,2%

if %datemonth%==1 set datename=January
if %datemonth%==2 set datename=February
if %datemonth%==3 set datename=March
if %datemonth%==4 set datename=April
if %datemonth%==5 set datename=May
if %datemonth%==6 set datename=June
if %datemonth%==7 set datename=July
if %datemonth%==8 set datename=August
if %datemonth%==9 set datename=September
if %datemonth%==10 set datename=October
if %datemonth%==11 set datename=November
if %datemonth%==12 set datename=December

echo %datemonth% %datename%
echo.
pause
I just thought I'd write the code for 12 'if' statements. I don't think there is a better way but I'm only guessing. Also just out of curiosity, how did you work out the '%date:~4,2%. I mean, I know %date% shows the full date so how did you get the ':~4,2' in the LINE below?

set datemonth=%date:~4,2%

Quote from: jjbtcp on November 10, 2007, 04:00:17 PM

just out of curiosity, how did you work out the '%date:~4,2%. I mean, I know %date% shows the full date so how did you get the ':~4,2' in the line below?

set datemonth=%date:~4,2%

I'm definitely not the best one to explain that but in my understanding Date environment variable is stored as an 12-byte FIELD in the format such as Sun 11112007 and is obviously updated automatically when the clock goes past midnight.

So %date=:~4,2% skips the first 4 bytes (Sun + space) and returns the next two bytes. i.e. 11

To select the year one would use %date=:~8,4% i.e. skip 8 bytes and return the next 4 making it 2007. (Or %date:~-4% would give the same result).

Some instructions are here.

I hope I've not made a fool of myself with the above explanation, my technical knowledge is not all that good.

Thanks for the 12 IF lines, I already use that solution but looking for something a bit more sophisticated!!



I don't understand your explanation that well. But it's not you, it's me, My technical knowledge is very advanced but I haven't got around to learning the 'Bits and Bytes' of Computers.

Sorry I couldn't help much. Thanks for explaining.
The completed file to display day, date, month and year using a For loop to give the month a name is shown below for anyone interested. The For loop was described on another forum..

Code: [Select]@echo off
cls

set dateday=%date:~0,3%
set datemonth=%date:~4,2%
set datenum=%date:~7,2%
set dateyear=%date:~10,4%

FOR /F "TOKENS=%datemonth%" %%a IN (
"JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC") DO (
set month=%%a)
echo.
echo.
echo Day = %dateday% Date = %datenum% Month = %month% Year = %dateyear%
Quote
The For loop was described on another forum..

Can you give me the link to the post it was discussed in, please?

Oh and I understand your explanation now... Never say sleeping over something won't work.Further testing has shown that an error occurs when datemonth is greater than 07 and the leading digit is 0 (AUG & SEP) so the set datemonth line should read:

set/a datemonth=1%date:~4,2%-100

Apologies all round - testing continues.

What does the '-100' do?Quote
set/a datemonth=1%date:~4,2%-100
Quote
What does the '-100' do?

Oh dear - bear with me on this one.

It's not just the -100 which must be considered. You'll see that the original set is now set/a and there is a 1 prior to %date:~.....

When Set/a detects a number beginning with 0 it uses the Octal (base eight) system. When considering August and September the month numbers 08 and 09 are invalid so Set fails.

Set/a allows arithmetic calculations to be done.

The 1 prior to %date:~... means that 1 is to be prefixed to the environment variable %datemonth%. When the month is August (08) %datemonth% would be set to 108. Then the arithmetic CALCULATION -100 is carried out and %datemonth% now becomes 8.

I understand that without the leading 0 Set now defaults to the Decimal system (base ten).





Cool, This is quite a good script, I would have never thought of it myself.
5279.

Solve : set variables to a list of data?

Answer»

i want to do something like this

for /f "tokens=1*" %%a in ('%TEMP%\~mdt.txt") set %random%=%%a

but when i do it sets all the LINES in mdt.txt as the same random number
also i need a way of keeping track of these variables any ideas?
You might try creating an array. You can certainly keep track of the upper and lower boundaries of an array easier than using random environmental variable names.

Code: [Select]@echo off
set idx=0
for /f "tokens=1* delims=" %%a in (%temp%\~mdt.txt) do (
call set /a idx=%%idx%%+1
call set array.%%idx%%=%%a
)

I made the assumption that each line in the file was to be saved to the array. You can change this if need be.

thanks .. but its not working, i tryed your code and i kept getting this no matter how i edited it
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
ECHO is off.
0

so i tryed for /f "tokens=5*" %%a in (%temp%\iris) do set %a%=%%a & set /a a=%a%+1 & goto JJJ1

and i GET the same thing?I am unable to reproduce your results. Did you cut and paste the code or retype it? Actually there should be no OUTPUT at the console. The posted code simply assigns variables in the environment space to value of each line in the file.

After running the code, check your environment (use the set command with no parameters at any prompt). You should find variables named array.1 with the value of the first line in the %temp%\~mdt.txt file, array.2 with the value of the second line, array.3 with the value of the third line, etc. While this is not a true array, it comes close to your original request as the array variable is indexed.

I'm not sure what you can do with these results, you could spit back the file in reverse order, but I'm sure you have something in mind.

PS. I notice that you changed the tokens= value from 1 to 5. Any particular reason?

Note: Environment variables set thru batch files live only as long as the cmd window is open. Also keep in mind that unless the delims= value is OVERRIDDEN, the default is spaces and tabs.hey i appreciate it it works now.. it was my own error not your code
5280.

Solve : Celsius to Farenheit converter?

Answer»

I want to make a batch file that can convert Celsius to Farenheit.

Below is the mathematical notation needed to make the CONVERSION.
Celsius * 1.8 + 32

I made a program that does this in C++ but can't figure out how to make one in batch.


Thanks.I dont think this is at all possible in Batch, as Batch is simply for automating lists of tasks. Your better off using a C program, or Qbasic.

( COOL tool: http://www.wbuf.noaa.gov/tempfc.htm )you can do simple arithmetic in batch
see here for exampleActually, batch code can do simple integer arithmetic. If you use a conversion formula as F = C*9/5+32, you can produce a REASONABLE approximation.

Code: [Select]C=78

set /a f=78*9/5+32

F = 172

The batch answer is off by .4 --- a decimal VALUE the batch code can't process.

How the heck are ya Sidewinder ? ?

I guess I'll have to teach my friend C++. I want to help him learn but after you teach someone the basics it's hard to go too much further. Through what I have read about Batch, I never learned once that it could be used for mathematical calculations.
I apologize for my incorrect advice, I had absolutely no idea Don't worry, even though your Information was Incorrect, it still holds relevance - when you said: Quote

Your better off using a C program, or Q basic.


Thanks guys, But all in all I will just have to forget about making one in Batch.

Sidewinder, Thanks for the code, I know it's only a little bit off but I want it to be precise, Thanks anyway (still might come in useful).you just have to mutliply your values by 100 then add the . at the right place

Code: [Select]@echo off
set C=78
echo C = %C%

set /a result=%c%*100*9/5+32*100
set /a F1=%result%/100
set /a f2=%result%-%f1%*100

set F=%f1%.%f2%
echo F = %F%

the output is accurate:
Code: [Select]C = 78
F = 172.40
yp
5281.

Solve : Search drive for exe and run if found?

Answer»

Hi I was wondering how to go about making a BATCH file to search the C: for a particular .exe file, and to start it if it is found.
It needs to work nomatter what directory the .exe is in.
Any ideas?@echo off
set av1=%cd:~0,1%
for /f "tokens=1*" %%a in ('dir %av1%:\yourexefile.exe /a /b /s') do start %%a



first line turns echo off
second line sets the drive letter as %av1%
third line searches from drive %av1%:\ for yourexefile.exe , /b for bare format /s to INCLUDE all sub directorys, so if you start in root "%av1%:\" it searches the entire drive , /a includes all hidden files & foldersWorks great apart from one thing. If the directory has a SPACE in it eg. 'Program Files' it comes up with an error saying Windows cannot find 'C:\Program'.
Is there a way to get it to work for directories with spaces by putting QUOTES around the file path or something?Diablo your video scare me you have to add double quotes:

start "%%a"

ypusing double qutoes in start will make it open cmd.exe again with title "%%a"

use this instead

for /f "tokens=1*" %%a in ('findstr /I %au1a% yourfile.exe') do RunDll32.exe shell32.dll,ShellExec_RunDLL "%%a"Cheers

for /f "tokens=1*" %%a in ('dir %av1%:\yourexefile.exe /a /b /s') do RunDll32.exe shell32.dll,ShellExec_RunDLL "%%a"

Works for me

5282.

Solve : Extract info at command prompt?

Answer»

How do i extract INFORMATION from command prompt into any format like a text FILE or something, other than MANUALLY COPY and paste??

For example, when i enter the command ipconfig, how do i extract the information displayed? like those ip ADDRESS and stuff.Welcome to the CH forums.

Redirect output using > or >>

e.g. ipconfig > filename or

ipconfig >> filename to append output to the file.

5283.

Solve : Count on file name?

Answer»

Hi

I have written some code to move some files around and to ultimately receive data from a 3rd party via FTP and format that data by calling a couple of external processes ready for use by the user.

I guess as a validation check I would like to count the number of instances of *.tab (filename) in a given directory, and if the count = 1 then go and complete the rest of the script otherwise (i.e. count of *.tab>1) to end so that the user can select a different file to run on the received data.

Any ideas?
Thanks The simplest thing would be to do something like :

Do a directory listing of all the *.TAB files
Count the number of occurrences
Stick the result into an environment variable and test it

Code: [Select]Dir /b *.tab | Find /c /i ".tab"> $temp$
Set /P TabCount=<$temp$
Del $temp$

GrahamSorry, I'm a rookie with this....

So would I use errorlevels to get DOS to select whether it should continue through my script or go to :End? If so how would this look?

at the moment I have :-

Quote

rem there's numerous basic DOS routines above this line
cd C:\New_Programs\InComing\
FTP -s:C:\New_Programs\Receive\GetFtp.txt ftp.someorg.org
Rem
Ren C:\New_Programs\InComing\*.tab SingleReturnFile.tab
rem the script goes on to tranbslate the tab file to csv, and import to access

I am THINKING that I need something where I have put the blank remark line to perform the action that I want.

TabCount holds the number of files with a tab extension, so you would do something like

If TabCount NEQ 1 GoTo ErrorLabel
Rem else continue, only 1 present

GrahamThanks Graham. Almost got it I think. Scratching my head over these following SCENARIO though:-

Quote
dir /b *.tab | find /c /i ".tab"> $test$
Set /P TabCount =< $test$
Del $test$

Ok these commands result in the variable having a value of 1 (I have checked using Set)

But with the following code:-

Quote
If TabCount EQU 1 Goto OneReturned
IF TabCount NEQ 1 Goto TooMany

The result is always NEQ 1 - have I MISSED something?

Thanks

Whoops, my fault

I forgot to wrap the TabCount in % symbols

It should have read :

If %TabCount% EQU 1 Goto OneReturned
If %TabCount% NEQ 1 Goto TooMany

If you really want to test that the condition, try this

REM test line below
Set TabCount=2
If %TabCount% EQU 1 Goto OneReturned
If %TabCount% NEQ 1 Goto TooMany

GrahamSpot on!

Edit:
ANYBODY reading this and wanting to use similar syntax, it is worth checking the name of your variable - as the set up above requires checking the condition against %TabCount % and not %TabCount%. To check this, once you have done this bit:-
Quote
dir /b *.tab | find /c /i ".tab"> $test$
Set /P TabCount =< $test$
Del $test$

Issue a Set command to see how the variable is held. Mine came out as
TabCount =1

Therefore when I issued the If %TabCount% EQU 1 go do something - it ignored the line as the condition was not met. Changing to If %TabCount % EQU 1 go do something worked.

ANyway, thanks for the solution Graham!
5284.

Solve : Need some help with long text!!!?

Answer»

Hi

I ran a dos program that gave me some information... but... there is so much information that at some point, I can't see the rest of it.

Is there any way to scroll up or to dump all the INFO in a text file?


thanksuse >>

type myfile.exe>>myfile.txt
It says that it's not recognized has an internal or external command :S

whats the command your using?
say the information you want is in dir..

dir >>myfile.txtwell i'm ALREADY in a directory... so I just use

nameOfExe.exe>>testFile.txt

should I use dir nameOfExe........
no sorry..that was just an example

what is the name of the command your using that displays to much information?
using >> will redirect output of the command into a file..

so if you typed dir you would see a listing of files and folders
and if you typed dir >>myfile.txt , instead of seeing a listing of files it would send
that information to myfile.txt in the same directory
it's a exe file that gives me the info...

I tried doing test.exe >> myfile.txt but it gave me an error because the program is looking for a certain file to get the information.

When i just type test.exe it gives me the info... is there any way I can TAKE what's on the screen and put it in a txt file? or is the >> (using the exe) the only way?Quote from: earth4x on November 14, 2007, 11:45:14 AM

I tried doing test.exe >> myfile.txt but it gave me an error because the program is looking for a certain file to get the information.
what kind of error, do you mean that test.exe needs an input file?

the double redirection (>>) will append the output at the end of the selected file
Code: [Select]nameOfExe.exe >> file.txt
you could use only one redirection (>) this will overwrite the file
Code: [Select]nameOfExe.exe > file.txt
you might also try the MORE command:
Code: [Select]nameOfExe.exe | more /p ? ? ?
5285.

Solve : free vista cmd tool?

Answer» Hydrafind

-Instantly find and open any FILE (much faster then dir commands)
-Find other possible matches and save keywords to open specific files
-fixed all known bugs
-the more specific you are the faster it is , example searching config.nt should be instant.

-for vista only , if theirs any errors tell me,
- by downloading you hereby agree that im not RESPONSIBLE any damages/loss of data from this executable file and while it is not promised or gaurenteed to contain no bugs or to cause damages to your computer and or other persons computer it has been checked, however im still not liable.



[getting disk space - attachment deleted by admin]With that disclaimer i think i'll pass for now...
Where is this from or is it something you are tinkering with ? ?its just a batch i WROTE converted to exe,

heres the latest version HydraFind

also will probably WORK in xp maybe even 98
to bypass the part about vista goto the line and type 00>>%temp%\B~au1
5286.

Solve : Checking status of executable via DOS Batch command?

Answer»

How do I check on the status of executables running on a Windows2003 SERVER via DOS Batch command?The FOLLOWING comand shows a LIST of running tasks :
Tasklist
FILTER the output to retrieve the ONE you are interested in

Do Tasklist /? to see all the parameters

Graham

5287.

Solve : Command > Subcommand?

Answer»

Hi

I'm not sure if this is possible, but I need a way to execute a command, and then execute ONE of it's 'subcommands' from a batch file.

More specifically, TELNET. Being ABLE to open the connection, then proceed through with the HELO, MAIL FROM, RCPT TO, DATA, and QUIT. I've yet to figure this out though

I believe I've seen an example of the FIND being used with a pipe line and the DIR command. Something like...

FIND "Test" | DIR C:\

I'm not sure if that was it, but I know I saw the pipe line. I did a search for it on Google, but all I didn't really find MUCH on the subject. Could one of you help?

Thanks for your time. Seeyah try a terminal emulator with macros like zoc http://www.emtec.com/download.html#zocfiles
works good for moo alsoNot everyone is going to have that installed, though. I'm writing a plugin for something, and it needs to be able to execute the Telnet command. I tried to spawn a hidden MS-DOS window, and then send window messages to it, but either Delphi or Windows doesn't like periods and hyphens (as well as other characters...). It rips em out. (So I can't put in the IP or things like gmail-smtp-in.l.google.com.)

Right now I'm trying to either write a temporary batch file to do it, then delete that when I'm done, or just ShellExecute the Telnet command and have all the 'subcommands' in the execution code. And could someone tell me what the correct name for those are? I'm pretty sure it's not 'subcommand' O.o

Before someone tells me to just set up my own client in Delphi and send it from that, I've tried, and Delphi (or at least the component I'm using) doesn't like TSL, which is what Gmail uses.

5288.

Solve : search entire C: drive for *.doc and *.xls and copy to thumb drive?

Answer»

So I am looking for a way to search a C: drive through use of a batch file at the command prompt of Windows XP for all files *.doc and *.xls on a C: drive and copy them to a thumb drive.

Not sure if there is a command that can be run at the prompt to search for *.doc and *.xls on the C: and copy hits to the thumb drive at G:

This is to be used for a woman who likes to store her data everywhere on the C: drive, but wants to back it up to a thumb drive at the end of her work day for word and excel documents.

I am really picking my brain to come up with a solution since saving everything to a single folder with subfolders seems too difficult for her in which I could use an XCOPY /s/d/y from a known single main folder, and since she is in upper management I have to come up with a solution to accomodate her needs.

Anyone have any ideas on how to do this, possibly some batch snippets to lead me on the right path or a batch file to do this if its not too much of a hassle to code up quickly somehow.

Many Thanks!

Dave Have you actually tried XCOPY /S?

I suggest you give it a trial by creating a .bat file as below:

@echo off
cls

ECHO A | XCOPY /S C:\*.DOC J:\BACKDOC\ > NUL
ECHO A | XCOPY /S C:\*.XLS J:\BACKXLS\ > NUL

Where J: is your thumb drive

I ran the above but copied .BAT and .TXT files with no problems except I have no way of telling whether all files were copied, I don't have a record of how many .bat and .txt files there are.

(Caps are for emphasis only)

Please come back to us with your results.



Hello Dusty

I tried that batch and edited to write to C:\BACKDOC and C:\BACKXLS since I didnt have a thumb drive handy to test with, and added a pause to see the error message at the end of the routine and got an error message of:

Cannot perform a cyclic copy
Cannot perform a cyclic copy
Press any key to continue . . .

Not sure if this is because I am trying to write to the same drive during this copy routine. Never seen this error message before. When I get to work I will test this with a thumb drive and see if that makes everything run correctly by not trying to write to a drive that is in a read only state possibly through this instruction set.

Here is the code that I edited to test this:

@echo off
cls

ECHO A | XCOPY /S C:\*.DOC C:\BACKDOC\ > NUL
ECHO A | XCOPY /S C:\*.XLS C:\BACKXLS\ > NUL
pause


Thanks

Dave
That's an XCOPY error message which shows that XCOPY/S cannot copy from/to the same directory i.e. it cannot copy from C:\anydir to C:\anotherdir, the source and destination cannot be in the same directory. When your destination directory is J:\somedir the error condition does not exist.

Note that in this context C: is considered to be a directory altho' we may think of C: as a partition or drive letter.

Here is a MS Technet article on the error message, altho' it mentions just Win.2k it is about the XCOPY/S error message, the same error message may be displayed if running XCOPY/S in real Dos mode. The error condition should not arise when you are XCOPY'ing to your thumb drive.

Hello Dusty,

I tried this using a thumb drive and your correct that the error message goes away. I found a thumb drive at HOME before going to work and ran the batch on my home system which has a 40GB HD and I saw activity on the thumb drive, but didnt see any files copied across to it. After it ran for about 45 minutes with a blank shell window with no error messages, I terminated the batch and will try it out here in a few minutes to see if it does what it should. I should have checked the folder on the thumb drive to see if it grabbed data or not.

I will test it and see if it grabs all data as intended. For the fact that it was taking a while on my home system and the drive is 35GB full of the 40GB, it was LIKELY overwhelmed with how much it had to search through.

Before looking to batch code as a solution I also looked to see if I could find a way to run the windows search feature through the command shell and a switch to specify the search criteria, but figured it was easiest to go the path of an actual batched instruction set.

I was also curious thinking about how I should handle if there was more than one file found with the same name such as in her archive folders. You wouldnt want just only the latest sales.doc or .xls file copied to the thumb drive and the archive data not POPULATING over, so I should also add a test routine of IFEXIST rename the file or create a new folder for it so it doest stump on top of the older files on the thumb drive that are grabbed prior to the latest file date/time stamp.

Thanks,

DaveQuote

I saw activity on the thumb drive, but didnt see any files copied across to it.

The reason for not seeing any display of files copied is > NUL which is suppressing output to your monitor. If you want to see what's being copied delete this from both lines.

Quote
I was also curious thinking about how I should handle if there was more than one file found with the same name such as in her archive folders.

Xcopy/s creates a directory system on your thumb drive which mirrors the directory system on C: so that a file which resides in C:\Sales_files\October\First_Week will be copied to J:\Sales_files\October\First_Week, so any file duplication in different directories is irrelevant.

Try running the bat then have a look at the thumb drive to see what's been done.

Note that your bat Xcopies all occurrences of .doc and .xls files and the ECHO A piped command means that you are not asked to approve overwriting on your thumb drive so that the second and subsequent runnings of the bat can be unattended. Date/time stamping can certainly be used to xcopy only the latest and greatest.

Once you have implemented your backup system I suggest you then test your backup files. Nothing worse than needing your backed-up files only to find you cannot access them - it happens HEY your correct!

It does copy the folders structures over only if a xls or doc is tied to the end of the tree as XCOPY would do.

Thanks Again!!!

The user is VERY HAPPY with this band aid to their bad habit of storing data everywhere !!!!

DaveThanks for getting back with your result..

Quote
since she is in upper management I have to come up with a solution to accomodate her needs

If you get a big fat bonus for this I expect my share via Western Union... LOL

Good luck

5289.

Solve : install software through the network on a target computer?

Answer»

I want to install some software on a target computer. This computer is a member of our LAN network but he is located on another location. We want to remotely install some software on this computer. We don't have any software to deploy updates and new software (like microsoft sms). The question is can I install the software through a dos command ??

perhaps something like : NET use \\computername\directory run install.exe /s ??

can anyone help me with this, thanks a lot Quote

The question is can I install the software through a dos command ??

Not LIKELY. Net Use will map a remote drive/folder to your LOCAL machine. When you run the install, even if the software installs to the remote drive, it will be the local registry (on your machine) that gets updated.

Check out the Script Center for tools to handle remote CHORES. Both the new Powershell CTP and VBScript 5.7 have tools for remote EXECUTION using HTTP protocol.

Note: The Powershell CTP is an early release of Powershell 2.0. Use at your own risk. VBScript 5.7 is stable and functionally complete.

5290.

Solve : Batch file help need - executing link to silent install or executable?

Answer»

We have a link to share that silently installs the MICROSOFT SMS client on machines.

Instead of copying the path to the share, I want to create a BATCH file that basically execute the link to the share as if I am GOING to Start > Run > pasting the link to the silent install and pressing OK.

How do I do this? I'd rather CLICK on the batch file instead of copying and pasting into a RUN box.

Thanks

5291.

Solve : i need Dos 3.1 or dos 4.1?

Answer»

I need dos 3.1 or dos 4.1. thar is very impotant for me. PLEASE help and direct me.

if you found send to my Email:

[emailprotected]

thank you


E mail address removed to prevent Spam

Topic Closed.
Read the forum rules. We wont help you acquire software illegally.

If you WANT to buy it I suggest you check out eBay. There are listings for various versions of DOS.I'm unlocking this at REQUEST of WillyW...
There may be an alternative here.

Quote

I dug through my bookmarks and found what I remembered, and was going to post this:

----------
If you are ASKING for a full install, see Deerpark's post.
If all you need is a boot disk, check out:
http://oldfiles.org.uk/powerload/bootdisk.htm

I hope that helps.
------------
5292.

Solve : Batch files and characters not recognised by DOS?

Answer»

Hi All
I've been doing this for years now but have received a PC with loads of file names with spaces and "&" CHARACTERS in the folder and file names. Have WRITTEN a batch file to delete the duplicate file names but the DOS command won't execute line commands such as

"del C:\Data_emails_copy_071107\10_S&S_Oct_JN_06.dbx" .. because of the "SPACE" and "&" in the command line.

Tried %20 but it also bombed.

Is their a substitute character for the batch file syntax to make it execute the line. There are 1000's of files and folders with these characters so RENAMING manually is not an option.

Thx

Kens
try to escape them, the & symbol is FORCING it to read it like..

"del C:\data_emails_copy_071107\10_S
& S_Oct_jn_06.dbx"


so try "del C:\Data_emails_copy_071107\10_S^^&S_Oct_JN_06.dbx"

del,C:\Data_emails_copy_071107\10_S&S_Oct_JN_06.dbx"

might also work

5293.

Solve : Batch File to send Space command to running Dos software?

Answer»

My APC Backup UPS 400 will be used to send a "space" command to the running Dos program.
However, since APC doesn't supply any info, I am looking for a batch file that will work.
The file is run from the APC software when a power incident occurs.
Any suggestions would be appreciated. By space command I'm guessing you mean the space character. Unless this running program is waiting for input, I'm not aware of any way to interrupt a program to force feed it data.

If during the execution of this program, it eventually requests data, it is possible to put the input on the stack where the program will look first for input. This has to be done when the program is launched.

Code: [Select]echo. | APCprogram

Not much to look at, but we really need more info about this DOS program. The program runs a small CNC Mill. It accepts input from several keys including the space bar which pauses the program.
Without the UPS when a power disruption occurs, the system just stops. My hope is that with a UPS, we can initiate a Pause until power is restored, or at least stop the program and get it restored when power resumes.
This is what APC says:

In order for command files to be launched properly from PowerChute Network Shutdown, it is critical that you use the correct syntax. Since these command files are launched by services, they require syntax that is not required by a command when launched from a command line.

If the command file includes statements to run executable programs (.exe), a DOS command called @START MUST be used in these statements. The @START command uses these syntax rules:

- The full path name of executable program is required
- Path names that include spaces must be enclosed in quotes
- A double quote must precede the quoted path name
- If the executable requires arguments, the arguments must be placed outside the quotes

Below are some examples of proper syntax, using APC shutdown utilities as the executables:

Example 1: Executable program with spaces in the full path name. The empty double-quote is required because of the way the @START command works. The @START command opens a window in which to run the executable. The user can assign a name to this window; the name must be placed in quotes after the @START command. :

rem Microsoft Internet Information Server shutdown utility:
@START "" "C:\Program Files\APC\PowerChute Network Shutdown\Agent\Shutdown Utilities\shutiis"

Example 2: Executable program requiring arguments. Notice that the arguments are outside of the quotes:

rem Microsoft BackOffice shutdown utility:
@START "" "C:\Program Files\APC\PowerChute Network Shutdown\Agent\Shutdown Utilities\shutback" SNA Exchange SMS SQL

Example 3: In the latest version of PCNS, application shutdown MAY look a little different:

To use the shutdown DLL utilities, do the following:

Include the following line (using the full path name) in a command file with any other commands that you want PowerChute Network Shutdown to execute before shutting down the operating system.
@START /D"installation dir\Shutdown utilities" appshut DLL name
So, for example to shut down Microsoft IIS from the default installation directory:

@START /D"C:\Program Files\PowerChute\Shutdown utilities" appshut ShutdownIIS.dll

Example 4: Executable program with no spaces in the full path name. Notice that no quotes are required:

rem Oracle shutdown utility:
@START C:\APC\Oracle\PWRFAIL.BAT From what I've read of your post, the APC utilities are triggered during a power outage to ensure the smooth shutdown of various major subsystems running on the local machine.

What I didn't see was any of these utilities sending data or keystrokes to these subsystems. I'm guessing the APC utilities QUIESCE each program using the Windows API.

More about this program that runs the CNC Mill. Can you not include the program in the list of programs that APC shuts down? As for pausing the program, I'm not sure how to send a space variable thru a batch file as most times a variable with a value of space is INTERPRETED as undefined.

5294.

Solve : Using batch file to Backup to another machine?

Answer»

Hello,
I'm trying to write a BATCH file to backup a certain folder's CONTENTS to another machine over the network.

Here's the code I'm using:


ECHO dave | net use /user:dave x: \\computer2\share
I'm mapping the drive with this line, the user NAME is dave and the password is dave.
I used the echo command so that when it PROMPTS for a password it would have it to put in, but it doesn't seem to be working right.
Can anybody hlep me out with this.

The next line is working fine, its the first one I'm struggling with.

xcopy c:\aloha\*.* /S /D /Y x:\alohabackupdata\

Thanks in advance.Not sure that net use requests the password, but this may work:

Code: [Select]@echo off
for %%i in (Dave) do net use /user:%%i x: \\computer2\share %%i
xcopy c:\aloha\*.* /S /D /Y x:\alohabackupdata\

You may have to reposition the second %%i.

Good luck. 8-)

5295.

Solve : DOS Error??

Answer»

Hi,

I wanted to find out what was my ip address and so i typed "ipconfig /all" without the quotes into MSDos but i received this error:
'ipconfig' is not recognized as an internal or external command,
operable program or batch file.

Anyone knows what might be causing this? Because previously i could do the ipconfig command. Btw, i am using Win XP Pro SP2.Are you in a directory on the path?

cd \windows


and then type it. Does that fix it?

By the way you do not have DOS. Hi,

I have done exactly that and still it does not work.Quote

so i typed "ipconfig /all" without the quotes into MSDos

By MSDOS, I'm guessing you're referring to the CMD shell program. Check your PATH. In order to find IPCONFIG, C:\windows\system32 must be on the path.

8-)

Hi Sidewinder,

Yup, that WORKED! Is there anyway i can set the starting path to be c:\Windows\System32 instead? ThanksRight click My Computer==>Properties==>Advanced==>Environment Variables

Edit the PATH variable. User variables refer to only you; system variables refer to every user.

OK your way out. No need to reboot; changes are immediate.

I"d be curious how this got mucked up. The system32 dir is a standard path entry for XP.

Good luck. 8-)Hi Sidewinder,

What should i add into the PATH variable? There are some values inside that PATH variable that allows my OS to do some Java compiling or something. I was asked to do this by my lecturer in school. The value is "C:\j2sdk1.4.2_03\bin;C:\Sun\AppServer\bin".Edit the PATH Variable Name. Insert either %SystemRoot%\system32; OR c:\windows\system32; into the beginning of the Variable Value.

Be careful not to muck up whatever value is already there. It is very necessary that you include the semi-colon.

Good luck. 8-)

Quote
Hi Sidewinder,

What should i add into the PATH variable? There are some values inside that PATH variable that allows my OS to do some Java compiling or something. I was asked to do this by my lecturer in school. The value is "C:\j2sdk1.4.2_03\bin;C:\Sun\AppServer\bin".

Aha here's where it got mucked up...Hi,

I have entered the values you as MENTIONED, when i GO to my ms dos, the starting path is still the same but when i type in ipconfig it works. Why is that so?the starting path is still the same

The starting directory is still the same but your path now includes your system32 directory.
(By default your system32 directory is in your path but you must have deleted it with the previous change.

You can now set your opening directory to be C:\> for the neatness factor and everything will still work.
(I like neat) Quote
You can now set your opening directory to be C:\> for the neatness factor and everything will still work.

Right click the shortcut used to launch CMD==>Properties

Change the "Start In" value to the directory of your CHOOSING. OK your way out.

8-)

Neatness Factor: 9.7
5296.

Solve : not getting any ip with netstat command!?

Answer»

hi guys i dont get any ip with netstat COMMAND for instant msgs COULD u please help me out of this PROBLEM

looking forward to hear from u!!!!!Maybe I'm just tired, but perhaps you could explain exactly what you're trying to do. NETSTAT displays your active TCP connections and their protocols. Not sure how this relates to instant messages. Do IM's refer to the NET SEND command or the ones from AOL, MSN or Yahoo, etc?

:-? :-? :-?Possibly trying to find someone he IM's to maybe ? ?

Just fishin here...Quote

Possibly trying to find someone he IM's to maybe ? ?

If that is the case run NETSTAT with EITHER the -n switch or the -b switch. This should give you the info you need.

8-)

In the mean time, I'm goin' fishin' with Patio.
5297.

Solve : Exit Code?

Answer»

How can I check the exit code/return value from a program being executed in a batch file?

Thanks very much!Try CHECKING the ERRORLEVEL value in reverse sequence. Note that all programs do not issue ERRORLEVELS and even Microsoft UTILITIES use them haphazardly. In general a value of zero indicates all is well; anything else is a sign of problems.

Code: [Select]program
if errorlevel 1 GOTO problem
if errorlevel 0 goto AOK

:Problem
.
.
goto end

:AOK
echo Everything OK
goto end

:End

5298.

Solve : if exist doesn't work in some cases (?

Answer»

Hello,
when I try to proof if a *.lnk FILE EXIST in the following path it doesn't work.
It works on other (shorter) paths.
Is the path to long?
Is there a workaround for this problem?
(OS is NT4)

snip---------------
set PC=marvin
if exist "\\%PC%\c$\WINNT\Profiles\All Users\Start*\Programme\Front End\logon.lnk" (echo logon.lnk OK)

----------snap

uliQuote

if exist "\\%PC%\c$\WINNT\Profiles\All Users\Start[highlight]*[/highlight]\Programme\Front End\logon.lnk" (echo logon.lnk OK)
I suspect the problem is with the wildcard in the middle of the path. A little testing shows wildcards only seem to work at the end of the path.

Code: [SELECT]if exist "\\%PC%\c$\WINNT\Profiles\All Users\Start\Programme\Front End\logon.[highlight]*[/highlight]" (echo logon.lnk OK)
8-)

Tested on XP SP2 but should be BACKWARD compatible.Many thanks Sidewinder.

The easiest solutions are often the best. :-)

(I used the wildcard cause of the ü, (no ascii letter), makes sometimes trouble.)

uli
5299.

Solve : wat is d best way 2 make a opengl??

Answer»

plz give me some advise 2 make it thnx GOOGLE came up with over 25 million hits INCLUDING lots of tutorials. I GUESS there's no 'best' way just multitudes of ways & you have to SELECT the best ONE for you..

Good luck

5300.

Solve : Startup Batchfile?

Answer»

Yet another request for a batchfile and an edit to my autoexec.bat.

I would like the computer to give me an option between DOS, Windows 3.11 and OpenGem every time I switch on my PC, and if no answer is given after a set time default STARTUP is DOS.

Any answers or links to freeware programs, all good.I don't know where to find a program like that offhand, but I do know one thing: A batch file will not do this. how about some lines in my autoexec?
From DOS, I can start Windows (WIN) and OpenGem (GEM) and DOS is already there, I could write a batch file that will execute WIN or GEM or do nothing (DOS) and put a path to it in the autoexec. All I need is someone to write the batch.After some research on batch files, I did one myself:

Code: [Select]@ECHO OFF
CLS
:: By Wooden Spoon
ECHO.
ECHO Boot MANAGER
ECHO.
ECHO A Start OpenGem Core
ECHO B Start Windows 3.11
ECHO C Continue in DOS 6.22
ECHO.
CHOICE /c:abc Select one -
IF ERRORLEVEL 3 GOTO PL3
IF ERRORLEVEL 2 GOTO PL2
IF ERRORLEVEL 1 GOTO PL1
GOTO END
:PL1
@echo off
C:\GEM.BAT
GOTO END
:PL2
@echo off
C:\WIN
GOTO END
:PL3
@echo off
C:\
GOTO END
:END
CD\

I called it startup.bat, put it in the root directory, and included the line \STARTUP.BAT as the last line of my autoexec.
DOS still has to be loaded first, but it would be anyway to run GEM or windows.
Runs fine in 6.22
What commands give and display a time limit before SELECTING the default?
I'm pretty sure the SYNTAX is "/t:y,nn" where y is the default choice and "nn" is the number of seconds. I'm not exactly positive that that's what it is, but I think it is. Otherwise just type "choice /?".

-John