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.

7851.

Solve : ghost batch script?

Answer»

i NEED some help regarding a script i want to use for restoring a ghost image fully unattended. this is a script i GOT from work. In this script there is a line which i do not understand:

a:\Ghost\ghost.exe -CHKIMG,c:\svpbackc.gho -batch -pwd=raid-login

what does the raid-login do???

and do i need the WORD -batch at the END of this line??

the complete script is as follows:

@echo off

ECHO Start Verify(C image)...
a:\Ghost\ghost.exe -CHKIMG,c:\svpbackc.gho -batch -pwd=raid-login
IF ERRORLEVEL 1 GOTO GSTERR1

ECHO Start Recovery...
a:\Ghost\ghost.exe -script=a:\script.txt
IF ERRORLEVEL 1 GOTO GSTERR2

GOTO GHOSTEND


:GSTERR1
ECHO **********************************
ECHO * *
ECHO * GHOST Image Verify error(C:) *
ECHO * *
ECHO **********************************
GOTO ERROREND

:GSTERR2
ECHO ******************************
ECHO * *
ECHO * GHOST Image load error *
ECHO * *
ECHO ******************************
GOTO ERROREND

:GHOSTEND
ECHO ***********************************
ECHO * *
ECHO * Recovery Normality Completion *
ECHO * *
ECHO ***********************************
GOTO NORMAL

:ERROREND
GOTO END

:NORMAL
BEEP
GOTO NORMAL

:END

Check those options here:

http://www.symantec.com/business/support/index?page=content&id=tech130961

7852.

Solve : Format C:?

Answer»

may have asked this before, but didn't see the answer if it came.

I've been reformatting my hard DRIVE and REINSTALLING XP. now someone tells me that XP is set up in such a way that you don't quite reformat the whole disk when you reformat C: (Not a quick format option, but the whole format option is what i'm doing, btw).
Is this CORRECT. have microsoft gone and done ANOTHE rof those. this is A, but it is really B, typoe of things??
i.e., where the process is not exactly what they want you to believe it to be?
is there a small PORTION of my jhard drive that is likely NOT being reformatted?That small part of the drive that you think is not formatted is most probably being used by the file system that the format command installs.

Sounds more like another urban legend.

7853.

Solve : need help, should be simple... something like tokens?

Answer»

I need some help with a script I'm trying to write please. Ive been at this for days and Im not really getting anywhere, although I am getting to know cmd a lot better.

ill try describe what my script has to do, i cant write the commands out on the net im afraid

-------------------------------------------------------------------------------------------------------------------

The script passes the command line a command. CMD returns 4 lines of code. on the third line there is the UUID of the last software build. its not a hardware uuid.

I need to get my script to copy this UUID and APPEND it onto the end of the next command my script passes, in order to proceed with the script.


-------------------------------------------------------------------------------------------------------------------

I'm new to this, I have been watching tutorials, and saw that tokens do something similar, so i tried to write a script using them. it doesnt work though, it keeps telling me it needs a unique key, in other words it doesnt have the uuid


------------------------------------------------------------------------------------------------------------


for /F "tokens=16" %%i in ('the command needed to return the lines of code') do set barney=%%i

something UNREGISTER -view -uuid %barney%



------------------------------------------------------------------------------------------------------------


alas this is not working. can ANYONE point me in the right direction please? im thinking something like substring or equivalent, but the uuid starts like 120 characters into the returned output, so both tokens ans substring seem wrong

can anyone help please?

kind regards,
redd .SHOWS us the string that is returned and it should be an easy fix. Not knowing the whole string makes it a guessing game.cheers for the reply, I appreciate it


I cant show you the returned output unfortunately. I can show you an edited version with the correct amount of characters but not the words.
this is because I'm in work, I'm an intern.

Tag: 12345.A.B
Global path: \\1234.1234512345678.com\CC\12345.A.B
Server host: snap.1234512345678.com
Region: windows
Active: NO
View tag uuid:d0a32387.0e874aae.85aa.86:bd:6a:ac:d3:ed
View on host: snap.1234512345678.com
View server access path: C:\CC\12345.A.B
View uuid: d0a32387.0e874aae.85aa.86:bd:6a:ac:d3:ed
View attributes: snapshot
View owner: 123456789\123451234567I need to somehow grab one of those uuids and add it to the end of my next commandThere are more than 4 lines there

This should work (untested) after you replace command1 with the command that returns those lines, and command 2 is your next command to use the uuid. ATM it will just echo the text to the console.


for /f "tokens=2,* delims=: " %%a in (' command1 ^|find /i "uuid:" ') do set "var=%%b"
echo command2 %var%

Note that I edited the above:thanks! Ill try it out and replort back. I think it may be tomorrow before I know, at the more theres a cleanup being peformed, so theres no UUID's to speak of.

I will report back though, once again, many thanks.edit noted
okay, im just analysing what you did, and its pretty sweet. i have been trying to find a way to do this for a week now, so its nice seeing a way forward. may i ask you a few questions about the bits I dont understand please?


so far as I can make out, you searched the output for the string "uuid" and stored it, and the token next to it, as A and B.

I'm guessing the * next to tokens stores everything that was returned?

you then piped it to "Find" to search for the string "uuid"

may I ask what the /i does?

regards,
redd .
Quote from: cmd.exe

C:\Users\Lemonilla\Documents\bat>find /?
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not SKIP files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.
thanks Lemonilla. I just clicked how to read the help results, cheersQuote from: foxidrive on January 28, 2013, 08:14:39 AM

for /f "tokens=2,* delims=: " %%a in (' command1 ^|find /i "uuid:" ') do set "var=%%b"

It takes the lines that command1 generates and uses FIND to separate the ones that have uuid: in them.

The FOR then splits those lines up into 'words' by removing : and spaces (as delimiters)
2,* takes the 2nd word and then everything after the second word, and sets var to everything after the second word by incrementing %%a to %%b

In your example it will do this twice, once for each occurrence of uuid: and will remember the last one.hey all. Thanks for explaining that Foxidrive. It seems this site is one of the only resources for learning msdos on the net. I found Dilberts tutorial and am having a good look through it.
Theres a guy on youtube also, starkIndustries, hes very good, but, the tutorials cut off at a certain point. - a certain point before the level of foxidrive's command lol, it never gets that advanced.

anywho, I tried the command this morning, and got a "The syntax of the command is incorrect." reply

so i tried with with a SYSTEMINFO command in the parenthesis, and a different string to find, but the same error came back.

it seems theres something slightly awry with the first line okay, if I take out the * and replace it with 3, -

for /f "tokens=2,3" %a in (' SYSTEMINFO ^|find /i "broadcom" ') do set "var=%b"
echo I like cats and %var%


It works! woohoo! i get this


C:\Windows\System32>echo I like cats and %var%
I like cats and NetXtreme


however, it requires that i hit enter after

C:\Windows\System32>echo I like cats and %var%

in order to get the next line, "I like cats and NetXtreme" which is not ideal. brilliant though, love it.The extra enter may be due to running it from command line, when I run it in a batch file, It doesn't pause (until my 'pause>nul').

Code: [Select]@echo off
for /f "tokens=2,3" %%A in (' systeminfo ^| find /i "broadcom" ') do set "var=%%B"
echo I like cats and %var%
pause>nul

Code: [Select]
C:\Users\Lemonilla>cd ..\..

C:\>test.bat
I like cats and 802.11n

your right, I just had a go there and it ran through without pausing.

If i may id like to as another question. the batch file im trying to create has in it three tasks. first is the one above, and the next are two delete commands.
the scripts is one of many executed my anthill pro as part of a nightly software build. so, i have to add error handling, im a little bit confused about it.. so far my file goes like this, using the example above

--------------------------------------------------------------------------------------------------

:: step 1

for /f "tokens=2,3" %%a in (' SYSTEMINFO ^|find /i "broadcom" ') do set "var=%%b"

if there are no tokens -

IF ERRORLEVEL 1 (
goto builderror
)

echo I like cats and %var%


:: below are to delete the directories
::----------------------------------------------
:: step 2

RD /S /q C:\CA\repositorydriver\directoryA

IF ERRORLEVEL 1 (
goto builderror
)

:: step 3

RD /S /q C:\CA\repositorydriver\directoryB

IF ERRORLEVEL 1 (
goto builderror
)


:builderror
echo *** An error has occured executing clearRegistry.bat


:exit
7854.

Solve : Input\Output Batch File?

Answer»

Hi,

Just a quick question really. im trying to create a batch file where the input and output are combined in one file. Is this possible?

Thank you

AndrewWhat input? What output? We are not mind readers. Describe more fully.
I'm guessing that he wants to append the output data to the same file the input data is read from.

You can do that for a for /f command.

Code: [Select]@echo off
for /f "delims=" %%a in (file.txt) do (
>>file.txt echo output: %%a
)Input can COME from multiple different sources. It can be

  • input while running by a user (set /p ver=)
  • input before running (%1-%9)
  • TAKEN from a file (for /f)

To write to a file you can use '>>' or '>'
Code: [Select]echo Hello, World! >>file.txt
ping 127.0.0.1 >>output.txt
echo %1 >>input.txt
for /f %%a in (file.txt) do (echo %%a >>input.txt)
[code]

We will need a little more information as to the problem to better provide help.Following code will take input from same file and paste output in same file.

FOR /F "usebackq tokens=*" %%a in ("log.txt") do echo %%a >> "log.txt"Basically i'm trying to individually add a large amount of users to 64 servers.

so what i meant by input and ouput is that it shows you the command you running and the response it gives.

If someone already has access to a server it STATES dsadd failed: already a member.

Unfortunately some people used '0' instead of 'o' when inputting server names, so when i try to add them to that server i just get dsadd failed.

Because of the large amount of commands being used, i cant see which command has failed

Does that make sense?(same reply as elsewhere)

You are running a batch file with the 'dsadd' tool in I presume.
As long as it doesn't require keyboard input launch it like this:

Code: [Select]batch.bat >dsadd-log.txt
and then you can filter the log file with a command looking for errors and examine dsadd-error.txt

Code: [Select]find "already a member" <dsadd-log.txt >dsadd-error.txtsorry im not using dsadd. Im using dsmod group -addmbr

I dont understand the second part of what you said


iv created a log file which is showing the comman added but its not showing the error

I'm sorry for any confusion.

I'm fine with getting the output from the batch file into a log file (> log.txt).

My problem is that there are a lot of lines in the batch and the errors from dsmod do not show any detail about the issue. I'd like to show the commands from the batch file in addition to the output.

My batch file looks like:
command > log.txt
command1 >> log.txt


I know that I could do

echo command > log.txt
command >> log.txt
echo command1 >> log.txt
command1 >> log.txt

but I thought there must be a way to tell command prompt to log the commands, as well as the output, to a file....

If I can see the command above the error in the log file, I'll know exactly what didn't work.
You could try this:

If the batch file starts

@echo off

either comment that line out like this

REM @echo off

or change it to this

@echo on

or delete it altogether
Thanks for the advice.

Won't this just output the commands to the screen though? I want to echo the commands to a file.If you are redirecting the whole batch output to a file (as in foxidrive's reply no. 7 above) like this...

blablabla.bat > somefile.xyz

...then everything that would normally* go to the screen** will end up in the file. Try it.

Did you say the error messages are ending up in the output file?

* i.e. the stdout stream
** except error messages SENT to the stderr stream; some programs do this. If that is relevant to this situation it will become apparent I imagine.







yeah i've tried that and it does exactly what you say.

What im trying to do is get the errors that come with them so i know which one has failed.

to an extent i've got the errors to send to a different file but its only showing one error instead of 4. Is this overwriting itself?I'm pretty sure it will over write itself if you use only 1 > instead of >>. But it's equally as likely I'm wrong.
Quote from: AndrewUsh on February 05, 2013, 05:11:26 AM
to an extent i've got the errors to send to a different file but its only showing one error instead of 4. Is this overwriting itself?

need to see your code. Otherwise this is guesswork.
7855.

Solve : Create next Wednesday Month Year?

Answer»

I so crazy with this batch code for next Wednesday/Month/YR. The code will run every Wednesday 12:01 am will create next Wednesday. So I got that part next Wednesday work fine, but problem with create next month if this month at 02/27 with not change to MAR. Anyone have any ideas or different thought on this. Thanks

@echo off
setlocal enabledelayedexpansion

:::::::::::::::::::::::
: Create next Wednesday
:::::::::::::::::::::::

>NextWed.vbs echo Wscript.echo eval(WScript.Arguments(0))
set VBcmd=cscript //nologo NextWed.vbs
set NDW=Wednesday
For /L %%A in (1,1,7) do for /f "delims=" %%N in ('%VBcmd% "weekdayname(weekday(date+%%A))"') do if "%%N"=="%NDW%" set Offset=%%A

for /f "delims=" %%Y in (' %VBcmd% "year(date+%Offset%)" ') do set yyyy=%%Y
for /f "delims=" %%M in (' %VBcmd% "month(date+%Offset%)" ') do set mm=%%M
for /f "delims=" %%D in (' %VBcmd% "day(date+%Offset%)" ') do set dd=%%D

del NextWed.vbs

:::::::::::::::::::::::::::
: Adjust date into 2 digits
:::::::::::::::::::::::::::

if %mm% LSS 10 set mm=0%mm%
if %dd% LSS 10 set dd=0%dd%

:::::::::::::::::::::::::
: Create current Month
:::::::::::::::::::::::::

set Month=%DATE:~4,2%

if %Month_Date%==01 set Month_Date=JAN
if %Month_Date%==02 set Month_Date=FEB
if %Month_Date%==03 set Month_Date=MAR
if %Month_Date%==04 set Month_Date=APR
if %Month_Date%==05 set Month_Date=MAY
if %Month_Date%==06 set Month_Date=JUN
if %Month_Date%==07 set Month_Date=JUL
if %Month_Date%==08 set Month_Date=AUG
if %Month_Date%==09 set Month_Date=SEP
if %Month_Date%==10 set Month_Date=OCT
if %Month_Date%==11 set Month_Date=NOV
if %Month_Date%==12 set Month_Date=DEC

echo %dd%%Month_Date%%date:~10,4%.TEST.TXT > nextwed.txt


So I come up different thought for yr 2013 if fall on those date will change to month need, but don't know how apply in if current month regular or next month.

set Month_Date=%DATE:~4,2%%date:~7,2%

if %Month_Date%==0130 set Month_Date=FEB
if %Month_Date%==0227 set Month_Date=MAR
if %Month_Date%==0327 set Month_Date=APR
if %Month_Date%==0424 set Month_Date=MAY
if %Month_Date%==0529 set Month_Date=JUN
if %Month_Date%==0626 set Month_Date=JUL
if %Month_Date%==0731 set Month_Date=AUG
if %Month_Date%==0828 set Month_Date=SEP
if %Month_Date%==0925 set Month_Date=OCT
if %Month_Date%==1030 set Month_Date=NOV
if %Month_Date%==1127 set Month_Date=DEC
if %Month_Date%==1225 set Month_Date=JAN

echo %dd%%Month_Date%%date:~10,4%.TEST.TXT > nextwed.txt

Is this a exercise or a real-world application?
Real men do not write that kind of code for a trivial problem. There already exists SOLUTIONS for that kind of thing.

But if this is a puzzle, just ignore my comments above.

Noe after having said that....
You can make a table of leap years from data found on the Internet. Wait., I will do lit for you...
Code: [Select]1996
2000 2004 2008 2012 2016 2020 2024 2028 2032 2036 2040 2044 2048
2052 2056 2060 2064 2068 2072 2076 2080 2084 2088 2092 2096 2104

Let me know if you need more... Thank for reply...

Is this a exercise or a real-world application? Yes....this is real-world application.

Real men do not write that kind of code for a trivial problem. There already exists solutions for that kind of thing. Could help me where is the link relate with this?

But if this is a puzzle, just ignore my comments above.

Noe after having said that....
You can make a table of leap years from data found on the Internet. Wait., I will do lit for you...Please....
You can use simple batch arithmetic and some VBS functions.

1. Long

@echo off
echo Wscript.echo eval(WScript.Arguments(0)) > evaluate.vbs
echo wscript.echo DateAdd("d",wscript.arguments(0),date) > futureday.vbs

REM Find the date of next Wednesday or any other day of the week

REM We use these day numbers
REM 1=Sunday 2=Monday 3=Tuesday 4=Wednesday 5=Thursday 6=Friday 7=Saturday

REM 1. Find today's number
REM in VBscript "date" is today's date - ,1 parameter means start week on Sunday
for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "weekday(date,1)"') do set TodayNumber=%%A

echo Today is day number %TodayNumber%

REM Specify which next day to Find
REM Example: Wednesday
set WantedNextDay=4

REM 2. Calculate how many days to wantednextday
set /a DaysToWantedNextDay=%WantedNextDay%-%TodayNumber%
if %DaysToWantedNextDay% LEQ 0 set /a DaysToWantedNextDay+=7

echo Days until next day %WantedNextDay% = %DaysToWantedNextDay%

REM Use VBScript Dateadd to give the date specified days in future
for /f "delims=" %%A in ('cscript //nologo futureday.vbs %DaysToWantedNextDay%') do set NextWantedDayDate=%%A

echo Desired date is %NextWantedDayDate%

2. Short

@echo off
echo Wscript.echo eval(WScript.Arguments(0)) > evaluate.vbs
echo wscript.echo DateAdd("d",wscript.arguments(0),date) > futureday.vbs
for /f "delims=" %%A in ('cscript //nologo evaluate.vbs "weekday(date,1)"') do set TodayNumber=%%A
set WantedNextDay=4
set /a DaysToWantedNextDay=%WantedNextDay%-%TodayNumber%
if %DaysToWantedNextDay% LEQ 0 set /a DaysToWantedNextDay+=7
for /f "delims=" %%A in ('cscript //nologo futureday.vbs %DaysToWantedNextDay%') do set NextWantedDayDate=%%A
echo %NextWantedDayDate%

Example output, format will be your local date format.

Today is day number 2
Days until next day 4 = 2
Desired date is 06/02/2013
















Really nice code, but how we get out put "06MAR2013" And this code will work on every week at Wednesday 12:01 am if run? ThanksThis will give you the next day, 7 days in advance from when it is run, in the format 13Feb2013

Code: [Select]@echo off
echo >"%temp%\%~n0.vbs" s=DateAdd("d",7,now)
echo>>"%temp%\%~n0.vbs" m=MonthName((right(100+month(s),2)), True)
echo>>"%temp%\%~n0.vbs" WScript.Echo right(100+day(s),2) ^& m ^& year(s)

for /f "delims=" %%a in (
'cscript //nologo "%temp%\%~n0.vbs"') do set day=%%a
del "%temp%\%~n0.vbs"

echo %%day%% is set to "%day%" (without the quotes)
pauseI'm not a big fan of these hybrid scripts. It always seemed that anyone with the skills to use batch language to write VBScript code, could write the entire script in VBScript and be DONE with it. On the other HAND when dealing with date or floating point arithmetic they do save jumping thru hoops by using pure batch.

Quote

I so crazy with this batch code for next Wednesday/Month/YR. The code will run every Wednesday 12:01 am will create next Wednesday

This may help:

Code: [Select]@echo off
setlocal

findstr "^:::" "%~sf0" > temp.vbs
for /f %%i in ('cscript //nologo temp.vbs') do echo Next Wednesday is %%i

del temp.vbs
goto :eof

:::WScript.Echo getnextDOW(vbWednesday, Date)

:::Function getNextDOW(intDOW, dtmDate)
::: intTemp = WeekDay(dtmDate)
::: nextDOW = dtmDate - intTemp + intDOW + IIF(intTemp < intDOW, 0, 7)
::: getNextDOW = getLiteralMonth(nextDOW)
:::End Function

:::Function IIF(blnExpression, dhTrue, dhFalse)
::: If blnExpression Then
::: IIF = dhTrue
::: Else IIF = dhFalse
::: End If
:::End Function

:::Function getLiteralMonth(nextDOW)
::: arr = Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
::: dtmDay = DatePart("d", nextDOW)
::: if dtmDay < 10 Then dtmDay = "0" & dtmDay
::: getLiteralMonth = dtmDay & arr(DatePart("m", nextDOW) - 1) & DatePart("yyyy", nextDOW)
:::End Function

This will compute the date of any next day of week. Use vbSunday thru vbSaturday to represent the week days in the script at line 10. Note: the IFF function comes straight from VB and prevents flagging the current date as the next DOW.

Onward and Upward .I like this code, but how get out the month with uppercase "12FEB2013". Please help or have different thought. Thanks

Quote
@echo off
echo >"%temp%\%~n0.vbs" s=DateAdd("d",7,now)
echo>>"%temp%\%~n0.vbs" m=MonthName((right(100+month(s),2)), True)
echo>>"%temp%\%~n0.vbs" WScript.Echo right(100+day(s),2) ^& m ^& year(s)

for /f "delims=" %%a in (
'cscript //nologo "%temp%\%~n0.vbs"') do set day=%%a
del "%temp%\%~n0.vbs"

echo %%day%% is set to "%day%" (without the quotes)
pause
Quote from: dtran on February 05, 2013, 09:17:32 AM
I like this code, but how get out the month with uppercase "12FEB2013". Please help or have different thought. Thanks

Make this change

@echo off
echo >"%temp%\%~n0.vbs" s=DateAdd("d",7,now)
echo>>"%temp%\%~n0.vbs" m=MonthName((right(100+month(s),2)), True)
echo>>"%temp%\%~n0.vbs" WScript.Echo right(100+day(s),2) ^& UCASE(m) ^& year(s)

for /f "delims=" %%a in (
'cscript //nologo "%temp%\%~n0.vbs"') do set day=%%a
del "%temp%\%~n0.vbs"

echo %%day%% is set to "%day%" (without the quotes)
pause

Thanks very much guys for help this code work. You guys so good . Finally I have the code below run very Wednesday at 12:01 am and create next Wednesday into a text file then sendevent that text file into gloval variables of Autosy. I just hopefully this 27/02/13 this job will run then create date 06MAR2013.TEL144821D. Thanks

Salmon Trout
foxidrive
Sidewinder
Geek-9pm

Code: [Select]@echo off
echo > "%~n0.vbs" s=DateAdd("d",7,now)
echo >> "%~n0.vbs" m=MonthName((right(100+month(s),2)), True)
echo >> "%~n0.vbs" WScript.Echo right(100+day(s),2) ^& UCASE(m) ^& year(s)

for /f "delims=" %%a in (
'cscript //nologo "%~n0.vbs"') do set nxtWday=%%a
del "%temp%\%~n0.vbs"

echo %nxtWday%.TEL144821D > nxtWday.txt

ping -n 2 127.0.0.1 > nul
for /f %%i in (nxtWday.txt) do sendevent -E SET_GLOBAL -G "FDB_TEL144821D=%%i"
7856.

Solve : Add Progress Spinner To Menu Batch File?

Answer»

Hello everyone!!! Im new to batch files and im wanting to incorporate a spinning progress to my menu of 9 choices. I can just call it but it runs the spinner then runs the ping. Im wanting to hide the ping and just show the spinner and display the packets failed or revived line. Any ideas? Thanks!

SPINNER:
Code: [Select]setlocal EnableDelayedExpansion
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"

FOR /L %%n in (1,1,50) DO (
call :spinner
ping localhost -n 1 > nul
)
exit /b

:spinner
set /a "spinner=(spinner + 1) %% 4"
set "spinChars=\|/-"
<nul set /p ".=Waiting...!spinChars:~%spinner%,1!!CR!"
exit /b
My Menu:

Code: [Select]@echo OFF

:MENU

:: Clear the window
cls

::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::CHOOSE COLOR START:::::::::::::::::::::
:: Color attributes are specified by TWO hex digets.::
:: 1) The first corresponds to the background ::
:: 2) The second corresponds to the foreground ::
:: ::
:: COLOR 0 = BLACK COLOR 8 = GRAY ::
:: COLOR 1 = BLUE COLOR 9 = LIGHT BLUE ::
:: COLOR 2 = GREEN COLOR A = LIGHT GREEN ::
:: COLOR 3 = AQUA COLOR B = LIGHT AQUA ::
:: COLOR 4 = RED COLOR C = LIGHT RED ::
:: COLOR 5 = PURPLE COLOR D = LIGHT PURPLE ::
:: COLOR 6 = YELLOW COLOR E = LIGHT YELLOW ::
:: COLOR 7 = WHITE COLOR F = BRIGHT WHITE ::
::::::::::::::::CHOOSE COLOR END::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::

COLOR 71

echo.
echo =============FOX IV MENU=============
echo -------------------------------------
echo. 1. Ping Router
echo. 2. Ping Line 1
echo. 3. Ping Line 2
echo. 4. Ping Line 3
echo. 5. Ping Line 4
echo. 6. Ping Line 5
echo. 7. Ping Line 6
echo. 8. Ping Maintenance FoxIV
echo. 9. Exit
echo -------------------------------------
echo.

SET /P choice=Please select a number from 1-9...
if '%Choice%'=='1' GOTO MAINROUTER
if '%Choice%'=='2' GOTO LN1
if '%Choice%'=='3' GOTO LN2
if '%Choice%'=='4' GOTO LN3
if '%Choice%'=='5' GOTO LN4
if '%Choice%'=='6' GOTO LN5
if '%Choice%'=='7' GOTO LN6
if '%Choice%'=='8' GOTO TESTIV
if '%Choice%'=='9' GOTO EOF

::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::CHOICE INVALID START::::::::::::::::::
::(1) Clear the window ::
cls
::(2) Create a space from the top ::
echo.
::(3) Tell the user what invalid entry is ::
echo. You entered a %choice% which is an invalid entry, please try again!
::(4) Timeout for 3 seconds so they can read it ::
timeout /t 3 /nobreak > nul
::(5) Clear the window ::
cls
::(6) Go back to the MENU to start over ::
goto MENU
:::::::::::::::::CHOICE INVALID END:::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::


:MAINROUTER
cls
echo.
ping
echo.
GOTO END

:LN1
cls
echo.
ping
echo.
GOTO END


:LN2
cls
echo.
ping
echo.
GOTO END

:LN3
cls
echo.
ping
echo.
GOTO END

:LN4
cls
echo.
ping
echo.
GOTO END


:LN5
cls
echo.
ping
echo.
GOTO END

:LN6
cls
echo.
ping
echo.
GOTO END

:TESTIV
cls
echo.
ping
echo.
GOTO END

:END

cls
echo.
echo ==============EXIT MENU==============
echo -------------------------------------
echo. 1. Go Back To Main Menu
echo. 2. Exit
echo -------------------------------------
echo.

SET /P choice=Please select a number...
if '%Choice%'=='1' GOTO MENU
if '%Choice%'=='2' GOTO EOFyou could use
Code: [Select]ping | find "Packets: "

Code: [Select]C:\Users\Lemonilla>ping 127.0.0.1 | find "Packets: "
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
How could I incorperate the "Spinner" into each GOTO for the menu so each item I GOTO shows the "Spinner" instead of the pinging of the IP address?If your spinner is saved in a different batch file, you could 'call Spinner.bat' or if it's within your file 'call :Spinner'. Not quite sure which GOTO statements you are talking about. I assume you want to replace the ping in one of these
Code: [Select]:LN1
cls
echo.
ping
echo.
GOTO END
with the whole of the spinner without writing it in every time. To do this you could either have
Code: [Select]:SpinnerEx
setlocal EnableDelayedExpansion
for /f %%a in ('copy /Z "%~dpf0" nul') do set "CR=%%a"

FOR /L %%n in (1,1,50) DO (
call :spinner
ping localhost -n 1 > nul
)
exit /b

:spinner
set /a "spinner=(spinner + 1) %% 4"
set "spinChars=\|/-"
<nul set /p ".=Waiting...!spinChars:~%spinner%,1!!CR!"
exit /b
and replace 'ping' with 'call :SpinnerEx'

or you can save spinner into a separate batch file (I'm going to name it SpinnerEx.bat)
and replace 'ping' with 'call SpinnerEx.bat.Yes the spinner is within my bat file. I wanted to have it show the (Waiting... /|\ ) while it was pinging the selection I made and when its done pinging then show the ping results.

Example:

If I selected 1 from the menu it would GOTO LN1

Code: [Select]:LN1
cls
echo.
ping XX.XX.XXX
echo.
GOTO END


Now I wanted it to not only for all GOTO's that I select that would ping have it show the (Waiting... /|\ ) while it was pinging the selection I made and when its done pinging then show the ping results.

How can I do this, Hope this helps my newbie explation isnt helping...

If I add the call spinner it shows the spinner then pings the IP and shows that too, I tried that...

Thanks!

Code: [Select]@echo off
:loop
cls
@echo. Process RUNNING ^/
ping 127.0.0.1 -n 1 >junk.txt
cls
@echo. Process Running ^_
ping 127.0.0.1 -n 1 >junk.txt
cls
@echo. Process Running ^\
ping 127.0.0.1 -n 1 >junk.txt
cls
@echo. Process Running ^|
ping 127.0.0.1 -n 1 >junk.txt
GOTO loop

I have redirected the output of batches to a junk text file before to hide what normally would cause screen scroll and then only display the cartwheel by echo and clear screen to get rid of screen scrolling. I haven't found a clean way yet to perform cartwheel in batch. And for my lengthy batch files where I want to know where it is at in the process I just use clear screen and then something like Process at 50% checkpoints displayed and then further on in the batch process at 75% and then at the end Process at 100%. If you have a very long batch process you can change the intervals to be any scale you want etc and simply just redirect the output to a junk text file to hide it from the user display.

The above batch I have is kind of pointless for a ping as for none of the results are displayed to the user, but you can simply remove the redirection >junk.txt from the line and it will show on the display.

Code: [Select]@echo off
:loop
cls
@echo. Process Running ^/
ping 127.0.0.1 -n 1 >junk.txt
cls
@echo. Process Running ^_
ping 127.0.0.1 -n 1 >junk.txt
cls
@echo. Process Running ^\
ping 127.0.0.1 -n 1 >junk.txt
cls
@echo. Process Running ^|
ping 127.0.0.1 -n 4
GOTO loop
This one shows 3 results and loops, but the pings that are redirected to junk.txt are actually acting more like time delays for the cartwheel effect.

BUT ... the cartwheel pauses while processes cause delay as seen in the second batch I posted removing a redirection and ADDING longer ping duration. So if you want a cartwheel to keep spinning while a lengthy process is running, I haven't found a way yet to do this with batch.Here are three progress bars / spinners (not written by me) that I had squirreled away.


Code: [Select] @Echo OFF
SetLocal EnableExtensions EnableDelayedExpansion

For /f %%a in ('copy /Z "%~dpf0" nul') Do set "CR=%%a"
Set "busy=|/-\"
Set /A n=0

::BUSY SPINNER
For /L %%i in (0,1,10) Do (
Set /A "n=%%i%%4"
For /L %%n in (!n! 1 !n!) Do Set /P "=Calculating !busy:~%%n,1! !CR!"<NUL:
PING -n 2 127.0.0.1 >NUL:
)
::COUNTDOWN
For /L %%i in (10,-1,1) Do (
Set /P "=Backup will begin in %%i seconds. !CR!"<NUL:
PING -n 2 127.0.0.1 >NUL:
)
::PROGRESS
For %%i in (*) Do (
Set /P "=Copying %%i !CR!"<NUL:
PING -n 2 127.0.0.1 >NUL:
)

pause

Code: [Select]: Tom Lavedas
@echo off
setlocal
set "write=<nul set/p"
%write%=Patience, please
for /l %%a in (1,1,25) do (
%write%=Ü
ping -n 2 127.0.0.1 > nul
)
echo. Thank you for waiting.


Code: [Select]:: BEGIN FILE ::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ProgBar.cmd
:: Frank P. Westlake, 2009-07-23
:: Demonstrates a progress bar.
:: Set variable 'size' with the number of times a loop will
:: be accomplished.
@ECHO OFF
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
Set /A size=1234, progress=0, item=0, last=0
Echo.Processing %size% items . . .
:: Save current code page for restoration at completion.
For /F "tokens=2 delims=:" %%a in ('CHCP') Do Set "CP=%%a"
:: Using code page 437 for the character 'Û' in the progress bar.
CHCP 437 >NUL:
:: Progress bar caption.
Echo. 10 20 30 40 50 60 70 80 90 100%%
:: 7-bit ASCII progress indicator.
::Set "indicator=___"
:: 8-bit progress indicator (Û=DBh, the inverted space character).
::Set "indicator=ÛÛÛ"
Set "indicator=±±±"
:: A demonstration loop.
For /L %%i in (0 1 %size%) Do (
Set /A item+=1,progress=item*10/%size%
If !last! NEQ !progress! (
Set /P "=!indicator!"<NUL:
Set /A last=progress
)
Call :DoNothing
)
:: Terminate the progress bar.
Echo.%indicator:~0,2%
:: Say bye now.
Echo.Bye.
:: Restore the computer operator's code page.
CHCP %CP% >NUL:
:: Goto :EOF.
Goto :EOF


:DoNothing
::Not doing anything yet . . .
:: Goto :EOF again.
Goto :EOF
:: END OF FILE :::::::::::::::::::::::::::::::::::::::::::::::::::
Quote from: oxicottin on February 05, 2013, 07:51:36 PM

Now I wanted it to not only for all GOTO's that I select that would ping have it show the (Waiting... /|\ ) while it was pinging the selection I made and when its done pinging then show the ping results.
This is not possible, as far as I'm aware.Would be cool though.... Thanks everyone for the info!!! HI,

Quote from: BC_Programmer on February 06, 2013, 06:11:15 AM
This is not possible, as far as I'm aware.
It's possible, but it's tricky.
You need a second thread, so one thread do the work and the other displays the spinner.

A second thread can be startet via start or start /b for the same window.
But as I said, it's nothing a beginner should try.

jebI wrote a simple sample for an asynchronous spinner and a smarter GetKey function, so you don't need to press enter.

I suppose it should be obvious how it works.

Code: [Select]@echo off
setlocal EnableDelayedExpansion
if "%~1"==":::" goto :spinnerThread

:menuLoop
<nul set /p menu=Select menu[1 or 2]=
call :GetKey
echo(
echo Pressed '!key!'
if !key!==1 call :menu1
if !key!==2 call :menu2
if !key!==2 call :menu2
goto :menuLoop

:menu1
:menu2
call :spinnerStart
rem do some work
ping localhost -n 3 > nl
call :spinnerStop
echo Finished
exit /b

:spinnerStart
del spinnerStop.tmp > nul 2>&1
start /b "" cmd /c "%~df0" :::
exit /b

:spinnerStop
echo dummy > spinnerStop.tmp
:__spinnerStop
if exist spinnerStop.tmp goto :__spinnerStop
exit /b

:spinnerThread
for /f %%a in ('copy /Z "%~f0" nul') do set "CR=%%a"
set "spinChars=\|/-"

:spinnerLoop
set /a "spinner=(spinner + 1) %% 4"
<nul set /p ".=Waiting...!spinChars:~%spinner%,1!!CR!"
ping localhost -n 2 > nul 2>&1
if not exist spinnerStop.tmp goto :spinnerLoop
del spinnerStop.tmp > nul 2>&1
echo(
exit /b

:GetKey
set "key="
for /F "usebackq delims=" %%L in (`xcopy /L /w "%~f0" "%~f0" 2^>NUL`) do (
if not defined key set "key=%%L"
)
set "key=%key:~-1%"
exit /b

jebIndeed, it would appear my previous comment was premature:
"testslashes.bat":
Code: [Select]@echo off
start /b slasher.bat
ping www.google.ca -n 8 > redirected.txt 2>&1
echo "test">stopslash.dat
echo "finished."
:waitdel
if exist stopslash.dat goto waitdel
cls
echo Finished!
type redirected.txt
slasher.bat:
Code: [Select]@echo off
if exist stopslash.dat del stopslash.dat
:start

for %%P in (^| \ - /) do cls&echo %%P&ping localhost -n 2
if exist stopslash.dat del stopslash.dat&goto endfile
goto start
:endfile


testslashes is the "main" one. What it does is spawns off the "slasher" batch using start /b, then it uses a ping and redirects it to a file. While it is doing this, the slasher batch is writing the spinning cursor. When it detects stopslash.dat exists, it deletes it and exits. When the ping completes in the main batch, it writes out the stopslash.dat file, then waits for it to be deleted. and clears the screen and displays the results, which were redirected to a file. The 'slasher' batch just has the logic to keep looping until the sentinel file exists, at which point it deletes the file and exits. It also deletes it when it is entered to try to prevent issues.

Wow thanks guys I REALLY appreciate it!!
7857.

Solve : Ssh and cmd?

Answer»

Hello right im unsure if this would work or not so bare with me

Currently i have 2 computer in my local network there both static ips and are running windows 7 and 8.

On the windows 7 computer (DESKTOP) i run a bat file that calls for a java run time to start a bukkit server (minecraft server this leaves a cmd open on the screen with what the server is currently doing such as messages being sent player to player ect and it also allows me to input ADMIN commands to manage the server.

On the windows 8 computer (laptop) i run mine craft and connect to the server USING its static IP now from this computer i can access the files on the desktop and put plugins ect into the server folder on the desktop from my laptop but i am unable to do this for commands

Is there a way of doing a sah or like ssh connection to allow me to send commands from my laptop and enter them into the desktop cmd like i have typed it in on there thus allowing me to remotly control the server from my laptop? (Same basic principle as my laptop communicating to my raspberry pi threw ssh

It would e good to know if this is possible or not and if it is possible how would i do it what is stopping you from installing an ssh server on your windows 7 computer?PSexec will allow you to run command line or batch files from ONE PC to another.Squashman i tried and the service wont start ao i cant even test it

Also it needs to work even if the cmd promt is already open?

7858.

Solve : ftp over LAN?

Answer»

Is there a better way to transfer files over land via command line than ftp?
I have two computers that are in SEPARATE rooms, and they both need to have exact copies of files on them. They are currently connected via a router (without internet access if that MATTERS). Any HELP would be appreciated.Robocopy will keep a mirror copy of a folder or a folder tree.

FTP is used more for remote computers on a WAN, while a LAN can use many tools.You can use a syntax like this:

robocopy "\\server1\shareabc" "\\server2\sharedef" /switches /here

or

robocopy "\\192.168.1.20\share" "\\192.168.1.21\share" /switches /here


and the double quotes are optional if your server\share name is alphanumericI regularly back up my music collection (which has reached 24.5 GB of mp3 folders) using Robocopy. The collection lives on an internal hard drive (Drive D: under a folder CALLED Music) on my main PC, and the backup is to my NAS drive which is connected to a router (Mapped to drive letter V: with a folder called \Shared\Music). I add new folders to D:\Music and I run this command to MAKE the new folders and files appear in the backup:

robocopy "D:\Music" "V:\Shared\Music" /S /xc /xn /xo

Only the new folders are copied
Thanks a ton! Worked wonderfully.

7859.

Solve : Find Drive letter for program files (86)?

Answer»

So this would give me a better ida then...

Code: [Select]@echo off

Set RegQry=HKLM\Hardware\Description\System\CentralProcessor\0

REG.exe Query %RegQry% > checkOS.txt

Find /i "x86" < CheckOS.txt > StringCheck.txt

If %ERRORLEVEL% == 0 (
Echo "This is 32 Bit Operating system"
) ELSE (
Echo "This is 64 Bit Operating System"
)

pause

Quote

HKEY_LOCAL_MACHINE\Hardware\Description\System\CentralProcessor\0
Component Information REG_BINARY 00000000000000000000000000000000
Identifier REG_SZ Intel64 Family 6 Model 58 Stepping 9
Configuration Data REG_FULL_RESOURCE_DESCRIPTOR FFFFFFFFFFFFFFFF0000000000000000
ProcessorNameString REG_SZ Intel(R) Core(TM) i3-3110M CPU @ 2.40GHz
VendorIdentifier REG_SZ GenuineIntel
FeatureSet REG_DWORD 0x3d193fff
~MHz REG_DWORD 0x95b
Update Revision REG_BINARY 0000000015000000
Update Status REG_DWORD 0x7
Previous Update Revision REG_BINARY 0000000015000000
Platform Specific Field 1 REG_DWORD 0x10
You can just do this

Code: [Select]@echo off
Set OSBits=64
IF %PROCESSOR_ARCHITECTURE%==x86 (
IF NOT DEFINED PROCESSOR_ARCHITEW6432 Set OSBits=32
)
Echo Operating System is %OSBits% bit
Salmon, could you explain "IF NOT DEFINED" please. I searched and I cant really find anything on it. Thanks! Also I added Foxidives code to SAVE to temp and it works well. Thanks for that code as well Foxidrive!!

Code: [Select]@echo off

Color 2A

Set OSBits=64

del "%temp%\64bit.txt" 2>nul

IF %PROCESSOR_ARCHITECTURE%==x86 (
IF NOT DEFINED PROCESSOR_ARCHITEW6432 Set OSBits=32
)
Echo Operating System is %OSBits% bit do >"%temp%\64bit.txt"
echo.You can use an IF test to see if a variable is "defined", i.e. if it has been declared, either by a SET statement or by the system (like %username%, ETC) The test is IF DEFINED variablename command. As with all IF tests you can test for the opposite (if it has NOT been defined) by inserting the word NOT after the IF KEYWORD. That variable only exists in a 64 bit session on a 64 bit system. Thus if it is not defined we might not have a 64 bit system.

(You did know you can look all this kind of thing up on the web?) Type if defined batch into Google.
Quote from: Salmon Trout on February 11, 2013, 03:47:14 AM
(You did know you can look all this kind of thing up on the web?) Type if defined batch into Google.

Yes I did a google search PRIOR to asking. I think by searching the entire phrase gave me limited results. Thanks again!

Quote
Salmon, could you explain "IF NOT DEFINED" please. I searched and I cant really find anything on it.

7860.

Solve : Batch file to execute a variable?

Answer»

hope you guys can help me.....

here's a sample of what i like a batch file to do for me

cd {dir}\{folder}\{folder}
{execute a program} (dos program)

based on the executed program there is a VARIABLE (not constant)value like this:

name = 1234
name = 3456
name = 4567
name = 67890

what i would like the batch file is to get that value and there is a command to execute it, for example:

{command} 1234
{command} 3456
{command} 4567
{command} 67890

exit


this is for msXP...

thanks in advanceIf this is an example of clear, concise thinking then I fear for the future. What is driving what in this scenario? Does the name variable determine which command gets run or does the command determine which variable gets used?

Perhaps you could explain more. After you enter your batch file name, what do you see happening? Will you be passing variables along the command line or would you prefer to see a menu with the commands as options? Or would you prefer to see the name variables on the menu?

Let us know. LOLS, it just happened that i have a just a little bit of knowledge from DOS, my problems is those complex ones like this....

well, all i need is to get the value of the name var to manipulate it....in other programming languages as far as i know there is a command "get" (meaning to get the value of a variable), i know the logic but i dont know how i can do the result im thinking....

here's the full process:

i know you have heard/used of the proggy named FU Rootkit, which is a dos prog, it will display certain processes in your comp like services,system (which is not constant)... then you can hide this processes by typing a command then the value of the said process....for example: the value of services is 4 then you have to enter fu -ph 4 to hide the services process and so on...

what i want is to automate the whole process thru a batch file....is this possible? ThanksI was not familiar with this rootkit program and my research turned up pages mostly in German (I think it was German). In any case the logic is pretty much the same in any language.

Code: [Select]
set /p name=Enter Process ID
cd {dir}\{folder}\{folder}
fu -ph %name%


Hope this helps. ok, thank you very much....i know the set command will WORK here but there's something missing and i cant get the result i WANTED...

so here's a more in depth explanation for this....thanks for your patience......


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\xxxxx>cd desktop

C:\Documents and Settings\xxxxx\Desktop>cd rootkit

C:\Documents and Settings\xxxx\Desktop\rootkit>cd fu

C:\Documents and Settings\GameZone\Desktop\rootkit\fu>fu -pl 500

Process: fu.exe:2868

Process: System:4
Process: SMSS.EXE:460
Process: CSRSS.EXE:516
Process:
Process: SERVICES.EXE:584
Process: LSASS.EXE:596
Process:
Process:
Process:
Process:
Process:
Process:
Process: cmd.exe:1616


all i need is the number on the right next to the process id....example 4,460,516......(but this numbers are NOT constant, it changes everytime the whole process is repeated)

on my batch file i can only go this far, displaying this...the next procedure should be to type

c:\\\fu -ph 4
then
c:\\\fu -ph 460
then
c:\\\fu -ph 516

then when all is inputed will just exit the cmd....


it looks simple but im having a hard time because of the value of process id is variable....what should i do??? is it possible to do this in DOS or it needs some other prog languages?....thanksoh, by the way.... it should not have user inputs...it shoud only be based on the command fu -pl

thanks againNo user input. Hmmm.

Code: [Select]
@echo off
cd \desktop\rootkit\fu
for /F "tokens=1-3 delims=:" %%a in ('fu -pl 500') do (
if %%c GEQ 1 fu -ph %%c
)


If the PIDs are moving targets this may produce unpredictable results.

Good luck. This may or may not help, but I was troubled for MANY hours with a returned variable not being as expected, my solution was the to include commands:

setlocal enabledelayedexpansion

if defined RTV2 echo RTV2 is defined as !RTV2!

endlocal

I hope this is of help.

7861.

Solve : loop through text character by character?

Answer»

Quote from: Lemonilla on FEBRUARY 12, 2013, 02:40:35 PM

I wrote it in Batch, as that is my most knowledgeable language, and the one I am most comfortable working with.

It's time to UPGRADE your KNOWLEDGE. That is the next logical step for you.
7862.

Solve : Trying to install WIN98 from Dos & having issu?

Answer»

Okay, I got an HP from a friend of mine that they had wiped out because they had caught a virus. I am trying to install Windows 98 onto the computer from the CD Rom and I keep getting all these errors. the latest one said that I NEED to create an MS Dos boot partition to set up windows. Any ideas? The only things I have found is that I need to either disable Floppy Boot protection in the EZ Drive;& have no idea how to do this........ Or Disable the LANtastic Server or SuperStore Compression; again no idea........... Would APPRECIATE any advice/help.The easiest way is to enter bios & set your cdrom as the 1st boot device then boot your computer with the win98 disk in the cdrom.
Then follow the onscreen directions.What if I can't even get to the Bios. This is really frustrating and I am sooooooo not an expert.Hello Annie - sounds like you are in a real tizzwazz.

Because you don't seem to be at the knowledge level to go poking around in Bios I suggest you follow the ideas below. I assume from your post that you have both a floppy drive and a cd drive and that both are in working order. Bios is hopefully set to boot first from the floppy.

1. On a working pc goto http://www.bootdisk.com/ and download to the hard disk the bootdisk Windows 98se Custom no RAMDRIVE. The file you download should be named Boot98sc.exe.

2. Put a clean formatted floppy disk in drive A: (should be the floppy drive) on the working pc. Find Boot98sc.exe on the hard drive and click on it. This will create a Win 98 bootdisk on the floppy disk in A:. When creation is complete remove the floppy disk, write protect it, put it into your HP floppy drive and boot the pc. The pc will be booted into Dos and a cdrom driver named BANANA & with a drive letter of R: will be loaded (yes - drive R: - not D: or E: or F: etc.)

3. At the A: prompt put your Win 98 cd into the drive, type R:\setup and if all is WELL you should be able to follow the on-screen prompts to load Win.98

Note that during installation you may need another floppy disk to create a Startup-Disk.

If you keep getting the message you posted about missing MS-Dos boot partition you may have to use Fdisk then Format to create the partition. Heaps of info about these two are available on the WWW.

Good luck - come back if you need a bit more help.

7863.

Solve : How to restore a PCBACKUP.001 file dated 1990??

Answer»

Hello word.
I ant to restore a PCBACKUP.001 file dated 1990.
Please did you succeed to restore your file?
If yes, please tell me how you operated?
I THANK you.
regards.I'd use the "original software" that created it and use that software to restore it. If you can import the file and the backup utility to a virtual environment, you can restore it to a virtual space on your computer, and then copy it out of this virtual space if needed etc. Usually there are more than 1 disk that make these backups such as a disk with PCBackup.002, and then .003, etc in a spanned backup where files greater than 720k or 1.44mb are spanned across multiple disks. You will need all the disks of the spanned backup to probably get your data from 1990.

I haven't had to recover anything this OLD before from a backup file, usually data I am dealing with of this period are on disks that have aged and have corruption in which I use a utility like GETDATABACK to sweep what can be read off the disk and copy it to healthy hard drive to try to get whatever is not trashed off the disk that has aged and lost its magnetic signature over time etc.In the past I backed up a drive using PC tools suite and when it came to restore it the version of PC tools had to be the same release.

I mention this because if you use a DIFFERENT release then PC tools can't read the backup archive.



(I think it was PC tools that I used for this process - it was a very long time ago now)According to the year i wrote the floppy, i think i used PCbackup from PCTools 5 (1988).
I tried PCtolls/PCbackup 6.0, it does PCBACKUP.001 file but do not recognize my PBCALUP.001 file.
So i want to test the earlier PCtools 5.

Please, if you have this software, can you send to me a copy in rar or zip format??
There is non need of booting floppy.
I thank you.
Regards.

email address deleted by AllanRequesting copyright software for free is against forum rules.

7864.

Solve : Pausing after "every screen"?

Answer»

I have Borland freecommandlinetools bcc32 but when i run it all of the output text scrolls to up fast after i run this and i cannot read this. I can SEE only half of output text, same problem with ilink32. I want to pause the program output, like it waits for keypress and then outputs/scrolls second half of output. I tried using /P and pause command but no luck. It just scrolls up this all and i cannot see text from top. I need it to turn off DEBUG information when linking exes. I remember i used some command for one app to do this but i don't remember what. Or if u know where to get full list of bcc32 and ilink32 command line options then please let me know.

Im using WINDOWS 95, i know i can scroll back/up in XP console window to see them but not in Windows 95/98.

Any hints or TIPS are welcome.Try piping it through the more command.Solved: bcc32|more
Thanks for reading.
Now I am smarter

7865.

Solve : PC TOOLS/PCBACKUP restore?

Answer»

Hi,

i have a lot of data backed-up with some DOS utility from 1991 to 1993. Every disk CONTAINS only one file PCBACKUP.00x (PCBACKUP.001, PCBACKUP.002, etc.) and NO other file. The names of the files led me to the Central POINT PC tools Backup utility, but it doesn't work. When i tried to make a test backup (with v6 a v9) the disks contains ANOTHER supplementary files (PCBACKUP.dir & PCBACKUP.inf) which looks like, that contains INFO about the original structure. Could some of you help me how to restore the backups?

The utility you need is most likely from MS-DOS 6.22 which was released about 1994.
That format might not be the same. What date is on the files?
The dates on the files are ranging from '91 to '93. Why do you guess that the utility is from MS-DOS 6.22?MS-DOS releases

MS-DOS 1.0 1982
MS-DOS 2.0 1983
MS-DOS 3.0 1984
MS-DOS 3.2 1986
MS-DOS 3.3 1987
MS-DOS 4.0 1988
MS-DOS 5.0 1991
MS-DOS 6.0 1994
MS-DOS 6.22 1994

Poprafka, you wrote on the Computing.net forum on June 29 that you had used MS-DOS 6.22 between 1991 and 1993. Since MS-DOS 6.22 was not released until April 1994, this is impossible.
I have used PCTOOLS v6 installed on MS-DOS 6.22 for a test backup ONLY, when i was trying to find out which software has been used to back up the data. Today I already know that it has been done USING the PCTOOLS v6 (i run it under MS-DOS 5), but i still can not open the backup backup archive without the supplementary files. Is it possible that the function of the same program is different running in different version of MS-DOS? ..i don't think soIf you do not have the catalog disk (the final disk of the set) yo cannot recover the backup.

hello poprafka.
I have the same problem with a PCBACKUP.001 file.
Please did you succeed to restore your file?
If yes, please tell me how you operated?
I thank you.
regards.You are responding to a 2 year old thread. If you have a question or need help I suggest you start your own thread.Beril,

unfortunately I did not succeed, hope you'll have more luck. Please let me know, if you find a solution.

thanksHello poprafka
I succeed (a week job)
I use Central Point for windows R2 for win 3.1 with an old 486dx motherboard/cpu.
So it was not easy.
If you want, i can restore your floppy(s) before I throw all the old equipment.
Regards.

Hi beril,

that's great, congratulations! I' d be very happy if you could try to open also my data. I'll send it to you via PM.

thanks for help

7866.

Solve : MS-DOS prompt?

Answer»

I am running XP home on a DELL pc. How do I get to the MS-DOS prompt?XP doesn't have TRUE DOS. It has a DOS emulator.
start/run/command or start/run/cmdOr go to Start/All Programs/Accessories/Command Prompt.

And it does WORK just like DOS. It's PROBABLY Version 5.1 like mine

7867.

Solve : batch read character from text..?

Answer»

hi
first sorry for my bad english...

how can i read character from text file with batch,
SOMETHING like this:

:TEXT (example of my text)
hello my
name is

i want read this character for me, like this:
set/p cha=""
if %cha%==2 [then show me second word, like "e" character of hello in first line,
and "9" show me only "n"...]

tnx

I created a hello.txt file with the two lines you posted and used it as input. The script converts the two lines of hello.txt into a single data stream. This allows character 9 to resolve to 'n'.

hello.txt
Code: [Select]hello my
name is

Code: [Select]@echo off
setlocal enabledelayedexpansion

for /F "tokens=*" %%a in ('findstr /R ".*" hello.txt') do (
set "line=%%a"
set longLine=!longline!!line!
)

set /p chr=Enter Character Position:
set /a chr-=1
call set "shortChar=%%longLine:~!chr!,1%%"

echo %shortChar%

Quote from: behzad-007 on February 17, 2013, 05:16:00 AM

hello my
name is

Some characters will cause problems if your text is more than ALPHANUMERIC. In that case you will need some extra code. Just sayin'Quote from: Sidewinder on February 17, 2013, 11:36:18 AM
I created a hello.txt file with the two lines you posted and used it as input. The script converts the two lines of hello.txt into a single data stream. This allows character 9 to resolve to 'n'.

hello.txt
Code: [Select]hello my
name is

Code: [Select]@echo off
setlocal enabledelayedexpansion

for /F "tokens=*" %%a in ('findstr /r ".*" hello.txt') do (
set "line=%%a"
set longLine=!longline!!line!
)

set /p chr=Enter Character Position:
set /a chr-=1
call set "shortChar=%%longLine:~!chr!,1%%"

echo %shortChar%



it's WORK!
tnx
7868.

Solve : Re-config of comp & DOS question?

Answer»

I have stripped the HD of a COMPUTER, and now am in the process of installing 98 SE.

The problem is, the computer is not seeing D: at all.
It does see, a:, b:, and c:.

I have looked at this site for the PAST few hours in hopes of looking at other posts.

Can someone recommend a proper protocol with setting up this computer.

ThanksIf the DISK has been formatted, where is it that you see the a:, b:, c: drives? Are you referring to the BIOS?

You may NEED to get a boot floppy from Boot Disk that will give you CD functionality. At that point you should have ENOUGH of DOS to allow you to install Win98.

Hope this helps.

7869.

Solve : a batch file that regonize a file type?

Answer»

Hello guys,
i have a little question, what code do i need to regonize a specefic file type.
i already TYPED this code:

if not %last_downloaded%=="*.JAR" GOTO something

if you know a code that works, please answere
- lukefor /F "delims=" %%A in ("%last_downloaded%") do if "%%~xA"==".jar" goto somewhereif not "%last_downloaded:~-4%"==".jar" goto somewhere

7870.

Solve : net sending?

Answer»

how can i stop DOS net sending in my classroom? tnx... windows 2000Disable the Messenger service. Control Panel-->Administrative Tools-->Computer MANAGEMENT-->Service and APPLICATIONS-->Services

Look for Messenger in the list. First stop the service, then disable it. If you need to run this on a LOT of machines, it may be HELPFUL to write a script.

Hope this helps.

7871.

Solve : Backup batch?

Answer»

I'm trying to write a little backup script that I can have automatically execute with WINDOWS scheduler. I've got it working, but I'm trying to add some validation in so it'll tell me if it fails or not. It goes a little something like this:

Code: [Select]@echo off

if exist "j:\backup\file (old).avi" (
del "j:\backup\file (old).avi"
set backup = 1) else (
set backup = 0)

if exist "j:\backup\file.avi" ren j:\backup\file.avi "file (old).avi"
xcopy "j:\fraps\file.avi" j:\backup\
if %backup% == 1 suc == ""
if %backup% == 0 suc == "NOT"
echo "File backup was %suc% successful on %time%, %date%"
echo %backup%
problem is, it doesn't work. backup isn't being populated, and it SAYS suc isn't expected.

The goal is to have this be performed on vhd's at 2am, so when i sit down int he morning I'll SEE a couple dos prompts with the status of various vhd's being backed up.

Any help would be appreciated.Quote

if %backup% == 1 suc == ""
if %backup% == 0 suc == "NOT"

You probably mean this

if %backup%==1 set suc=
if %backup%==0 set suc=NOT

Spaces matter in batch. ALSO you don't seem to understand the use of quotes. Batch language is not BASIC - you don't need to use quotes when assigning a string to a variable, unless you want the quotes to be part of the string.


7872.

Solve : Delete folders older than x days but preserve the most recent ones?

Answer»

Hi there,

I'm trying to write a script that deletes directories older than 10 days but also keeps the most recent (7) folders.
I can't seem to find the right mix of commands for this ONE... Any help?

THANK youWhat do you have so far ? ?I think I sort of fixed my script, SEEMS to do what I want...
Not exactly as I described, but it fits

Code: [Select]for/f "tokens=*" %%G IN ('dir \\server\data\ /b /AD ^| find "" /v /N /c ') DO set value=%%G
if %value% LSS 14 goto dontdelete

for /f "tokens=* skip=14" %%a in ('dir \\server\data\ /A:D /O-D /B ') do set deldir=%%a
rmdir /s /q "\\server\data\%deldir%"

:dontdelete

7873.

Solve : Closing applications using dos?

Answer»

if at all POSSIBLE can i close already running applications from dos?other than dos

ctrl+alt+del keysthanks but...
what im trying to do is script a batch FILE that does that for me (closes out off annoying these annoying processes so i dont have to)How did you end the bat file!i havent made it yet because i dont know the command to close other programs outclsi cant get it to work
can you give me an example or show me the cls in use?
i can only get it to clear the command pageCan you supply more data/info on the question you have ASKED:

Also system operating system,and what are you trying to bat files/~?I'm FAIRLY NEW to bat files, but from what I understand its a list of dos commands that are scripted together. But i may be wrong.

What I'm trying to do is script a bat file that when executed can end the files specified in the bat file. The problem is I don't know if there is a dos command that can remotely close other applications or if I'm going about it all the wrong way.

I don't know if it makes a difference but I'm using Windows XP ms-dos ver [5.1.2600]http://www.robvanderwoude.com/index.html

7874.

Solve : DOS COMMAND FOR WINDOWS 2000?

Answer»

Hi All

Hope to get some help! I installed a copy of Windows 2000 as an upgrade to Windows 98, it wasn't working very well, so I installed it again as a fresh copy. I thought that would ELIMINATE the first copy, but it didn't.

So now when I start my machine, it says I have two copies of Windows 2000. I want to delet the one I'm not using. I was told by a techie friend to go to the Directory file in DOS and delete one copy. I've tried and I can't get to the directory file.

When I run command, I get DOS, but it says C:\DOCUME~1\HYRDEL0>, not C:\.

Can anyone help?



Thanks,

Sue MTo get into a directory, USE the cd command: CD \

Do you have a lot of stuff on your disk that you need to keep? If not it may be easier to format the disk and reinstall WIN2000 from scratch. As I recall Win2000 asks if you want to reformat and what file system to use.

Let us know. Hi,

Thanks for responding. I tried that. When I tried to re-format, I got a message saying system is in use cannot format at this time, both in DOS and in Windows.

Any SUGGESTIONS?

Thanks

Sue M.
You can't format a disk that is using windows. as someone recently said, "It's like asking windows to cut it's own throat". Or something like that.
W2k is bootable so stick it in your cdrom, set your bios to boot to the cdrom and you can format as part of the fresh install.
Other than that, to get from C:\DOCUME~1\HYRDEL0> to C:\ you should learn some DOS basic commands.Info link:>http://labmice.techtarget.com/windows2000/diskmgmt/default.htm

7875.

Solve : If exists errorlevel 9009 not expected?

Answer»

Hello, I'm trying to create a simple BATCH file that CHECKS to see if the file exists and then checks the errorlevel to see if it's open or not before proceeding. When I attempt to use the commands below I get the errorlevel==9009 when the file exists and is open or not and I'm not SURE why.

:loop
IF EXIST T:\apps\sales\hostdata\ddmartpbk.dat
if %errorlevel%==0 goto :run
if %errorlevel%==1 goto :loop

:run
Copy T:\apps\sales\hostdata\ddmartpbk.dat D:\ddmartpbk.xxx
Del T:\apps\sales\hostdata\ddmartpbk.dat

Thanks for your help...

The line starting IF EXIST is incomplete. You have not written a complete test. The syntax for IF is

IF [test] [command]

There is no [command].

You maybe meant this

:loop
IF EXIST T:\apps\sales\hostdata\ddmartpbk.dat goto run
goto loop

or this

:loop
DIR T:\apps\sales\hostdata\ddmartpbk.dat >nul
if %errorlevel%==0 goto run
goto loop

or even this

:loop
DIR T:\apps\sales\hostdata\ddmartpbk.dat >nul && goto run
goto loop

but I am not sure what you mean by "checks the errorlevel to see if it's open". What errorlevel? The errorlevel will be 0 if the file exists, and 1 or more if it does not exist. You will not get an indication if the file is "open" that way.


Thanks for the reply...

Yes my code should have read..

IF EXIST T:\apps\sales\hostdata\ddmartpbk.dat goto run

As you can see I'm not that familar with the dos batch commands and I'm trying to FIGURE out how to make this batch process work so I'm open to any suggestions on how to get this done.

I'm trying to write this batch so when a large file is being written to a network disk from another system and my batch script which is running on another system process's the IF EXIST command from above that it doesn't try to do anything with the file until it's done copying.. So I was trying to figure out an errorlevel if the files open at that time and just put the process into a loop until the file is CLOSED..

I hope the makes sense..

Thanks again for your time..if a file is open you cannot rename it so you could test in a loop until success and then rename it back again

7876.

Solve : Shutdown the XP machine via batch file?

Answer»

In order to reduce electricity consumption, I wanted either to shut down the system and save the files before shutting it down.
Since, i am working in 2-11 shift, I am planning to use Windows Scheduler to process my batch file.

For shutting down, I had written some code as:

@ECHO OFF
:START
SET /p sd=Your system will be shutdown at 11:30 PM. Please save the unsaved files [y or n]:
IF "%sd%"=="Y" GOTO:SHUTDOWN
IF "%sd%"=="y" GOTO:SHUTDOWN
IF "%sd%"=="N" GOTO:EOF
IF "%sd%"=="n" GOTO:EOF
ECHO Incorrect Answer... Please Try Again
PAUSE
GOTO:START
:SHUTDOWN
c:\windows\system32\shutdown -s -f -t 120

The problem is that if I lock the system and leave for the day around 10 PM without SAVING my files and the scheduler will shut it down at 11:15 PM, how would it save the files and the pages opened in the browsers. I don't want to LOOSE any data through this. Please guide me.

Thanks.
Don't use the -f to force the shutdown perhaps - that may not shut down the MACHINE if you left unsaved programs open.

I googled a command to hibernate and FOUND this command, if hibernation is enabled (untested): %windir%\system32\rundll32.exe PowrProf.dll, SetSuspendStateThanks for the quick reply.

But if I have locked my system without saving the files and I am out of office, I want it to automatically save it and then shut it down. If we don't force it to shut down, I don't think so that it will save them and shut it down. what do you say?Quote from: hemantbarmecha on February 06, 2013, 10:26:18 AM

I want it to automatically save it and then shut it down.

You cannot do this generically. How saving is handled depends on the program. Hibernation is the only alternative if you want to be able to restore state.I don't see hibernate option in Power Options folder. Any WAY out to make the pc go hibernate?Here's the batch file source:
pause
echo 1
shutdown /s /f
echo 2
Yet the file seems to loop at the shutdown command. Here's the output from the batch file:
C:\Documents and Settings\Kiley\Desktop>pause
Press any key to continue . . .
C:\Documents and Settings\Kiley\Desktop>echo 1
1
C:\Documents and Settings\Kiley\Desktop>shutdown /s /f
C:\Documents and Settings\Kiley\Desktop>pause
Press any key to continue . . .It's highly probable that you called the batch file 'shutdown.bat/cmd'

Rename it to something else.
7877.

Solve : Very frustrated.?

Answer»

Is there ANYWAY in which to "start" a WINDOWS application using dos?

EX: firefox.exeWhat o/s.........windows xpAt the command prompt (or in a .bat file) ENTER the path\filename.

This works for me:

"d:\program files\mozilla firefox\firefox.exe"

The double quotes are needed because of the spaces in DIRECTORY names.

Good luckWhat would be the purpose of this!

7878.

Solve : random character between every word in set /p?

Answer»

hi

i want something like this:

set/p pw="your pw: "
{example user input 511}
now i want set random character between every word..
like this:
5%random%1%random%1

tnxDo you mean you want it on the SCREEN where the user has typed it, or in a variable?

Do you want one random character or more between each letter?
Do you want alpha or numeric or both?The nice thing about having a snippet closet is not having to ACTUALLY WRITE scripts, just assemble them from previous masterpieces!

As foxidrive pointed out, your post is a bit short on details, but based on this

Quote

now i want set random character between every word..

this little snippet should help:

Code: [Select]@echo off
setlocal enabledelayedexpansion
set /p var=Enter PW:
set string=%var%

:length
if defined var (set var=%var:~1%& set /a length+=1 & goto length)

set /a length-=1
for /l %%i in (0, 1, %length%) do (
call set chr=%%string:~%%i,1%%
call :random
if %%i EQU !length! (set outline=!outLine!!chr!) else (set outLine=!outLine!!chr!!rnd!)
)

echo %outLine%
goto :eof

:random
set intLowNumber=0
set intHighNumber=9
set /a rnd=%random% %% (%intHighNumber% - %intLowNumber% + 1) + %intLowNumber%

I limited the random number to one character but that can easily be changed within the :random routine. The %random% variable only outputs NUMBERS so if you need random alpha characters let us know (no extra charge).



Quote from: Sidewinder on February 18, 2013, 08:43:17 AM
The nice thing about having a snippet closet is not having to actually write scripts, just assemble them from previous masterpieces!

As foxidrive pointed out, your post is a bit short on details, but based on this

this little snippet should help:

Code: [Select]@echo off
setlocal enabledelayedexpansion
set /p var=Enter PW:
set string=%var%

:length
if defined var (set var=%var:~1%& set /a length+=1 & goto length)

set /a length-=1
for /l %%i in (0, 1, %length%) do (
call set chr=%%string:~%%i,1%%
call :random
if %%i EQU !length! (set outline=!outLine!!chr!) else (set outLine=!outLine!!chr!!rnd!)
)

echo %outLine%
goto :eof

:random
set intLowNumber=0
set intHighNumber=9
set /a rnd=%random% %% (%intHighNumber% - %intLowNumber% + 1) + %intLowNumber%

I limited the random number to one character but that can easily be changed within the :random routine. The %random% variable only outputs numbers so if you need random alpha characters let us know (no extra charge).





thanks sooo much
that exactly what i wanted!

one more question:

Quote from: foxidrive on February 18, 2013, 05:30:54 AM

Do you want alpha or numeric or both?
how can i add alpha random character?
tnxAs seen on TV:

Code: [Select]@echo off
setlocal enabledelayedexpansion
set chrTable=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
set chrCount=52

set /p var=Enter PW:
set string=%var%

:length
if defined var (set var=%var:~1%& set /a length+=1 & goto length)

set /a length-=1
for /l %%i in (0, 1, %length%) do (
call set chr=%%string:~%%i,1%%
call :random
if %%i EQU !length! (set outline=!outLine!!chr!) else (set outLine=!outLine!!chr!!rnd!)
)

echo %outLine%
goto :eof

:random
set /a offset=!random! %% chrCount
call set rnd=%%chrTable:~!offset!,1%%

All the action takes place in the :random routine using the chrTable. The chrTable contains all the characters you want to INCLUDE for processing and the chrCount variable is the count of those characters. For example, currently the chrTable contains all the upper and lower case alpha characters and the chrCount is 52. If you want to include the digits 0-9, add them to the chrTable and increase the chrCount variable to 62. You can use any combination of characters you want, just be sure the chrCount variable is set correctly. Do not use special characters in the chrTable; many of them are used by the cmd interpreter and can and will create unexpected results.

thanks
7879.

Solve : Install SMC1211TX Network Driver in MS-DOS 6.22?

Answer»

Hi, I have a K6-II 400 computer with MS-DOS 6.22.
I need install a network driver for ethernet card SMC1211TX for play old games in network.
I have downloaded the official driver at http://www.smc.com/files/AR/DR_SMC1211TX_all.zip but I can not install.

There are 2 files: DR_SMC1211TX_all\MSLANMAN.DOS\DRIVERS\SMC\SMC1211\SMC1211.DOS and DR_SMC1211TX_all\MSLANMAN.DOS\DRIVERS\SMC\SMC1211\SMC1211.ini

How can I install the MS-DOS drivers for ethernet?
Thanks for helpingthe release.txt file REFERS to
the text file for INSTRUCTIONS to install the driver is in the DIRECTORY \NDIS. (Lanman.txt)

this is MISSING, you should direct your enquiry to smc.com -- they might be able to dig this file out of their ARCHIVE

7880.

Solve : Using Batch file to execute files from a CD?

Answer»

Hi! This is my first time creating a batch file so this might be a really dumb qs (applogies)

I have created a batch file which will start other exe files but all these are on a CD (for distribution purposes)

In my case my (CD drive is the E drive) so thats the path i defined but this may not be the case for the person using my application.. is there a general word that can be used example CD Drive or something

Secondly i want to execute files in the C drive which get installed after the Setup.Exe has been run (in this case it is Hello.exe) but when i run the bat file I get an error.

Here is the CODE
START E:\Setup.Exe
START C:\Program Files\Hello.exe


Any HELP would be greatly appreciated.
Thanks


I am not AWARE of any variable you can use to direct input from a CD drive, however this little script may help you out:
Code: [Select]
Dim fso, d, dc
Set WshShell = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Set dc = fso.Drives
For Each d in dc
If d.DriveType = 4 Then
WshShell.Run d.DriveLetter & ":\Setup.exe",,True
WshShell.Run "c:\Program Files\Hello.exe",,True
End If
Next


Note: the script is not idiot proof. It will find the first CD/DVD drive on the system. If a system has multiple CD/DVD drives, it becomes problematic which one to choose. Save the script as a VBS file and run it.

The second problem is easier. Use the /wait switch with START to have the batch file hang around until a process is finished.

start /wait e:\setup.exe

Hope this helps.Thanks for the reply. The 'wait' part seems to work fine, the only prb is that it is not executing the lines after the wait statement...i am trying to debug that and make it work.

As for the CD Drive. thanks for the code. But I was thinking that I should just place both the .bat file as well as the setup.exe in the same folder and in this way it will call it without the having to DEFINE the path.
Am I right in saying that or is that not possible

ThanksIf you are going to do that, then why not just create an autorun.inf file on the CD:

[autorun]
OPEN=path\setup.exe

Note: the autorun.inf must go in the CD root DIRECTORY otherwise it will not be found.

I'm not sure why the /wait did not return control when the setup finished. You could try adding the /b switch to prevent a separate window from opening. Check out all the START options by running start /? from a prompt.

7881.

Solve : BAT file for Barcode Scanner (Accept input and place it into specific window/app?

Answer»

I'm looking to implement a barcode scanner at my current JOB. However the software that came with it isn't helpful when it comes to pointing the input in the right direction.

I need a BAT file that will be triggered by only 1 COM port (USB).

As of right now when I scan something it just enters the input as if it were typed on the keyboard. I just need to direct it to the correct window/application and have it press enter.

This may be too complicated for a BAT file and maybe another language would be more appropriate. Any insight is appreciated!

Thanks in advance. Zach
Batch files can't be 'triggered' by a com port signal.

Maybe if you explain a bit more we'd understand what it is you want to do. It's a bit hazy atm.I'm sorry for the confusion let me try and break it down a little better.

I have a barcode scanner attached via USB to a Windows 7 PC.

Right now: Whenever a barcode is scanned (Sales Order Number) it types in the number or value that it scanned to whatever window is active at the moment in Windows. (Word, Internet Explorer, Outlook, whatever is opened and active)

What I need: I'd like to direct any input from the scanner, no matter what window is active at the moment of scan, to a specific application: UPS OZ Link. (Shipping Software)

Lastly I'd like it to automatically send an Enter keystroke to submit the value that has been scanned and added to OZ Link.

I hope this helps!Quote from: Zachareasy on February 27, 2013, 02:27:10 PM
What I need: I'd like to direct any input from the scanner, no matter what window is active at the moment of scan, to a specific application: UPS OZ Link. (Shipping Software)

Unless the scanner software supports COMMAND line switches, or configuration changes, to direct the output, then this can't be done when you are actively using other applications. The active window is the only PLACE the scanner data is going to, according to your explanation.

The software it was BUNDLED with isn't helpful at all. I believe its purpose is to be bundled with a POS system and configured that way. Unfortunately this doesn't help us with what we're trying to do.

I thought I'd ask because I'm not familiar with just how powerful batch programming can be. Thank you for your help I appreciate it!
7882.

Solve : Ms dos error?

Answer»

Hey i understand what you MEAN but could you possibly run me through the REPAIR using windows explorer?Personally I prefer the brute force method of the command line.

Open up Windows Explorer. In sequence, in the left pane, click on My Computer, C drive, Windows. In the right pane, navigate down to the Repair directory and double click to open. Right click on the autoexec.nt file and on the popup menu click copy.

Now click the Back button and still in the right pane, navigate to and right click the System32 directory. On the popup menu click paste. If you receive a "Confirm File Replace" MESSAGE click "Yes".

The copy command I gave you could have been CUT and pasted into a command window. A lot simpler.Thanks, my command file line is SCREWED up so the wondows explorer method was the only way.

7883.

Solve : New to PC's and need to know how to undo a command in DOS?

Answer»

I am knew to computer's and I am in a class that is TRYING to teach me all the ins and outs of pc's.... We're having a test next week on MS DOS, I put in the COMMAND: MD \DOS LABS... and I keep GETTING a response saying that there is already a file under that name, so I put in the command: RMDIR \DOS LABS & now it's telling me the command could not complete because the file cannot be found. Can someone please assist me in getting past this?... Thanking you in advance... try putting the name in quotations, typing 'dir' to make sure the folder EXISTS, escaping the \, and using rd in PLACE of rmdir (don't know if this will make a difference, but it could).Greetings OrlandoE,
Given your example you are making two folders. One name DOS and a second
one named LABS. Type DIR at a command prompt and insure that those are
indeed the folder names that were created. Your RD command in the
example will work provided the folder names are correct.

The better choice, at this point, would be to locate those folders using
Windows Explorer, determine the problem, delete the folders and begin anew
at a C:\ prompt. Remember to use double quotes around folder names that
have spaces as Lemonilla pointed out. Example: "DOS LABS"

Best wishes!If there is a file called DOS LABS then you cannot create a folder of that name in the same location. Also RMDIR will not remove it, but DEL may well do so.

If you have filenames with spaces, is this really MS-DOS?

7884.

Solve : Erased harddrive, can't get DOS prompt?

Answer»

I erased my hard drive using Fdisk, because of some nasty virus and now I can't get a DOS prompt to re install windows 98se. I tried putting the BOOT DISK in and it doesn't read it,( I tried a new one from bootdisk.com also). After I power up it it goes through a couple of screens that seem to be checking vitals and I can get to the SET up screen (CMOS) but after that all I get is a screen that says " press any key to reboot"

can someone please help me?
DaWeeb2Format C: at the a:\> or go into the bios setup and boot from cdom drive.........I can't get to any prompt, it goes right to a blank screen that says "press any key to reboot". One of the vitals screens does say to press "ctrl H" to enter bios set up but does not respond when I press "ctrl H". Also I have tried changing the boot order in CMOS but that does not do anything. CMOS and bios set up are different aren't they?

7885.

Solve : batch file event sounds?

Answer»

since windows XP Pro does not have an event sound listed for the opening and closing of INTERNET Explorer I WOULD like to know if it is possible to create a BATCH file for this purpose. I have a few HAL9000 wav files that I would like to use so I can make my drab pc a little more interesting. My dos skills are on the newbie side but I am willing to give it a try.
Thanks,
aradoYour batch file would have to use a program to play a sound, launch IE, and then play a closing sound. You might be able to use SNDREC32 which comes with Windows. An example using SNDREC32 can be found at: AnnoyTheCat

Note: the example uses CHOICE which does NOT COME with XP but it may give you some ideas.

If you really want to jazz up your drab PC, write a Windows Script and use the Microsoft Agent where you can use animated characters (Merlin, Peedy, Robby or Genie) and synthesized speech.

Hope this helps.

7886.

Solve : format?

Answer»

Hi,

My computer has a virus, and I can no longer use it.

I cannot format C drive from WINDOWS, and in DOS it says the volume is in use.

What COULD I do?

Thanks

PaulaHi Paula

You have to format from an external source. Windows will not let you format the disk that's in use - that's like asking it to commit suicide - Dos is on the same disk so that's in the same position.

Change your Bios to boot first from the cdrom - put your OS cd in the drive and reboot then follow the on-screen prompts

-OR-

Download a Win.98 bootdisk from Bootdisk.com - boot from it then at the A: PROMPT type R:\setup where R: is the cdrom letter.

BUT FIRST - have you TRIED going into Safe mode and running anti-virus progs from there? What virus do you have??

Anyway, what OS are you running, you give very little info!!

7887.

Solve : Batch File To Launch RunAsDate.exe?

Answer»

Hi

Somebody please HELP me! I need to be able to run the attached, 'RunAsDate.exe' using a batch file(s). The help file shows how to do this but I cannot get it to work.

RunAsDate.exe {/immediate} {/movetime} [dd\mm\yyyy] {hh:mm:ss} [Program
to run] {Program parameters}

Examples:
RunAsDate.exe 22\10\2002 12:35:22 "C:\Program Files\Microsoft
Office\OFFICE11\OUTLOOK.EXE"
RunAsDate.exe 14\02\2005 "c:\temp\myprogram.exe" param1 param2
RunAsDate.exe /movetime 11\08\2004 16:21:42 "C:\Program Files\Microsoft
Office\OFFICE11\OUTLOOK.EXE"

My knowledge of DOS/Batch is pretty basic but I have tried all day with this as a line in a batch file, changing various things, searching google etc. The main sticking point seems to be the date and the variables, but if anyone can help me get this command to work that would be great. I would need to be able to set and call the dates/parameters from some other file or process as I'm trying to integrate this into an Access based overnight reporting system, and if required the database time needs to be changed without affecting the windows system time.

Many thanks for any help.

[Saving space, attachment deleted by admin]Maybe you could describe what you are doing, and what errors you are getting, because I just tried it and it worked fine.

I put this line in a batch file and it started Frontpage

Code: [Select]RunAsDate.exe 22\10\2002 12:35:22 "C:\Program Files\Microsoft Office\Office10\FRONTPG.EXE"accessman,
Welcome to CH.
Have you read the documentation?
The example you gave is wrong.If I start it with 'RunAsDate.exe' it does nothing. If I put the whole path to where it is saved inside double quotes, it then seems to get past that to the date as it comes up with a message box saying 'Invalid Date!'. After clicking OK to the message it then just opens 'RunAsDate.exe' as the program itself.

I did read the documentation but I'm only starting to learn these commands and what I know is very basic. The examples were just the examples in the readme file. Maybe I am not reading it right??

To put it all into context, an IT dept have decided they are going to remove admin rights to Windows on the network for all users in the company. For some people this is probably a good idea but they refuse to have exceptions, which for me is insane. For most people they won't know any different but our reporting team RUNS databases overnight and if they crash we still need to be able to change the database time, without touching the windows clock etc. as we will not now be able to.

I hope this helps..

CheersPlease post EXACTLY what command lines and batch code you are using.
At work it's for XP, but Vista at home. Same problems though. Now it doesn't even seem to do anything at all. I'm totally confused. I put the text below into a text file and changed the extension to make it a .bat file.


"C:\Users\Neil\Documents\_Applications And System\runasdate\RunAsDate.exe" 21\10\2009 15:30:05 "C:\Program Files\Microsoft Office\Office11\EXCEL.EXE"I copied the target from a shortcut created by the program into a new text file, renamed it with .bat and it worked first time. It has worked every time since as well. I'm stumped but relieved?!?! Thanks for the RESPONSES anyhow and I hope this thread helps anyone else who needs it. Doesn't make any sense, but hey it has worked..Quote from: accessman on October 22, 2009, 02:28:17 PM

To put it all into context, an IT dept have decided they are going to remove admin rights to Windows on the network for all users in the company.
They're in charge of that for a reason. Are you trying to circumvent their authority?

Explain to them this:
Quote from: accessman on October 22, 2009, 02:28:17 PM
Our reporting team runs databases overnight and if they crash we still need to be able to change the database time, without touching the windows clock etc. as we will not now be able to.
If they don't agree, go up the ladder until someone does. Mate, I know and we're laying it all down and presenting issues and options. Our days of freedom and creativity are being replaced by distant checking and authorisation after a restructure. We are contractors and the setup is deliberately designed so that in the end we have to just get on with it. (Wait until a problem affects the bottom line). It's a recipe for disaster and very difficult to get the seriousness of it across.

It's to ADMINISTER our own databases when we need to and won't affect Windows itself. They are being told about it and will hopefully see sense and agree to it.While you can, now is the time to look into...
getting a new job somewhere else.Already am... in the 1980s I knew a guy who ran a circuit simulator on a VAX mini where he worked, they had to set the system date year back to 1986 because the trial period had run out...Nothing like that going on with this. If it all SOUNDS like b******t it's because it is. The problem, not the solution I might add.. I know that is old.
But is unsolved. So the answer is:
Code: [Select]@ECHO OFF
cd "C:\Users\Neil\Documents\_Applications And System\runasdate\"
RunAsDate.exe /immediate 21\10\2009 15:30:05 "C:\Program Files\Microsoft Office\Office11\EXCEL.EXE"
exit
Past the code on notepad and save as .bat

Tested with:
Windows 7 x64
RunAsDate 1.16 (32 bit)
I'm speechless...
7888.

Solve : How to copy a range of lines?

Answer» THANKS again foxidrive, that routine worked beautifully there's some pretty interesting CODE in that routine that i'm looking forward to STUDYING, so thanks again cos that GOT me kick started good!

Have a great week and thanks very MUCH again!
bk
7889.

Solve : ms dos problems?

Answer»

???if anyone can help please do so. now going on to business. I erased my whole hard disk becuase my computer wasnt startin up and i did the whole format C: /s and fdisk stuff but everytime i start the computer it goes into ms dos and i dont really no what to do from here. when i try to write the down to go to the cd rom DRIVER [D:] the description says no specified driver or something around there. oh and i have TRIED H: and E: letters for the cd rom driver. NEED HELP BAD. I have a windows xp but i dont know what version it is now since i used a windows 98 boot disk . i think its windows 98 since it says that in the ms dos mode. My problem is getting the cd rom driver to work in ms dos since i have the windows 98 cd and getting the computer started into windows explorer. sorry for the long letter but i want to get a good answer so i gotta give a good description. Wow, what a great post...

You used format /s so you transferred the DOS system files (msdos.sys, command.com etc) from the WIN 98 bootdisk to your hdd. Enter A: to return you to the bootdisk command.com. Put your OS cd into the drive and at the A: prompt type R:\setup where R: is the letter allocated to the cdrom by the bootdisk driver.

OR -

Change your bios to start first from your cdrom. Put your OS cd in the drive and re-boot then follow the onscreen prompts.

Note that the cd's must be the full version not an update.

Good luckthanx ill try this and see if it works. but uhhhh.... whats a
os cd or whatever you called it. you guys sure are fast in answering the questions. i usaully dont trust sites like this with the furoms and stuff but you guys have a great site. iahvent been dissapionted yet wich is a good thing and saves me the web searching stuff. thanks alot, keep it up
i tend to write long messeges. its a habit. see wat i meanos cd is operating system cd, in short, your xp disk.
Follow Dusty's ADVICE.the advice you gave didnt work but i checked out the checklists and basic troubleshooting on this site and it worked but now im stuck because the system is asking for a product key and i dont know where it is. Is there someway i can get the product key code from this or other place by looking and telling you the numbers that are found on the cd. Are you using a proper, legitimate, non-pirated version of XP?? If not, I cannot assist you. If your XP is legitimate then have a look around the casing of your pc for a sticker showing the Certificate of Authenticity label, the product key for your cd will be shown there.thanx i GOT the system working and now im in windows.Congrats - thanks for getting back

7890.

Solve : Simple Batch script, help the noob!?

Answer»

I need a simple batch script and opens a program, then proceeds to click a folder and press control+S (control S makes the slideshow start) on that folder that then starts a slideshow with the contents of the folder.

Any help is greatly appreciated I have a Macro Programmer Software application that can create instructions like this very quickly as a stand alone instruction.

Their website states the following, so I guess I could send you a solution in an zip file as the exe that can do this, or you can buy a COPY if you will need to automate other stuff.

Quote

Compile to EXE
Redistributable macros

--------------------------------------------------------------------------------

Convert your macro to an EXE-file that runs on any windows-compatible computer (feel free to redistribute). To SAVE SPACE and improve performance the resulting EXE file is packed and compressed using the advanced optimization techniques.

Here is a link to the software that I use and was well worth the purchase price! * I have used some free ones before, but they were unstable when testing. You would tell it to perform a task and either timing would get messed up or the macro would malfunction and next thing you know your system is out of control OPENING up all sorts of stuff it shouldnt etc and the hotkey to kill it is not accepting input from keyboard etc. I haven't had that problem with this JitBit Macro Recorder like the free ones that are use at your own risk and unsupported. Jitbit is supported, I had to contact them about a minor issue which come to find out was because of my AMD Multicore CPU, and this issue was corrected in a later version which I was able to get a free update download for.

http://www.jitbit.com/macro-recorder/I will give this program a try, thank-you!AUTOHOTKEY should do this quite easily.
7891.

Solve : Print to File?

Answer»

I have a DOS program that PRINTS to an Epson Dot Matrix Printer. Isn't there a DOS COMMAND that I can run before running the program to redirect the output from a printer to a PRN file?

Thanks,

MarkMy printer's not working right, but this should work:

PRINT [filename] > [filename2].TXT

Just try that, and let me know.
You might be thinking of the mode command but I think that was only to redirect print output to a serial COM device (EX. modem).

You might want to try this however:

yourprogram > filename.ext

Hope this helps. Thanks Guys,

I found PRN2FILE.COM whch works closest to anything as it redirects the data from LPT! to PRN. However I haven't been able to get the right file string put together that will write the file. Any suggestions?

Thanks,

MarkQuote

You might want to try this however:

yourprogram > filename.ext


That command will redirect the output of your program to a file. If you want to print the printfile then

PRINT filename.ext

PRN is a parallel port device not a file. Is your Epson a serial printer? If so you can redirect it to COM1 with the MODE command: MODE LPT1:=COM1:

Hope this helps. The following works:

PRN2FILE [filename] [#] [/S] [/X]
where
filename - name of file to save captured data (default: c:\prnspl)
#n - number of LPT (default: #1)
/S - CONVENTIONAL memory buffer size in bytes (default: /S4096)
/X - XMS buffer size in Kbytes (default: /X200)


Thanks,

Mark
7892.

Solve : Cleaning up TREE output to file?

Answer»

Quote

The Tool may have been Karen's Print Directory...
Hmm... I will have to check into that. I know she passed away a few YEARS ago, and her brother is keeping her site online now. It may have been her software.

Her Registry Pruner SAVED my bottom back with Windows Me and a new HP Pavilion 700Mhz Celeron with Roxio 4 orphan registry entries from factory build. POINTING towards the image building department stripping a HIGHER end model that had Roxio 4 for this lower end model.

Sure enough there it is in the list which corresponds with when he had this software. Still going to use the batch that was formed out of the HELP here though which can be altered if needed etc.

http://www.karenware.com/powertools.aspIf the dir list is all you need then fine. but if Karen's tools provide a more extensive amount of info in a searchable format then it could be a better tool. After all, you don't want to process 300 cdroms more than once to get a list that you can manipulate.
7893.

Solve : backup copy?

Answer» COULD you please tell me, how I can easy make a program which WOULD do the backup copy of certains programs / files in my computer. This should be done automaticly. I THANK You in advance! Whole books have been WRITTEN on the topic of Backup/Restore. Check out lessons #13-15 at:

http://www.allenware.com/icsw/icswidx.htm

Get back to US if you have any questions.
7894.

Solve : Need help with DOS sort command!?

Answer»

Hello, i'm trying to do what i THOUGHT would be a simple sort in a ".bat" file on Windows7 ie:

<<<<< ok i just ran this from the command line and it worked, but how to GET this working in a ".bat" file? please>>>>>.

>srt.bat:

sort in.txt /o out.txt

and because this command routine never stops running on my actual data file, i created a simple input file ie:

>in.txt
ef
bc
a
ab

and this runs FOREVER too, so is there something obviously wrong with this command setup i'm using here please?

and when i run on my regular data file i will want to sort on the whole record which is under 4096 characters.

Thanks very much for any assistance on this!
BobKGreetings BobK,
I tested the example you provided and it worked as expected for me using WIN 7. You didn't perchance name your file sort.bat instead of srt.bat did you?

Best wishes!

Yes!!! that's exactly what i did, i called it "sort.bat" not "srt.bat" and when i renamed it to "srt.bat" it works lightning fast! thanks very much Ocalabob! have a great week!

7895.

Solve : can't delete directories in msdos 5.0?

Answer»

recently acquired a "new' system. while TRYING to load win3.1, it stopped in the middle of the load. then TRIED to delete the windows directory but it will not allow me no matter what i try (dosshell or regular). how can i get RID of the unwanted directories without formatting the system?Create a bootable floppy: format a: /s Then BOOT from the floppy. You will have just ENOUGH of DOS to delete fiiles and remove directories.

Hope this helps.

7896.

Solve : how to create file in ms dos??

Answer»

how can i create files in ms dos and then save it or copy it to DIFFERENT location?You can use notepad.
Maybe I do not understand your question.
If you are using Windows 7, you must mean the command line. Do you want to invoke Notepad from a command line?
c:\start notepad
But if you have a very old version of DOS there is an old program CALLED EDIT.
c:\edit

Is that what you want?
you can use the redirect symbols ">" ">>" to create a text file from the output of commands.
you can use "copy con FILENAME.txt" to type a text file directly in the command line window (though "start notepad.exe" is much easier to use)
you can use "Edit FILENAME" (windows XP is the last version to have it I think [don't know about vista])

to copy you use
"copy ORIGINAL_FILE NEW_LOCATION"
to move you use
"move ORIGINAL_FILE NEW_LOCATION"

If your file's path contains spaces, put quotation marks around the WHOLE thing.
example -> 'copy "C:\users\lemonilla\documents\my documents\batch testing stuff\file1" C:\users\lemonilla\documents\bat\file1'

7897.

Solve : Dos placement problem?

Answer»

This isn't really a error message, since the dos problem doesn't affect the program. The problem is the program RUNS about two inches below the top of the screen CUTTING off the bottom two inches of the program. It all functions, but im unable to work them since i can't see them.

Im currently running windows XP, and the program is BASED in old DOS. Any help please? Thanks.[BABBLE]Windows Prompts are very incompatible with most old DOS programs. I'm surprised ANY old programs work on yours. I have about 3 programs for DOS that worked in ME Prompt but not XP Prompt.[\BABBLE] I WOULD run the prompt in full screen, if you aren't already.

Tell me: What is the program (describe it), and why is the top and bottom inch so important?

7898.

Solve : Connect to remote system and download the file?

Answer»

Hi

I WANT to do the following operation in a single windows batch file without any manual INTERVENTION

1. Connect to REMOTE desktop server using IP address, user name and password
2. Stop one of the services in that remote server
3. Download a file from an URL to a specified folder in that remote server
4. EXTRACT the files from the downloaded file to another folder.
5. Start the same services which i stopped at point 2.

This has to be completely automated and no manual intervention is required. I am stuck at the very point itself.

Can anyone please help on this?Sounds nefarious...Yes, it does.

Stopping an antivirus service is not possible for most systems as they self-monitor and restart the service. GOOD thing too.

7899.

Solve : How to delete rows in a file with dos commands?

Answer»

I want to edit a HTML or text file. I want to delete some of the rows in this file and save it in the same directory where it existsDOS has no native commands for file editing. You can open TWO copies of Notepad and load your file into the first one. Highlight the text you wish to delete (atl-x) to cut the DATA out, then paste (alt-v) it into the second copy of Notepad. When you're done, save both files to the same directory.

Hope this helps. Have you tried the Edit utility which comes with just about every version of Win? At the C: command prompt ENTER Edit path/filename. Scroll to the line to be deleted and hit Ctrl+y to delete. After all the deletions hit File then Save to save the amended file USING the existing path/filename.

Take care - once you have deleted and saved using the original path/filename the original file will not be available - maybe you should use Save As...

Good luck

7900.

Solve : BASIC batch commands will not work.?

Answer»

I am working on a WIN7 OS, using notepad++ and INFOPATH 2007. I am trying to do pretty basic things, but I keep getting the error of "WScript.Sleep is not recognized as an internal or externam command, operation program or batch file", when I run the .bat.

I get the same error with any other WScript command as well. Basically I can not get it to do any 'SendKey' functions. Example
WSscript.Sendkey "{ENTER}"

What I have:

@echo off
set WShshell = WScript.Createobject("WScript.shell")
set /p testa=would you like to open a previous InfoPath form? (y/n)
if %testa%==y start "" /w "C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE"
if %testa%==Y start "" /w "C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE"
set WShshell = WScript.Createobject("WScript.shell")
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
exitWscript.sleep is not a batch command, it's vbscript. you can call it by WRITING a vbs file and starting that from batch.Ok what would be the correct method for batch files. And any info on how to write a publish command in a .bat file would be great.You have mixed batch and Visual Basic Script commands and tried to run the mixture as a batch file. That will not work.
on windows 7 (maybe 8, but not before) you can use 'timeout /t xxx' to wait xxx seconds.

You can also use 'ping localhost >nul' to make a delay, but it isn't REALLY a standard amount of time.

if you still want to use Wscript.sleep, you can have
Code: [Select]echo dim a >>slp.vbs
echo a=Wscript.arguments^(0^) >>slp.vbs
echo Wscript.sleep a >>slp.vbs

cscript //nologo slp.vbs %time%
del slp.vbs
you would then replace %time% with the argument you wished to pass to wscript.sleepQuote from: Lemonilla on March 14, 2013, 07:50:56 PM

You can also use 'ping localhost >nul' to make a delay, but it isn't really a standard amount of time.

ping actually is pretty much one second per ping (plus you add one second overall)

This is close to 15 seconds : ping -n 16 localhost >nul
and this is close to 1 minute: ping -n 61 localhost >nul
and this is close to 2 minutes : ping -n 121 localhost >nul

Try this test - my results are below.

Code: [Select]@echo off
echo %time%
ping -n 16 localhost >nul
echo %time%
ping -n 61 localhost >nul
echo %time%
ping -n 121 localhost >nul
echo %time%
pause
16:25:46.23
16:26:01.43
16:27:02.36
16:29:04.14