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.

4651.

Solve : bat help it exits whaen i press 1, 2, 3, or 4please help!!!?

Answer»

@echo off
echo 1 - defrag
echo 2 - calc
echo 3 - notepad
echo 4 - exit

set /p chice=

if %CHOICE% equ 1 GOTO defrag
if %choice% equ 2 goto calc
if %choice% equ 3 goto note
if %choice% equ 4 goto exit

:defrag
call %SystemRoot%\system32\dfrg.msc

:calc
call %SystemRoot%\system32\calc.exe

:note
call %SystemRoot%\system32\notepad.exe

:exit
exit

:question
set /p c=do you want to exit[y/n]?
if /i "%c%" "y" goto end
if /i "%c%" "N" goto clr
:end
exit

:clr
cls
echo if you want to exit type EXIT. a made a mistake but when i press 1 it opens it up and when i exit it goes to the next program and exitsCode: [Select]@echo off
:MENU
cls
echo 1 - defrag
echo 2 - calc
echo 3 - notepad
echo 4 - exit

set /p choice=

if %choice% equ 1 goto defrag
if %choice% equ 2 goto calc
if %choice% equ 3 goto note
if %choice% equ 4 goto exit

:defrag
call %SystemRoot%\system32\dfrg.msc
goto MENU

:calc
call %SystemRoot%\system32\calc.exe
goto MENU

:note
call %SystemRoot%\system32\notepad.exe
goto MENU

:QUESTION
cls
set /p c=do you want to exit[y/n]?:
if /i "%c%" "y" exit /b
if /i "%c%" "n" goto MENU
goto :QUESTION

:exit
call :question
exit

4652.

Solve : Format a CD with batch??

Answer»

Is it possible to format a rewritable CD with a batch file?
Quote from: Fairadir on May 21, 2009, 04:02:31 AM

Is it possible to format a rewritable CD with a batch file?

Format /?Code: [SELECT]Format D:
Assuming your CD drive is the D drive.get cdtools from here:

Code: [Select]
CDTOOLS.EXE is a collection of miscellaneous CDROM tools that perform
functions not covered by the other DOS utilities.

CURRENT functions...
- Display a list of installed CDROM devices
- Display a disc's table-of-contents
- Erase a disc (re-writable discs only)
- Format a disc (re-writable discs only)
- FINALIZE a session/disc
- Load a disc (tray models only)
- Eject a disc



http://goldenhawk.com/download.htm
Quote from: macdad- on May 21, 2009, 06:17:42 AM
Code: [Select]Format D:
Assuming your CD drive is the D drive.

Thanks
4653.

Solve : How to save values in your game??

Answer»

please i need any way to make the users can save the game

for example:

i need to make option in the game "press 1 to save and exit"
if the user pressed 1 .. i need the game saving the values
and if he start the game again i want the game start from his saved point

ThanksContact the SUPPORT department of the creator of the game.

goggle [ " The game name" ] to find the home site for the game.
Code: [Select]D:\batch>set $score=100&set $hitpoints=80

D:\batch>set $
$hitpoints=80
$score=100

D:\batch>set $>savegame.txt

D:\batch>type savegame.txt
$hitpoints=80
$score=100

D:\batch>set $hitpoints=&set $score=

D:\batch>set $
Environment variable $ not defined

D:\batch>for /f "tokens=*" %a in (savegame.txt) do @set %a

D:\batch>set $
$hitpoints=80
$score=100
study this, and you will get the idea
to save game current state: set $>savegame.txt
to load game state: for /f "tokens=*" %a in (savegame.txt) do set %a
Sorry, I didn't got it

Look!

This is the batch game

Could someone make me an option name "Save and Exit"

And if the user Choose it .. i need the game saving the values
and if he start the game again i want the game start from his saved point

Thanks


Quote

@echo off
color f0
:MUSIC
cls
title Music
echo Which genre of music do you want to listen to?
echo .
echo Rock ?
echo Techno ?
echo Electro ?
echo Metal ?
echo I don't want to listen to music...
set /p option=
if '%option%'=='Rock' goto :ROCK
if '%option%'=='Techno' goto :TECHNO
if '%option%'=='Electro' goto :ELECTRO
if '%option%'=='Metal' goto :METAL
if '%option%'=='Idon'twanttolistentomusic' goto :LEAVE

:ROCK
cls
title Rock songs (Music)
echo From which ARTIST?
echo.
echo 3 doors down
echo or... go back?
set /p option=
if '%option%'=='3doorsdown' goto :3DOORSDOWN
if '%option%'=='goback' goto :MUSIC

:3DOORSDOWN
cls
title artist : 3 doors down (Music)
echo Which song do you want to listen?
echo.
echo Kryptonite
echo or... go back?
set /p option=
if '%option%'=='Kryptonite' start Kryptonite.mp3
if '%option%'=='goback' goto :ROCK

:TECHNO
cls
title Techno songs (music)
echo From which artist?
echo.
echo Bart B More
echo Sharon Den
echo Dave Lambert
echo D-Rashid
echo John Dahlback
echo Crookers
echo Kosheen
echo Laidback Luke
echo Eyerer
echo or... go back?
set /p option=
if '%option%'=='BartBMore' goto :BARTBMORE
if '%option%'=='SharonDen' goto :SHARONDEN
if '%option%'=='DaveLambert' goto :DAVELAMBERT
if '%option%'=='D-Rashid' got -RASHID
if '%option%'=='JohnDahlback' goto :JOHNDAHLBACK
if '%option%'=='Crookers' goto :CROOKERS
if '%option%'=='Kosheen' goto :KOSHEEN
if '%option%'=='LaidbackLuke' goto :LAIDBACKLUKE
if '%option%'=='Eyerer' goto :EYERER
if '%option%'=='goback' goto :MUSIC

:BARTBMORE
cls
title artist : Bart B More (Music)
echo Which song?
echo.
echo Erasmus
echo or...go back?
set /p option=
if '%option%'=='Erasmus' start Erasmus.mp3
if '%option%'=='goback' goto :TECHNO

:SHARONDEN
cls
title artist : Sharon Den (Music)
echo Which song?
echo.
echo In and Out o Love (REMIX)
echo or... go back?
set /p option=
if '%option%'=='InandOutofLove (REMIX)' start In.and.Out of.Love.(REMIX).mp3
if '%option%'=='goback' goto :TECHNO

:DAVELAMBERT
cls
title artist : Dave Lambert (Music)
echo Wich song?
echo .
echo House In Play
echo or... go back?
set /p option=
if '%option%'=='HouseInPlay' start House.In.Play.mp3
if '%option%'=='goback' goto :TECHNO

-RASHID
cls
title artist : D-Rashid (Music)
echo Which song?
echo .
echo Latin Brutality
echo or... go back
set /p option=
if '%option%'=='LatinBrutality' start Latin.Brutality.mp3
if '%option%'=='goback' goto :TECHNO

:JOHNDAHLBLACK
cls
title artist : John Dah Black (Music)
echo Which song?
echo .
echo Pyramid
echo or... go back
set /p option=
if '%option%'=='Pyramid' start Pyramid.mp3
if '%option%'=='goback' goto :TECHNO

:CROOKERS
cls
title artist : Crookers (Music)
echo Which song?
echo .
echo Day N Nite
echo or... go back
set /p option=
if '%option%'=='DayNNite' start Day.N.Nite.mp3
if '%option%'=='goback' goto :TECHNO

:KOSHEEN
cls
title artist : Kosheen (Music)
echo Which song?
echo .
echo Hide U
echo or... go back
set /p option=
if '%option%'=='HideU' start Hide.U.mp3
if '%option%'=='goback' goto :TECHNO

:LAIDBACKLUKE
cls
title artist : Laidback Luke (Music)
echo Which song?
echo .
echo BREAK The House Down
echo or... go back
set /p option=
if '%option%'=='BreakTheHouseDown' start Break.The.House.Down.mp3
if '%option%'=='goback' goto :TECHNO

:EYERER
cls
title artist : Eyerer (Music)
echo Which song?
echo .
echo Babylon
echo Electric
echo or... go back
set /p option=
if '%option%'=='Babylon' start Babylon.mp3
if '%option%'=='Electric' start Electric.mp3
if '%option%'=='goback' goto :TECHNO

:ELECTRO
cls
tilte Electro songs (music)
echo From wich artist?
echo.
echo Unknown
echo Dj Bam Bam
echo Dj NMeSiS
echo Gala
echo Mysto
echo Mr Oizo
echo Private Fiction
echo or... go back?
set /p option=
if '%option%'=='Unkown' goto :UNKNOWN
if '%option%'=='DjBamBam' goto :DJBAMBAM
if '%option%'=='DjNMeSiS' goto :DJNMESIS
if '%option%'=='Gala' goto :GALA
if '%option%'=='Mysto' goto :MYSTO
if '%option%'=='PrivateFiction' goto :PRIVATEFICTION
if '%option%'=='MrOizo' goto :MROIZO
if '%option%'=='goback' goto :MUSIC

:UNKNOWN
cls
title artist : Unknown (Music)
echo Which song?
echo .
echo Best Electronic House Tune April 2008
echo Best of Electro 2009
echo DIRTY ELECTRO HOUSE MIX OCTOBER 2008
echo Electro House NEW MiX 2008
echo Electro House NEW MiX 20081
echo House Electro Progressive Club Mix January 2008
echo I LOVE ELECTRO
echo or... go back?
set /p option=
if '%option%'=='BestElectronicHouseTuneApril2008' start Best.Electronic.House.Tune.April.2008.m p3
if '%option%'=='BestofElectro2009' start Best.of.Electro.2009.mp3
if '%option%'=='DIRTYELECTROHOUSEMIXOCTOBER2008' start DIRTY.ELECTRO.HOUSE.MIX.OCTOBER.2008.mp 3
if '%option%'=='ElectroHouseNEWMiX2008' start Electro.House.NEW.MiX.2008.mp3
if '%option%'=='ElectroHouseNEWMiX20081' start Electro.House.NEW.MiX.20081.mp3
if '%option%'=='HouseElectroProgressiveClubMixJanuary20 08' start House.Electro.Progressive.Club.Mix.Janu ary.2008mp3
if '%option%'=='ILOVEELECTRO' start I.LOVE.ELECTRO.mp3
if '%option%'=='goback' goto :ELECTRO

:DJBAMBAM
cls
title artist : Dj Bam Bam (Music)
echo Which song?
echo .
echo The Love I Lost
echo or... go back
set /p option=
if '%option%'=='TheLoveILost' start The.Love.I.Lost.mp3
if '%option%'=='goback' goto :ELECTRO

:DJNMESIS
cls
title artist : Dj NMeSiS (Music)
echo Wich song?
echo .
echo EleCtro HouSe MiX GeNeRaTioN
echo or... go back
set /p option=
if '%option%'=='EleCtroHouSeMiXGeNeRaTioN' start EleCtro.HouSe.MiX.GeNeRaTioN.mp3
if '%option%'=='goback' goto :ELECTRO

:GALA
cls
title artist : Gala (Music)
echo Which song?
echo .
echo Electro Remix 2007
echo or... go back
set /p option=
if '%option%'=='ElectroRemix2007' start Electro.Remix.2007.mp3
if '%option%'=='goback' goto :ELECTRO

:MYSTO
cls
title artist : Mysto (Music)
echo Which song?
echo .
echo Love Lockdown
echo or... go back
set /p option=
if '%option%'=='LoveLockdown' start Love.Lockdown.mp3
if '%option%'=='goback' goto :ELECTRO

:MROIZO
cls
title artist : Mr Oizo (Music)
echo Wich song?
echo .
echo Flat Beat
echo or... go back
set /p option=
if '%option%'=='FlatBeat' start Flat.Beat.mp3
if '%option%'=='goback' goto :ELECTRO

:PRIVATEFICTION
cls
title artist : Private Fiction (Music)
echo Which song?
echo .
echo LIBERTY
echo or... go back
set /p option=
if '%option%'=='LIBERTY' start LIBERTY.mp3
if '%option%'=='goback' goto :ELECTRO

:METAL
cls
title Metal songs (music)
echo .
echo Sorry ther are no song in this genre of music
echo go back?
set /p option=
if '%option%'=='goback' goto :MUSIC

:LEAVE
cls
title leave
echo Are you SURE you want o leave?
set /p option=
if '%option%'=='yes' goto :BYE
if '%option%'=='no' goto :MUSIC

:BYE
cls
echo Bye, see you later
echo .
echo .
echo .
echo MADE by Shani Wuyts
pause

i dont' see any saveable value
where is the game??Please

Is there someone can help me?Quote from: Hallucination on June 02, 2009, 03:16:11 PM
Please

Is there someone can help me?
Just some things I noticed while glancing at it.

1. I suggest replacing all instances of IF with IF /I incase someone writes something like 3DOORSdown...
2. Add set option=%option: =% before the IF /I incase they add spaces...
3. You don't need the colon after goto, only before the label.
4. Adding a loop before choosing an option will prevent someone from entering something stupid like BLAH! and continuing on with the script.
Code: [Select]:loop1
echo Option 1
echo Option 2
set /p option=
set option=%option: =%
if /i "%option%"=="Option 1" goto option1
if /i "%option%"=="Option 2" goto option2
cls
echo Not a valid option!
goto loop1
:option1
code...
:option2
code...
Could you please edit my batch file and add an option
if user pressed "mm" any time batch file - save everything
and if user pressed "nn" any batch - batch file load last save

Thankswell now we'll be taking all the fun away from you Quote from: BatchFileBasics on June 03, 2009, 07:38:14 PM
well now we'll be taking all the fun away from you
Yeah...and the only way you can truly learn is from doing it by yourself. (Trial and error...trial and error)
4654.

Solve : How can I open a file on another computer with a batch file?

Answer»

Hi all,

Title says it all really. Well, does anyone know the syntax in DOS (for XP) for opening a file on a remote computer (in the same network and domain as yours) ? The file should then be opened on the remote computer itself and not on the one where the batch file lies.

Many thanks in advance.if you have administrator right on the network, use psexec.exe from sysinternalsuite.
download available at microsoftThanks Reno but I have a hard time believing that a simple DOS solution doesn't exist.Quote from: Cheese on May 13, 2009, 10:09:23 PM

Thanks Reno but I have a hard time believing that a simple DOS solution doesn't exist.
Please tell us why you think that.
Many here believe that Windows was not built on top of DOS. Some of us here are wondering why so many ask us about DOS based commands when there are so many ways to do anything inside of the Windows interface. Are there some INSTRUCTORS or books that teach people everything starts in DOS?

In windows you just go into My Network Places and find whatever can be seen.
And if you need to execute a program on the far machine, there is a way to do that, as was EXPLAINED above in another post.Quote from: Cheese on May 13, 2009, 10:09:23 PM
Thanks Reno but I have a hard time believing that a simple DOS solution doesn't exist.
tools are available in exe format that can do the job. to read a file in remote server including DIFFERENT platforms, there are various ways to do it. eg SSH, telnet, expect etc, depending on WHETHER these services are available. psexec is only one solution of them that is used between windows machines and can't be used if you want to connect UNIx machinesI like DOS solutions because I like to have a clean PC. And it seems to work because in 15 years of PC use I don't remember having ever had the slightest virus on my machine, not EVEN the Sasser & consorts.

DOS commands are a very elegant solution because the program exists on every XP PC the same way. Still, I admit that this time I'll probably have a hard time because part of the PC's run on Win98, which doesn't use the same command.

I'll have a look at psexec. Thanks for that folks.Quote from: Cheese on May 14, 2009, 01:16:18 PM
DOS commands are a very elegant solution because the program exists on every XP PC the same way.
that's not even the basis for "elegant solution". Its just convenience.We don't use the same vocabulary then. To me an 'elegant solution' is a solution which brings you the best possible output with a minimum of means. And the DOS console isn't exactly a heavy program is it.
4655.

Solve : Getting source (not of a converted batch file)?

Answer»

Is it possible to GET the source of a web page via BATCH? If not, how would I get around to doing it?well i don't THINK you can actually use batch to download\read from a webpage...or can you?

but i know that you can use a program CALLED "wget"
http://users.ugent.be/~bpuype/wget/

and you can use it in command line

wget [OPTION]... [URL]...

like Code: [Select]wget http://www.google.com/index.htmlthen you can just use type Code: [Select]type index.html
so...
Code: [Select]wget http://www.google.com/index.html
type index.html


pretty simpleno, you can't do it with just NT cmd batch.

1. use wget.exe as stated by batchfilebasics, i use it myself for daily routine
2. use vbscript, then access internet explorer object or create xmlhttp object and use get method (haven't try this one)

4656.

Solve : delet (.rar .zip ) files after successfully unzip?

Answer»

type '.zip.exe' at command prompt:
it should display something as follow:
Code: [Select]D:\batch>.zip

7-Zip 4.57 Copyright (c) 1999-2007 Igor Pavlov 2007-12-06

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]hi dear reno
well i don't have 7zip installed on my system so when i typed .zip.exe in CMD i saw error massage


Quote

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

C:\Documents and Settings\sss>.zip.exe
'.zip.exe' is not recognized as an internal or external command,
operable program or batch file.

well i did not navigate to my folder through CMD
but i did something else that defined my file is not bad !!
i copied .zip.exe in a folder and typed .zip.exe in a bat file and executed bat file
you can see the result

Quote
F:\bbb\delet zip>.zip.exe

7-Zip 4.62 Copyright (c) 1999-2008 Igor Pavlov 2008-12-02

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]

<Commands>
a: Add files to archive
b: Benchmark
d: Delete files from archive
e: Extract files from archive (without using directory names)
l: List contents of archive
t: Test integrity of archive
u: UPDATE files to archive
x: eXtract files with full paths
<Switches>
-ai[r[-|0]]{@listfile|!wildcard}: Include archives
-ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
-bd: Disable percentage indicator
-i[r[-|0]]{@listfile|!wildcard}: Include filenames
-m{Parameters}: set compression Method
-o{Directory}: set Output directory
-p{Password}: set Password
-r[-|0]: Recurse subdirectories
-scs{UTF-8 | WIN | DOS}: set charset for list files
-sfx[{name}]: Create SFX archive
-si[{name}]: read data from stdin
-slt: show technical information for l (List) command
-so: write data to stdout
-ssc[-]: set sensitive case mode
-ssw: compress shared files
-t{Type}: Set type of archive
-v{Size}[b|k|m|g]: Create volumes
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
-w[{path}]: assign Work directory. Empty path means a temporary directory
-x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
-y: assume Yes on all queries

so my file is a command version right RENO?
now what's wrong? would you please read my previous post again?
thanksadmitted it that i dont have an answer for this.
i have used that batch script for months, and works well as i intend it to.

change echo off to echo on, then if you could post some screen output which line and file name goes wrong, i try my best to ASSIST. hi to all specially my dear RENO
RENO you were right !! i had created 2 empty folders and compressed them..... because of that program could not extract anything
i apologize for that i did not saw that there are some switches in your program
======================================================
but now i created 2 folders and put some files inside both of them and then compressed them to names below
my rar.rar
my zip.zip
and added (.zip.exe , .Rar.exe and reno.bat) and execute bat file it extracted all files and folders and deleted my rar.rar file but my zip.zip is still exist !! it's just hiden but not deleted
below you can see the result in a CMD window
Quote
C:\delet zip>for /F "tokens=*" %a in ('dir /b *.rar *.zip') do (%~xa e -y "%~a"
&& attrib +h "%~a" )

C:\delet zip>(.rar e -y "my rar.rar" && attrib +h "my rar.rar" )

RAR 3.80 Copyright (c) 1993-2008 Alexander Roshal 16 Sep 2008
Shareware version Type RAR -? for help


Extracting from my rar.rar

Extracting New Rich TEXT Document.rtf OK
All OK

C:\delet zip>(.zip e -y "my zip.zip" && attrib +h "my zip.zip" )

7-Zip 4.62 Copyright (c) 1999-2008 Igor Pavlov 2008-12-02

Processing archive: my zip.zip

Extracting my zip
Extracting my zip\New Text Document.txt

Everything is Ok

Folders: 1
Files: 1
Size: 10
Compressed: 251

C:\delet zip>for /F "tokens=*" %a in ('dir/b/ah *.zip *.rar') do (for /F "tokens
=*" %b in ('%~xa lb "%a"') do (dir/b "%b" 1>nul 2>&1 && (del/a "%a" && echo
DELETE: %a ) ) )

C:\delet zip>(for /F "tokens=*" %b in ('.zip lb "my zip.zip"') do (dir/b "%b"
1>nul 2>&1 && (del/a "my zip.zip" && echo DELETE: my zip.zip ) ) )

C:\delet zip>(dir/b "7-Zip 4.62 Copyright (c) 1999-2008 Igor Pavlov 2008-12-02
" 1>nul 2>&1 && (del/a "my zip.zip" && echo DELETE: my zip.zip ) )

C:\delet zip>(dir/b "Error:" 1>nul 2>&1 && (del/a "my zip.zip" && echo DELE
TE: my zip.zip ) )

C:\delet zip>(dir/b "Incorrect command line" 1>nul 2>&1 && (del/a "my zip.zip
" && echo DELETE: my zip.zip ) )

C:\delet zip>(for /F "tokens=*" %b in ('.rar lb "my rar.rar"') do (dir/b "%b"
1>nul 2>&1 && (del/a "my rar.rar" && echo DELETE: my rar.rar ) ) )

C:\delet zip>(dir/b "New Rich Text Document.rtf" 1>nul 2>&1 && (del/a "my rar
.rar" && echo DELETE: my rar.rar ) )
DELETE: my rar.rar

C:\delet zip>(dir/b "my rar" 1>nul 2>&1 && (del/a "my rar.rar" && echo DELE
TE: my rar.rar ) )

C:\delet zip>pause
Press any key to continue . . .
i am speechless.
the 2 batch file is not meant to be combined into one.

instead use this:
Code: [Select]@echo off

for /f "tokens=*" %%a in ('dir /b *.rar *.zip') do (
%%~xa e -y "%%~a" && del "%%~a"
)
pause
there is a HUGE bug that need to be fix in _clean.bat at post #2, there is no 'lb' switch in 7z.exe. so don't use script at post#2. thank you for reporting a bug. wow thanks RENO
what a powerful script it's so fast even before i start it it finished !! fantastic it's working like a charm it extract files and delet compressed files with no error . it is very delightful that this website has a programmer like you
==============================================
now with a test i have my 2 final questions that will be very greatful if you solve them

how can we replace (*.rar .*.zip) with our file names? i don't want to all files to be extracted .just need those files that i order get extracted
thanks can you give an example for replacable file names (for both zip and rar files at the same time)
thanks has someone seen RENO around?
4657.

Solve : batch game?

Answer»

ok me and my mate have MADE a batch GAME, we was GOING to make a really long one, but couldnt figure out how people would be able to save it, so we are making chapters, also this will let us post the 1st chapter and ask for peoples feedback and see if people WANT us to make a NEW one, so please look at the code, play the game and tell us what you think.

http://docs.google.com/Doc?id=d7bq555_24wmt378fg

4658.

Solve : scripted file removal remotely by IP address????

Answer»

I have some bad software being used all over and I need to fix it REMOTELY.
I can get my users to give me the IP address and then I need to ERASE /F /q C:\ClaimTrak\*.LBS

can I batch file ask for IP and launch VNC passing the addy?Quote from: badbot on May 20, 2009, 03:26:09 PM

I have some bad software being used all over and I need to fix it remotely.
I can get my users to give me the IP address and then I need to ERASE /F /q C:\ClaimTrak\*.LBS

can I batch file ask for IP and launch VNC passing the addy?
Can VNC be used with the command prompt?sorry no vnc cannot, mixing my questions upQuote from: badbot on May 20, 2009, 04:53:16 PM
sorry no vnc cannot, mixing my questions up
So...you want to remotely delete a file on someone else's computer...they would need their FIREWALL disabled, which I doubt they will want to do.you could send them the batchfile to run themselves...Quote from: BC_Programmer on May 20, 2009, 06:27:41 PM
you could send them the batchfile to run themselves...
that would be the best BET...if you have administrator access on the network, you could delete by computer name though. not sure about how to by ip address.
ERASE /F /s \\computername\C$\ClaimTrak\*.LBS
4659.

Solve : Batch removable drive help?

Answer»

Hi I'm having trouble making a batch file that:

Determine Drive letters of other removable drives.
Excludes own drive letter from list.

what i want this for, is i have multiple usb's and portable hard drives so with this file i can copy settings like my autorun file across to all of them without having to manually do it. But i don't want it to copy over its self as that's just pointless.
so far Ive found a few different commands which might be some how able to do it:

CODE: [Select]ive seen this command used before but i cant seem to MAKE it work for me.
if %odrive%==E:\ set odrive=E
if %odrive%==F:\ set odrive=F
if %odrive%==G:\ set odrive=G
if %odrive%==H:\ set odrive=H
if %odrive%==I:\ set odrive=I

and ive seen this one too


Set odrive=%odrive:~0,2%
I would like it if it could keep some of the original infomation in the original autorun files.
for example if there already is an autorun file it would add the new imfomation but leave things like the
label and the icon. Sort of like what most autorun viruses TRY to do but i want mine to help me not hurt me.

any help would be greatly appreciated.

many thanks crackrucklesvbscript:
use drive.drivetype

batch:
-fsutil fsinfo drives & fsutil fsinfo drivetype
-access registry
-dir e: f: g: & cd, but cannot recognize if drivetype is removable

this looks like autorun-virus to me.I had this problem when I used a flash drive. The way I solved it was to just use parent directory. If I remember corroectly the batch file and the file it called had to be on the root part of the flash drive. So if F: is the drive assigned you would need file.exe and file.bat in F:

In the batch file I just put
-------------------------
start file.exe
-------------------------

I wasn't able to call to other folders as it seems dos needs a drive letter to do that. Then again I dont know much about programming but this worked well for me. As it never cares what the drive letter is. If you watch the output in cmd prompt the batch file starts in whatever drive it is in and then directs to a file in the same place.


I hope thats all understandable and works for ya!Code: [Select]@echo off
setlocal enabledelayedexpansion
set UsbNum=0
for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do (
set /a UsbNum+=1
set DriveU!UsbNum!=%%h
)
)
echo You have !UsbNum! removable drives, list as below:
for /l %%a in (1,1,!UsbNum!) do (
echo.!DriveU%%a!
)
endlocal
pause
Quote from: Batcher on April 28, 2009, 12:18:44 AM

Code: [Select]@echo off
setlocal enabledelayedexpansion
set UsbNum=0
for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do (
set /a UsbNum+=1
set DriveU!UsbNum!=%%h
)
)
echo You have !UsbNum! removable drives, list as below:
for /l %%a in (1,1,!UsbNum!) do (
echo.!DriveU%%a!
)
endlocal
pause

Is there any way to display a DIR of each drive? I tried adding
set dv=!DriveU%%a!
dir /b /s %dv%

to the script withing the for loop, but I have no idea what the ! does.Thanks for replying so soon and thanks for your help but how would i use that system to make it so it picks up the primary usb and blacklists it and then copy's to all the secondary usb's? I relies that making it leave the label and the icon of the existing autorun is asking a bit much but i figure with this system i can use my 1TB as the master with its custom icon and label and then the rest can have a different one.

Code: [Select]setlocal enabledelayedexpansion
set UsbNum=0
for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do (
set /a UsbNum+=1
set DriveU!UsbNum!=%%h
)
)
echo You have !UsbNum! removable drives, list as below:
for /l %%a in (1,1,!UsbNum!) do (
echo.!DriveU%%a!
)
endlocal
pause

And it does look like an autorun virus because in a very loose sense of things it is because it changes the autorun file without prompt.

Many Thanks crackrucklesQuote from: Helpmeh on April 28, 2009, 04:37:47 PM
Is there any way to display a DIR of each drive? I tried adding
set dv=!DriveU%%a!
dir /b /s %dv%

to the script withing the for loop, but I have no idea what the ! does.

Try this one.

Code: [Select]@echo off
setlocal enabledelayedexpansion
set UsbNum=0
for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do (
set /a UsbNum+=1
set DriveU!UsbNum!=%%h
)
)
echo You have !UsbNum! removable drives, list as below:
for /l %%a in (1,1,!UsbNum!) do (
echo.!DriveU%%a!
set dv=!DriveU%%a!
dir /b /s !dv!
)
endlocal
pause
Quote from: Reno on April 27, 2009, 10:45:55 PM
...this looks like autorun-virus to me...

Quote from: crackruckles on April 29, 2009, 05:08:08 AM
...And it does look like an autorun virus because in a very loose sense of things it is because it changes the autorun file without prompt...

Why are you wanting to do this, for malicious purposes?


its not for a virus if i was going to make an autorun virus i wouldn't make it in batch. i was just hoping for an easy to use way to change all my autorun files on all my portable devices at once without having to spend time doing them manually. The reason i decided to go with batch to start with was how easy it is to modify for further use.



Many Thanks crackrucklesHow many portable devices do you use that a SIMPLE copy and paste would take to long? Quote from: mroilfield on May 10, 2009, 04:37:10 AM
How many portable devices do you use that a simple copy and paste would take to long?
Exactly!well i work with around 10,15 so a copy and paste would do it but i like to figure stuff out and this is one of those things that i just want to figure out.

at the moment i can get the code to work for one drive but not for all of them. it seems to work on the drive its on and not any of the others plugged in.I'm still using
Code: [Select]setlocal enabledelayedexpansion
set UsbNum=1
for %%a in (e f g h i j k l m n o p q r s t u v w x y z) do (
for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do (
set /a UsbNum+=4
set DriveU!UsbNum!=%%h
)
)
echo You have !UsbNum! removable drives, list as below:
for /l %%a in (1,1,!UsbNum!) do (
echo.!DriveU%%a!
)
if EXIST !DriveU%%a!\Autorun.inf goto error1
echo [autorun] > !DriveU%%a!\Autorun.inf
echo label: "Craigs Usb"> !DriveU%%a!\Autorun.inf
echo shellexecute= "..!DriveU%%a!\1.bat" >> !DriveU%%a!\Autorun.inf
echo ;open="..!DriveU%%a!\1.bat" >> !DriveU%%a!\Autorun.inf
any ideas?

p.s. anybody else have problems with this message box bouncing up when you put the code tag in?

Many thanks crackrucklesQuote from: fat_basterd21 on April 27, 2009, 11:57:07 PM


I wasn't able to call to other folders as it seems dos needs a drive letter to do that. Then again I dont know much about programming but this worked well for me. As it never cares what the drive letter is. If you watch the output in cmd prompt the batch file starts in whatever drive it is in and then directs to a file in the same place.


I hope thats all understandable and works for ya!

just to point out that batch files isnt programming, its scripting, there is a difference
4660.

Solve : xcopy command in network ip ????

Answer»

hi guys i want USE xcopy command to copy my network file.

if possible

i am ADMIN of my network & my ip is 192.168.100.1 i like to copy of .doc file from 192.168.100.5........

1. map the folder at xxx.xxx.xxx.5 as a network DRIVE. nt cmd is 'net use'
2. do xcopy, eg. xcopy z:\*.doc C:\backup\
4661.

Solve : tat.bat?

Answer»

has any one ever come across a really kool batch file called tat.bat my mate sent me it and it has alot of kool features, so like if any one is interested in it or had the file and lost it ask me for it and ill send u the codeThanks.why dont you post it here ? the code is really lengthy but okCode: [Select]@echo off
title TAT 1.5
echo please make sure you enter full screen
echo press alt+enter to get full screen
echo.
echo once ready, please press any key to start
pause >nul
:load
echo.
cls
echo.
echo TAT 1.5.3 2008 TAT Creator
echo.
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTT AAAA TTTT
ECHO TTTT AAAAAA TTTT
ECHO TTTT AAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTTAAAA AAAATTTT
echo.
echo.
echo --------------------------------------
echo ^| ^|
echo --------------------------------------
ping localhost -n 1 >nul
echo.
cls
echo.
echo TAT 1.5.3 2008 TAT Creator
echo.
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTT AAAA TTTT
ECHO TTTT AAAAAA TTTT
ECHO TTTT AAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTTAAAA AAAATTTT
echo.
echo.
echo --------------------------------------
echo ^| ==== ^|
echo --------------------------------------
ping localhost -n 2 >nul
echo.
cls
echo.
echo TAT 1.5.3 2008 TAT Creator
echo.
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTT AAAA TTTT
ECHO TTTT AAAAAA TTTT
ECHO TTTT AAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTTAAAA AAAATTTT
echo.
echo.
echo --------------------------------------
echo ^| ========== ^|
echo --------------------------------------
ping localhost -n 2 >nul
echo.
cls
echo.
echo TAT 1.5.3 2008 TAT Creator
echo.
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTT AAAA TTTT
ECHO TTTT AAAAAA TTTT
ECHO TTTT AAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTTAAAA AAAATTTT
echo.
echo.
echo --------------------------------------
echo ^| ========================= ^|
echo --------------------------------------
echo.
ping localost -n 1 >nul
cls
echo.
echo TAT 1.5.3 2008 TAT Creator
echo.
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTT AAAA TTTT
ECHO TTTT AAAAAA TTTT
ECHO TTTT AAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTTAAAA AAAATTTT
echo.
echo.
echo --------------------------------------
echo ^| ==================================== ^|
echo --------------------------------------
ping localhost -n 2 >nul
echo.
echo.
echo Press any key to load TAT . . . & pause > nul
:mainmenu
cls
echo.
echo TAT Main Menu TAT 1.5.3
echo.
echo _______________________________________________
echo + Type "menu" at any TIME if you wish to +
echo + return to this menu. +
echo + +
echo + Type "exit" at any time to exit. +
echo +_____________________________________________+
echo + Type "apps" to view batch applications. +
echo +_____________________________________________+
echo + Type "shutoff" to shut down your PC. +
echo +_____________________________________________+
echo + Type "colors" to view alternate colors. +
echo +_____________________________________________+
echo.
time /t
echo.
date /t
echo _______________________________
echo.
set /p undefine=TAT Main Menu:
if %undefine%==exit exit
if %undefine%==apps goto apps
if %undefine%==shutoff goto sd
if %undefine%==colors goto color
echo.
echo Invalid selection, try again.
echo. & pause
goto mainmenu
:apps
cls
echo Games and Applications menu page 1 of 3
echo.
echo ________________________________________
echo + Key: 1=Number guessing game +
echo + +
echo + 2=Calculator +
echo + +
echo + 3=Password changer +
echo + +
echo + 4=Next Page +
echo + +
echo + +
echo +______________________________________+
echo.
time /t
echo.
date /t
echo ________________________________
echo.
set /p undefine=Choose 1~4:
if %undefine%==1 goto numguess_int
if %undefine%==2 goto calc_int
if %undefine%==3 goto net_int
if %undefine%==4 goto apps_p2
if %undefine%==menu goto mainmenu
if %undefine%==exit exit
echo.
echo Invalid selection, please try again.
echo.
pause & goto apps
:apps_p2
cls
echo Games and Applications menu page 2 of 3
echo.
echo ________________________________________
echo + Key: 1=Folder Directory +
echo + +
echo + 2=Fake Virus Simulations +
echo + +
echo + 3=Lock computer +
echo + +
echo + 4=Next Page +
echo + +
echo + 5=Previous Page +
echo +______________________________________+
echo.
time /t
echo.
date /t
echo ________________________________
echo.
set /p undefine=Choose 1~5:
if %undefine%==1 goto fold-dir_int
if %undefine%==2 goto fakevir_int
if %undefine%==3 goto lockint_int
if %undefine%==4 goto apps_p3
if %undefine%==5 goto apps
if %undefine%==menu goto mainmenu
if %undefine%==exit exit
echo.
echo Invalid selection, please try again.
echo.
pause & goto apps_p2
:apps_p3
cls
echo Games and Applications menu page 3 of 3
echo.
echo ________________________________________
echo + Key: 1=command processor +
echo + +
echo + 2=website selection page +
echo + +
echo + 3=Batch text editor +
echo + +
echo + 4=Previous page +
echo + +
echo + +
echo +______________________________________+
echo.
time /t
echo.
date /t
echo ________________________________
echo.
set /p undefine=Choose 1~4:
if %undefine%==1 goto cmd_int
if %undefine%==2 goto weblist_int
if %undefine%==3 goto txt_int
if %undefine%==4 goto apps_p2
if %undefine%==menu goto mainmenu
if %undefine%==exit exit
echo.
echo Invalid selection, please try again.
echo.
pause & goto apps_p3
:sd
cls
echo Really shut down your computer?
echo.
set /p undefine=Yes or No:
if %undefine%==yes start shutdown -s -f -t 10 -c "TAT recieved a request to turn off this PC."
if %undefine%==no goto mainmenu
echo.
echo Invalid selection. & echo. & pause & goto mainmenu
:color
cls
echo Choose from the following text colors:
echo.
echo 1=blue 9=light blue
echo.
echo 2=green A=light green
echo.
echo 3=aqua B=light aqua
echo.
echo 4=red C=light red
echo.
echo 5=violet D=light violet
echo.
echo 6=yellow E=light yellow
echo.
echo 7=white F=brigth white (best for contrast)
echo.
echo 8=gray
echo.
set /p text=Choose 1~F:
echo.
pause
cls
echo Now type the number of the color
echo you want to use for background
echo (can NOT be text color)
echo.
echo 1=blue 9=light blue
echo.
echo 2=green A=light green
echo.
echo 3=aqua B=light aqua
echo.
echo 4=red C=light red
echo.
echo 5=violet D=light violet
echo.
echo 6=yellow E=light yellow
echo.
echo 7=white F=brigth white (best for contrast)
echo.
echo 8=gray
echo.
echo.
set /p back=Choose 1~F:
color %back%%text%
goto mainmenu
:numguess_int
cls
echo Number Guessing Game
echo.
echo Original Idea by SeJma
echo.
echo core programming unchanged from original
echo.
echo Press any key to start program . . . & pause > nul
set num=%random%
:numguess
cls
echo Number Guessing Game
echo.
echo You GUESS the number!
echo.
echo Type "give" if you give up.
echo ___________________________
echo.
:guessarea
set /p undefine=You guess:
if %undefine%==give goto loser
if %undefine%==%num% goto winner
if %undefine% GTR %num% (
echo.
echo Lower!
echo.
goto guessarea
)
if %undefine% LSS %num% (
echo.
echo Higher!
echo.
goto guessarea
)
goto guessarea
:loser
cls
echo The answer is %num%
echo.
echo Press any key to return to apps menu . . . & pause > nul
goto apps
:winner
cls
echo Congradulations, you guessed correctly!
echo.
echo Try again?
echo.
set /p undefine=Yes or No:
if %undefine%==yes goto numguess
if %undefine%==no goto apps
echo.
echo Invalid selection, please try again.
echo.
pause & goto winner
:calc_int
cls
echo Batch Calculator
echo.
echo Original idea by SeJma
echo.
echo Core programming unchanged from original
echo.
echo Press any key to start program . . . & pause > nul
:calc
cls
echo --------------------------------------------------------------
echo Batch Calculator
echo.
echo Type your problem below (NO decimals)
echo --------------------------------------------------------------
echo.
set /p udefine=
if %undefine%==exit exit
if %undefine%==menu (
goto mainmenu
)
set /a udefine=%udefine%
echo.
echo = %udefine%
echo --------------------------------------------------------------
pause
cls
goto calc
:net_int
cls
echo Password changer
echo.
echo Original idea by TAT Creator (SeJma took all the good apps...)
echo.
echo Core programming unchanged from original
echo.
echo Press any key to start program . . . & pause > nul
:net
cls
echo.
echo Password Changer
echo.
echo Here is a LIST of the users (including hidden ones) on this PC:
echo.
echo.
echo.
echo.
net user
echo.
echo.
echo.
echo Below, you will type the user name of which you want the password changed.
echo.
echo.
set /p undefine=User:
echo.
echo.
net user %undefine% *
echo.
echo.
echo.
pause
:netresolve
cls
echo.
echo Do you want to change another password?
echo.
set /p undefine=Yes or No:
if %undefine%==yes goto net
if %undefine%==no goto apps
echo.
echo Invalid selection, please try again.
echo.
pause
goto netresolve
:fold-dir_int
cls
echo Folder Directory archive
echo.
echo Original idea by TAT Creator
echo.
echo Core programming unchanged from original
echo.
echo Press any key to start program . . .
:fol-dir
cls
echo Folder directory system
echo.
echo Type 1 if you use windows vista and
echo type 2 if you use windows xp.
echo.
set /p undefine=Choose 1 or 2:
if %undefine%==1 goto fol-dir_v
if %undefine%==2 goto fol-dir_xp
if %undefine%==menu goto mainmenu
if %undefine%==exit exit
echo.
echo Invalid selection, please try again.
echo.
pause
goto fol-dir
:fol-dir_v
cls
echo.
echo Folder directory for Windows Vista
echo.
echo Type 1 for Documents
echo.
echo Type 2 for Downloads
echo.
echo Type 3 for Favorites
echo.
echo Type 4 for Links
echo.
echo Type 5 for Music
echo.
echo Type 6 for Pictures
echo.
echo Type 7 for Videos
echo.
echo.
set /p undefine=Choose 1~7:
if %undefine%==1 (
explorer %userprofile%\documents
goto apps_p2
)
if %undefine%==2 (
explorer %userprofile%\downloads
goto apps_p2
)
if %undefine%==3 (
explorer %userprofile%\favorites
GOTO apps_p2
)
if %undefine%==4 (
explorer %userprofile%\links
goto apps_p2
)
if %undefine%==5 (
explorer %userprofile%\music
goto apps_p2
)
if %undefine%==6 (
explorer %userprofile%\pictures
goto apps_p2
)
if %undefine%==7 (
explorer %userprofile%\videos
goto apps_p2
)
echo.
echo Invalid selection, please try again.
echo.
pause
goto fol-dir_v
:fol-dir_xp
cls
echo.
echo Folder directory for windows xp
echo.
echo Type 1 for Documents
echo.
echo Type 2 for Pictures
echo.
echo Type 3 for Music
echo.
echo Type 4 for Videos
echo.
set /p undefine=Choose 1~4:
if %undefine%==1 (
explorer %userprofile%\my documents
goto apps_p2
)
if %undefine%==2 (
explorer %userprofile%\my documents\my pictures
goto apps_p2
)
if %undefine%==3 (
explorer %userprofile%\my documents\my music
goto apps_p2
)
if %undefine%==4 (
explorer %userprofile%\my documents\my videos
goto apps_p2
)
echo.
echo Invalid selection, please try again.
echo.
pause & goto fol-dir_xp
:fakevir_int
cls
echo.
echo Virus Simulations
echo.
echo Original Ideas by SeJma and fwjs28
echo.
echo Second simulation rebuilt by TAT Creator
echo.
echo Others are completely unchanged and untouched
echo.
echo Note: These programs are COMPLETELY HARMLESS
echo.
echo Press any key to start programs . . . & pause > nul
:fakevir
cls
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo VIRAL INFECTION!!!
echo ERROR!!!
echo -
echo virus - TROJAN_DEMOLISHER code #45643676
echo -
echo FIREWALL - FAILED
echo -
echo ANTI-VIRUS - FAILED
echo -
echo IP ADDRESS BREACHED!
echo -
echo VIRUS ATTAINING: ****-****-****-8894
echo -

pause
cls
echo -
echo SCANNING INFECTED AREAS...
echo -

pause

set /a num=0
:repeat1
set /a num=%num% +1
echo %num%
if %num%==100 goto end
goto repeat1
:end
cls
echo -
echo 86.5 PERCENT OF MEMORY INFECTED
echo -
echo INFECTION FATAL!
echo -
echo DELETION OF ENTIRE CONTENTS OF LOCAL DISK C: REQUIRED
echo -

pause
cls
echo -
echo DELETING HARD-DRIVE C:
echo -
dir /s

pause
cls
echo -
echo CONTENTS OF HARD-DRIVE C: ERASED
echo -

pause
cls
echo -
echo SCANNING...
echo -

set /a num1=0
:repeat2
set /a num1=%num1% +1
echo %num1%
if %num1%==100 goto end1
goto repeat2
:end1
cls
echo -
echo 0.00 PERCENT OF HARD-DRIVE INFECTED
echo -
pause
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
echo ERROR
pause
cls
title SYSTEM FAILURE
echo ERROR!
echo -
echo VISUAL MEMORY LOST!
echo -
echo RAM LOST!
echo -
echo CORE PROCESSOR FAILING...
echo -
echo TOTAL SYSTEM CRASH IMMINENT!
echo -
echo -
pause
cls
echo -
echo -
echo -
echo SHUTDOWN COMPUTER NOW TO AVOID RISK OF FIRE!
echo -
echo -
echo -
pause
cls
echo -
echo -
echo -
echo SEEK PROFESSIONAL HELP IMMEDIATLY TO PREVENT FURTHER DAMAGE!
echo -
echo -
echo -
echo.
echo Press any key to go to next viral simulation . . . & pause > nul
:fakevir2
cls
echo.
echo WINDOWS HAS FOUND A VIRUS IN THE FOLLOWING DIRECTORY(S):
echo.
ping localhost -n 2 > nul
cd C:\
dir
echo.
ping localhost -n 3 > nul
echo.
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR & ping localhost -n 1 > nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR & ping localhost -n 01 > nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR
ping localhost -n 1 >nul
echo ERROR & ping localhost -n 2 > nul
echo.
echo.
echo Press any key to quarantine this virus . . . & pause > nul
cls
echo formatting 20%
ping localhost -n 2 > nul & cls
echo formatting 40%
ping localhost -n 2 > nul & cls
echo formatting 60%
ping localhost -n 2 > nul & cls
echo formatting 80%
ping localhost -n 2 > nul & cls
echo formatting 100%
ping localhost -n 2 > nul
echo.
pause
cls
echo.
echo Running Windows System Diagnostic Test . . .
echo.
ping localhost -n 2 > nul
echo RAM = UNINFECTED
ping localhost -n 2 > nul
echo Disk WJS19984381 = CRITICAL
ping localhost -n 2 > nul
echo CPU CORE 184 = FATAL
ping localhost -n 2 > nul
echo COM PORT 16845 = FATAL
ping localhost -n 2 > nul
echo LAN 199430 = CRITICAL
ping localhost -n 2 > nul
echo HKEY_LOCAL_MACHINE =
ping localhost -n 4 > nul
cls
echo.
echo Running Windows System Diagnostic Test . . .
echo.
echo RAM = UNINFECTED
echo Disk WJS19984381 = CRITICAL
echo CPU CORE 184 = FATAL
echo COM PORT 16845 = FATAL
echo LAN 199430 = CRITICAL
echo HKEY_LOCAL_MACHINE = NOT RESPONDING
echo.
ping localhost -n 2 > nul
echo ERRORLEVEL 145378 has been issued.
echo.
pause
cls
echo Windows has been corrupted
echo.
echo all files . . . NOT RESPONDING
echo.
set /p request=Enter final request:
echo.
echo The command "%request%" cannot be performed because "%request%"
echo is not recognised as an internal or external command.
echo.
echo Press any key to go to next viral simulation . . . & pause > nul
:fakevir3
cls
title LOADING SELF DIAGNOSTICS CHECK
echo LOADING SELF DIAGNOSTICS CHECK....
ping localhost -n 3 >nul
echo DONE!
ping localhost -n 2 >nul
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
echo error
pause
echo loading virus...
echo Loading... Please Wait
echo ---------------------------------------
echo = 0 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading. Please Wait
echo ---------------------------------------
echo = 5 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading.. Please Wait
echo ---------------------------------------
echo = 15 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading... Please Wait
echo ---------------------------------------
echo = 23 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading. Please Wait
echo ---------------------------------------
echo = 30 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading.. Please Wait
echo ---------------------------------------
echo = 38 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading... Please Wait
echo ---------------------------------------
echo = 42 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading. Please Wait
echo ---------------------------------------
echo = 45 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading.. Please Wait
echo ---------------------------------------
echo = 48 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading... Please Wait
echo ---------------------------------------
echo = 50 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading. Please Wait
echo ---------------------------------------
echo = 56 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading.. Please Wait
echo ---------------------------------------
echo = 63 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading... Please Wait
echo ---------------------------------------
echo = 69 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading. Please Wait
echo ---------------------------------------
echo = 75 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading.. Please Wait
echo ---------------------------------------
echo = 79 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading... Please Wait
echo ---------------------------------------
echo = 86 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading. Please Wait
echo ---------------------------------------
echo = 90 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading.. Please Wait
echo ---------------------------------------
echo = 96 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo loading virus...
echo Loading... .Complete.
echo ---------------------------------------
echo = 100 ]
echo ---------------------------------------
ping localhost -n 2 >nul
cls
echo Virus loaded...
ping localhost -n 2 >nul
echo deleting system files
ping localhost -n 2 >nul
echo deleting personal files
ping localhost -n 2 >nul
echo deleting images
ping localhost -n 2 >nul
echo deleting entire hard drive contents
ping localhost -n 2 >nul
echo clearing mother board
ping localhost -n 2 >nul
echo RAM failure
echo contact local computer repair and report ID ten T error
echo.
pause
echo.
cls
echo.
echo Press any key to return to the Apps Menu . . . & pause > nul
goto apps_p2
:lockint_int
cls
echo.
echo This program works best in full screen
echo.
echo To go to full screen,
echo.
echo Right click title bar,
echo.
echo click "Properties"
echo.
echo under "options" tab, click "full screen" bubble
echo.
echo.
echo It is reccomended that you change to full screen before continuing.
echo.
pause & goto lockint
:lockint
cls
echo.
echo Type the password you want to use to lock your computer
echo.
set /p undefine=Your Password:
cls
echo Now enter your MIDDLE name in case you forget password
echo.
set /p mid=Middle Name:
:lock
cls
echo.
echo This computer is locked.
echo.
echo If you forgot your password, type "forget"
echo ___________________________________________
echo.
set /p pass=Enter Password:
if %pass%==%undefine% goto mainmenu
if %pass%==forget goto lockforget
echo.
echo Password Incorrect, please try again . . .
echo.
pause
goto lock
:lockforget
cls
echo.
echo Type your middle name below
echo.
set /p forget=Your middle name:
if %forget%==%mid% goto mainmenu
echo.
echo The middle name you typed
echo does not match the one that
echo you typed at the start of the program.
echo.
echo Please Try again.
echo.
pause & goto lock
:cmd_int
cls
echo Windows Command Processor
echo.
echo Original idea by Microsoft Corporation
echo.
echo Core programming unchanged from original
echo.
echo Press any key to start program . . . & pause > nul & start %systemroot%\system32\cmd.exe
goto apps_p3
:weblist_int
cls
echo Website Selector
echo.
echo Original idea by SeJma
echo.
echo Core programming unchanged from original
echo.
echo Press any key to start program . . . & pause > nul
:weblist
set google=1
set yahoo=2
set hotmail=3
set facebook=4
set myspace=5
set cnn=6
set weather=7
set wikihow=8
set instructables=9
set youtube=10
set answers=11
set wikipedia=12
set exit=e
set back=b
:top
cls
echo ***************************************************************
echo.
echo Site Selector
echo.
echo ***************************************************************
echo.
echo Key: 1 Google - Search Engine
echo 2 Hotmail - Mail Server
echo 3 Yahoo - Search Engine/Mail Server
echo 4 Facebook - Social Networking
echo 5 Myspace - Social Networking
echo 6 CNN - News
echo 7 Weather - Weather
echo 8 WikiHow - A How-To Website
echo 9 Instructables - A How-To Website
echo 10 YouTube - Online Videos
echo 11 Answers - Online Encyclopedia
echo 12 Wikipedia - Online Encyclopedia
echo.
echo ***************************************************************
echo Enter the number of the website which you would like to go to:
echo.
set /p undefine=
echo.
echo ***************************************************************
if %undefine%==1 start www.google.com
if %undefine%==2 start www.hotmail.com
if %undefine%==3 start www.yahoo.com
if %undefine%==4 start www.facebook.com
if %undefine%==5 start www.myspace.com
if %undefine%==6 start www.cnn.com
if %undefine%==7 start www.weather.com
if %undefine%==7 start www.wikihow.com
if %undefine%==9 start www.instructables.com
if %undefine%==10 start www.youtube.com
if %undefine%==11 start www.answers.com
if %undefine%==12 start www.wikipedia.com
if %undefine%==menu goto mainmenu
if %undefine%==exit exit
echo.
echo Invalid selection, please try again.
echo.
pause & goto top
:txt_int
cls
echo Batch Text Editor
echo.
echo Original idea by Microsoft Corporation
echo.
echo Completely unchanged from original
echo.
echo You will not be able to return to the main menu from here!!!
echo.
echo Really start program?
echo.
set /p undefine=y or n:
if %undefine%==y goto txt
if %undefine%==n goto apps_p3
:txt
edlin & edit | cls & echo Editor cannot be run on this computer. & echo. & pause & goto apps_p3
goto mainmenuthe virus stuff, is just like a virus sim, it says that in the menu and like it shows u some virus simulations. like what you could do with batch files and stuffjust attach file to post

EDIT:
you should realy attach it...oh right i didnt know u cud do that XD

[attachment deleted by admin]I will run it in a virtual pcIt is pretty cool. it seems safe too. I like the text editor. The calculator seems to work good. Pretty amazing that thats a batch. Virus simulator is ok too. Pretty cool. Its safe everyonelolz i told u that it is safe, im past the whole making viruses part, i screwed up my mates computer with one XDlol
Can you delete the post with the source code? It makes the thread too hard to view cause it takes to long to scroll downThe main reason why the code is so long is because of all the "Loading" you have to do...if you want to keep the loading, but shrink the script, use a variable, and invrease the precentage.

:loopload1
set /a varload1+=(increment per second)
cls
echo.
echo TAT 1.5.3 2008 TAT Creator
echo.
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
echo TTTT AAAA TTTT
ECHO TTTT AAAAAA TTTT
ECHO TTTT AAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAAAAAAAAAAAAAAAAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTT AAAA AAAA TTTT
ECHO TTTTAAAA AAAATTTT
echo.
echo.
echo Loaded^: %varload1%% complete
ping localhost -n 1 -w 1000 > nul
goto loopload1

4662.

Solve : is this bat file right. cause it will not work.?

Answer»

@echo off
echo 1 -stars
echo 2 -dollar signs
echo 3 - crosses


choice /C:123

if errorlevel 3 GOTO crs
if errorlevel 2 goto dlr
if errorlevel 1 goto str

:str
echo ****************************************
echo.
pause
goto :question

:dlr
echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
echo.
pause
goto :question

:crs
echo ++++++++++++++++++++++++++++++++++++++++++
echo.
pause
goto :question

:question
:choice
set /p c=did you like it[y/n]?
if /I "%c%" equ "y" goto :yes
if /I "%c%" equ "n" goto :no

goto :choice

:yes
echo great i am GLAD you LIKED it!!!!!!
pause
exit

:no echo you didn't well to bad
pause
exit

Quote from: computerperson#1 on May 20, 2009, 03:37:01 PM

@echo off
echo 1 -stars
echo 2 -dollar signs
echo 3 - crosses


choice /C:123

if errorlevel 3 goto crs
if errorlevel 2 goto dlr
if errorlevel 1 goto str

:str
echo ****************************************
echo.
pause
goto :question

:dlr
echo $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
echo.
pause
goto :question

:crs
echo ++++++++++++++++++++++++++++++++++++++++++
echo.
pause
goto :question

:question
:choice
set /p c=did you like it[y/n]?
if /I "%c%" equ "y" goto :yes
if /I "%c%" equ "n" goto :no

goto :choice

:yes
echo great i am glad you liked it!!!!!!
pause
exit

:no echo you didn't well to bad
pause
exit


First off, you need to add ^ before each $ (and possible the * and +). Also, ":no" and "echo you didn't well to bad" need to be on different lines.thanks but when i open it , it says choice is not a recognized internal or EXTERNAL command operable program or batch file.Quote from: computerperson#1 on May 20, 2009, 04:13:18 PM
thanks but when i open it , it says choice is not a recognized internal or external command operable program or batch file.
Because you don't have it on your computer...that's why. Use set /p variablename= instead.Code: [Select]@ECHO OFF
:Begin
ECHO 1 - Stars
ECHO 2 - Dollar Signs
ECHO 3 - Crosses
ECHO 4 - Stop
echo Enter Choice

SET /P choice=

IF %choice% EQU 4 goto end

IF %choice% EQU 3 goto CRS

IF %choice% EQU 2 goto DLR

IF %choice% EQU 1 goto STR
goto begin


:STR
ECHO *******************
ECHO.
PAUSE
CLS
Goto Begin


:DLR
ECHO $$$$$$$$$$$$$$$$$$$$
ECHO.
PAUSE
CLS
goto Begin

:CRS
ECHO +++++++++++++++++++++
ECHO.
PAUSE
CLS
goto Begin
:end
Output:
1 - Stars
2 - Dollar Signs
3 - Crosses
4 - Stop
Enter Choice
2
$$$$$$$$$$$$$$$$$$$$

Press any key to continue . . .Quote from: billrich on May 20, 2009, 04:56:49 PM
Code: [Select]@ECHO OFF
:Begin
ECHO 1 - Stars
ECHO 2 - Dollar Signs
ECHO 3 - Crosses
ECHO 4 - Stop
echo Enter Choice

SET /P choice=

IF %choice% EQU 4 goto end

IF %choice% EQU 3 goto CRS

IF %choice% EQU 2 goto DLR

IF %choice% EQU 1 goto STR
goto begin


:STR
ECHO *******************
ECHO.
PAUSE
CLS
Goto Begin


:DLR
ECHO $$$$$$$$$$$$$$$$$$$$
ECHO.
PAUSE
CLS
goto Begin

:CRS
ECHO +++++++++++++++++++++
ECHO.
PAUSE
CLS
goto Begin
:end
Output:
1 - Stars
2 - Dollar Signs
3 - Crosses
4 - Stop
Enter Choice
2
$$$$$$$$$$$$$$$$$$$$

Press any key to continue . . .
Try putting a CLS right after :begin ...thanks it works Quote from: computerperson#1 on May 21, 2009, 05:47:41 AM
thanks it works
You're welcome! You can stay as LONG as you want, either getting help or giving it!
4663.

Solve : Echoing $V (prompt)?

Answer»

Quote from: billrich on June 03, 2009, 08:30:14 PM


Code: [Select]prompt=$v

set varp=%prompt%

echo varp = %varp%

prompt=$P$G
The system variable, prompt contain $v


C:\>prompt $v

Microsoft Windows XP [Version 5.1.2600]prompt $P$G

C:\>

The varp variable was also assigned the $v value


I copied/pasted the above coding into Trial.bat and this is the output with Echo Off:
Quote
C:\>trial
varp = $v

C:\>

With Echo set to On the following is produced:
Quote
←C:\>trial

←C:\>prompt=$v

Microsoft Windows XP [Version 5.1.2600]set varp=$v

Microsoft Windows XP [Version 5.1.2600]echo varp = $v
varp = $v

Microsoft Windows XP [Version 5.1.2600]prompt=$P$G

C:\>

Nowhere can I find that you set any variable to the current OS version, the variable %varp% is set to the Prompt switch (aka text) $v as is shown in your Echo COMMAND. What the OP asked for is that a variable be set to the output of Prompt $v which is the OS version details.

You will appreciate that, when Prompt $V is used, Prompt in this case is an Internal Command which will be interpreted by CMD.exe and the variable %Prompt% will be set to the prompt switch so that %Prompt% is set to $V not to the result of Prompt $V.Hedi wrote:

Quote
You will appreciate that, when Prompt $V is used, Prompt in this case is an Internal Command which will be interpreted by CMD.exe and the variable %Prompt% will be set to the prompt switch so that %Prompt% is set to $V not to the result of Prompt $V.

You might be right.
How do we ASSIGN the output of "prompt $v" to a variable that we then can echo?



C:\>prompt echo $v$G

echo Microsoft Windows XP [Version 5.1.2600]>
echo Microsoft Windows XP [Version 5.1.2600]>prompt

C:\>@Hedonist

this advice may be a bit late, but your struggle is as futile as trying to teach Nymph4 something. I'm sure you can relate to that. BC_P - don't remind me

Billrich has raised a good question, how does ONE redirect Prompt output? Until 5 mins ago it's a THING I've never tried, never even thought of. So far I've not been able to redirect it anywhere so perhaps Prompt does not write to Stdout, or redirection is suppressed. I'm guessing it's the latter, if redirection was permitted then the command prompt would be null, not even CR\LF (Prompt $_) which could cause mayhem. I cannot think of any reason to want to redirect Prompt output.

I'll have to give more thought to that..

Quote from: BatchFileBasics on June 03, 2009, 08:22:35 PM
yea, he was probably stressed
Actually I was quite SICK and had a throbbing headache...thought something like that
4664.

Solve : case statement??

Answer»

Is there such a thing as case statement in a batch file? I CHECK the web and they only use if statement.

thanksplease explain what you mean.
LIKE case sensitive?

Quote from: locbtran on May 20, 2009, 08:50:45 PM

Is there such a thing as case statement in a batch file? I check the web and they only use if statement.

thanks
no. 'case' is just a nicer if/else. Therefore, all you really NEED is if/else. if you really really need case support, use *nix SHELLS, eg bash, or other languages that GIVES you this kind of support.
Quote
case "$var" in
value1)
commands;
;;
value2)
commands;
;;
*)
commands;
;;
esac

That's an example like I used to use in my shell scripting days.
4665.

Solve : accessing files using IP address?

Answer» as a guest user can i ACCESS the files from another computer within the lan connection??Why would you want to see files on my computer? You sound sneaky.BillRich. did he say anything about your computer?

and most likely not.Yes you can, you'll have to set up file and printer SHARING though. Then you'll have to grant access from which ever computer you want access from to the host computer. You'll first have to make sure your network is set up correctly. Then you could access them through either I.P. Address or Computer Name. It's not very hard to do, would take less than 10min. or so, if you know what you're doing...

Good ol' Google...<--click!

By the way you should have posted this in the Networking area of the forum...oh, i thought r3ynz_t4n wanted to just be able to see all files on computer by ip.

Quote from: r3ynz_t4nz on June 01, 2009, 07:27:24 PM
as a guest user can i access the files from another computer within the lan connection??
Lan and IP are totally different things.whoops. COMBINES
TOT:"ACCESSING files using IP address"
OP:Quote from: r3ynz_t4nz on June 01, 2009, 07:27:24 PM
as a guest user can i access the files from another computer within the lan connection??
4666.

Solve : Run ".exe" as admin...assistance needed.?

Answer»

Hello,

I have been attempting to run an application with administrative privileges for some time now. I have made a few BATs ans have been unsuccessful. I am looking for some assistance please.

Here are some details:
The local account or domain account only has "user" lever privileges. What i want to do is create a BAT FILE that will execute the application and run in with admin rights while logged in with the "user" account.

Can some one help please?

Thank you!check runas /? in cmdI did. If you do it that way, you would be prompted for the admin password. The problem is i can not give the users the local admin password. The local users are students at our college. They mess with too MUCH stuff as it is already.

I guess i really am looking for a way to create a BAT that i could convert to EXE to run a file. It would need to include the admin password and would probably have to be put in the safe folder as the EXE that needs to be run. so i only found this:
Code: [Select]http://www.robotronic.de/runasspcEn.html
should work I'm not sure about this at all, but I believe the batch file must be run as administrator too.Devcom,

The LINK you provided worked like a CHARM. It took a few tries to get it going, but that was user ERROR.

Anyway, thank you to all who posted!

-HoFL

4667.

Solve : New here?

Answer»

Hi All im new here on the forms. i have instaled MS-DOS 6.22 on an old pc. But it will not boot to ms-dos. i have used the F5 key witch did not work. i get the non system disk message. when i use the ms-dos start up disk to get to an a promet it works from my floppy. when i switch dir. to C: and try to change dir. to dos it gives me an invalid switch. please direct me to the corect Q&A post that can help me. Or if some one can shine some light on this for me please. thanks in advance.Welcome to the CH forums.

Did you transfer system files from the floppy to the hdd using SYS C:

Please read this advisory post.

Yes i have done that and thank you for posting back so quickly.
I have read most of the Q&A when it come to installing may be i have just been LOOKING in the wrong place in the Q&A. Though my problem is still going on.

OK the PC in question is a Packard bell model #P160119601, the motherboard is Agna-6wmm7, it uses PC-100 ram 64 megs, hard drive is a WD Caviar 84AA, The OS is MS-DOS 6.22. It has a floppy 3.5 and a DVD ROM.

I had downloaded the MS-DOS 6.22 disk image from the net. i used a programme called winimage to write them to 1.44 floppy. 3 disk and even made a start-up disk from this very disk that works. I did the install and it went very well. it told me to remove my floppies and reboot. this is where i end up with the problems it will not boot. (Non-System disk or disk error) "i did the "sys C:" comand. i have checked that "autoexec.bat file as well. when i use the start up disk it will start up and take me to an "A:" so i changed drives with "C:" then "Dir/w" to brang up the files and Dir. when i use "CD/MS-DOS" it gives me (Invalid switch - /MS-DOS)

i have 20 files listed on the c drive. they are "ATTRIB.EXE, CHKDSK.EXE, DEBUG.EXE, EXPAND.EXE, FDISK.EXE, FORMAT.COM, MEM.EXE, SYS.COM, EDIT.COM, QBASIC.EXE, SCANDISK.EXE, XCOPY.EXE, DRVSPACE.EXE, MSD.EXE, UNDELETE.EXE, COMMAND.COM, [MS-DOS], WINA20.386, CONFIG.SYS, AUTOEXEC.BAT.
IT IS 20 FILES USEING 923,927 BYTES

am i missing something
CD/MSDOS.....drop the -wow, someone is still using outdated OS.i can now get in too the MS-DOS Dir. had to change what i typed in the prompt i typed "CD\MS-DOS" instead of "CD/MS-DOS" but it still does not boot. this is how my autoexec.bat looks.

C:\MS-DOS\SMARTDRV.EXE /X
@ECHO OFF
PROMPT $p$g
PATH C:\MS-DOS
SET TEMP=C:\MS-DOS
MODE CON CODEPAGE PREPARE=((437) C:\MS-DOS\EGA.CPI)
MODE CON CODEPAGE SELECT=437
KEYB UK,,C:\MS-DOS\KEYBOARD.SYS

And yes some people still use this old stuff that's why i am re learning all the things i forgot about dos being my first PC was an 8088. that's pre386DX stuff. lol when you don't use knowledge it becomes forgoten. and i REALLY FEEL old now

so any thoughts on what i am missing other then my own memory. lolWas the HDD FDisked and set as the Primary active partition prior to installing DOS ? ?Yes i fdisk and formated FAT 16 Quote

set as the Primary active partition
?MS-DOS 6.22 has it's own installer. You did run this?

On the other hand, how did you acquire DOS 6.22? I'm not suspecting you of anything illegal, but if it was from the MS website, you might have acquired the MS-DOS "step-up" installer, which updates DOS 6.0 to 6.22. Otherwise, I would start from the top by booting from the Floppy, fdisk-ing and formatting C: and attempting to run through the install again.back to the ms site lol thats about my speed . lol thanks man i have updated something i dont have on my pc.Ahh, well that would explain it then!

If your still interested though you can get DOS 6 on Ebay. I've even seen it in a few small computer stores, too.Yep thanks i called down to a PC shop near me and one of the techs there had a copy that he was willing to sell. I'm am installing as i post this.
4668.

Solve : Copy all files from usb to a folder?

Answer»

you couldnt? maybe your in need of my help TOOO.... all right then I'll explain it.wait! you already explained it all!

Quote

the code is wrong, which probably WONT do anything.

no I said that the way it was coded was wrong. add the /y switch if the stdout of xcopy is redirected to nul

if not, dont use redirection at allwhat??? I never heard such poor DOS commands.Quote from: squall_01 on May 20, 2009, 06:29:31 AM
what??? I never heard such poor dos commands.

which PART of nt command you dont understand?I used the code that TheShadow posted, and added /y

Thanks all
4669.

Solve : batch file to delete files?

Answer»

ok i saw a batch file code on youtube when i was just surfing the videos, but i cant find it again, and what the file did was delete a file that u dragged into it, kinda like the recycle bin cept it deletes it straight away and doesn't ask if you WANT to delete it. can any one tell me what the code is, if they have anything similar???Code: [Select]@echo off

del /Q "%1"
sth like this ??Quote from: devcom on May 15, 2009, 02:17:33 PM

Code: [Select]@echo off

del /Q "%1"

erm, what does the /Q "%1" do?/Q
Quote
doesn't ask if you want to delete it

%1 is SET if you drag a file into script.batnice i DIDNT know that, thanks man well i ges that this will do the job thanksok it doesnt work, it SAYS cannot find the file path specifiedIn command prompt, type:

del /?If you want to delete both file and folder, please REMOVE rem.

Code: [Select]@echo off
if "%~1" neq "" (
del /f /a /q "\\?\%~f1" 2>nul
rem rd /s /q "\\?\%~f1" 2>nul
)
4670.

Solve : a progressbar that indicate passed percents?

Answer»

hi
with your help now i've finished 80% of my program thank you all
=====================================================
well my program should search and do such a heavy duty so it's possible that take a while to finish it's job
but now i need a progress bar that shows how much percent has been passed and how much remains
i wonder if a graphical progress bar could be possible but at least if it's possible it should be accurate .as my program reach to de end it should be 100%

is it possible?
below you can see a GIF progress bar that i dont think if i could use it



sth like this ?

Code: [Select]@echo off

setlocal enabledelayedexpansion
set proc=0

:LOOP
cls
echo.%proc% %%
echo.%TimeBar%

if %proc% equ 100 goto DONE
ping -n 1 -w 500 1.1.1.1 >nul

set TimeBar=
set Space=

set /a bvar+=1
for /L %%a in (0,1,%bvar%) do set TimeBar=!TimeBar!#
set /a svar=48-%bvar%
for /L %%a in (0,1,%svar%) do set Space=!Space!
set TimeBar=[%TimeBar%%Space%]

set /a proc=(%bvar%*10)/5


goto LOOP

:DONE
echo DONE!
pausewow !! thanks devcom
what a beautiful progressbar
but how can this progressbar find out how percent of my progress has been gone?
i think you need to make this like this:

Code: [Select]echo.Progress: 0%
some commands
echo.Progress: 25%
some commands
echo.Progress: 70%
some commands
echo.Progress: 100%
some commandsthanks i will test it and let you know the result
but how is it possible to bring our progressbar to front of screen?(something like always on top)
well my program is more than 400 line so is there anyway that we divide our screen in 2 parts? one part belong to progressbar and other part for our processing?

or if you have other idea i will be very glad to hear it
thanks dear devcom DV,

There is no color. What progress is being measured?

XP OS and IE8 ALREADY have a progressbar.

Do you often invent the Wheel?

4671.

Solve : Batch file to ping equipment?

Answer»

Hi, this is my first post here so I'm hoping it doesn't sound too rediculous.

I am writing a batch file to ping equipment at various different locations, I already have it so that it can pull the first three octets of the IP based on store number but for some reason cannot get the Last octet to pull correctly from a different file USING the same style command. I was wondering if someone may be able to point me in the right direction:

The file it is pulling from is LastOctet.ini and is setup as such:

Printer,99
ScriptPro,199
Workstation1,97
etc

This is the snippet of the section that is not working, I CURRENTLY have it in it's own batch for testing purposes.

@ECHO on
cls
Title [----- : Store systems ping : -----]

Set IP_LIST=IP.ini
Set LAST_OCTET=LastOctet.ini
Set STORE=StoreNumber.ini
Set PING_OUTPUT=PingOutput.txt
Set IP=
Set OCT=

if exist %PING_OUTPUT% del %PING_OUTPUT%

:GetOct
FOR /F "eol=; " %%i in ("%LAST_OCTET%") do call :TestOct %%i

:TestOct
Set TEST_OCTET=%1%
FOR /F "eol=; tokens=1,2 delims=, " %%i in (%LAST_OCTET%) do if %%i==%TEST_OCTET% set OCT=%%j
if "%TEST_OCTET%"=="" goto OCTnotFOUND
else echo.%STORE_NUMBER% - %TEST_OCTET% - %IP%.%OCT% FOUND! >>%PING_OUTPUT%


:IPnotFOUND
:OCTnotFound
:END

and what it returns is:
if ScriptPro == set OCT=199
it does not appear to be running the comparison. I think I'm missing something really simple?

This is my first attempt at a batch file such as this.
Any help is greatly Appreciated
Thank you
Simon

if you call batch or label there are %1, %2 etc.

so change this:
Set TEST_OCTET=%1%
to
Set TEST_OCTET=%1

and try again Thank you, however I TRIED your suggestion and it is STILL returning :

if SCRIPTPRO == set OCT=199

should be if SCRIPTPRO = SCRIPTPRO SET OCT=199

Thank you again - SimonCode: [Select]@ECHO on
cls
Title [----- : Store systems ping : -----]

Set IP_LIST=IP.ini
Set LAST_OCTET=LastOctet.ini
Set STORE=StoreNumber.ini
Set PING_OUTPUT=PingOutput.txt
Set IP=
Set OCT=

cd /d "%~dp0"
if exist %PING_OUTPUT% del %PING_OUTPUT%

:GetOct
FOR /F "usebackq" %%i in ("%LAST_OCTET%") do call :TestOct %%i
goto :END

:TestOct
Set TEST_OCTET=%1
if "%TEST_OCTET%"=="" goto :OCTnotFOUND
FOR /F "tokens=1,2 delims=," %%i in (%LAST_OCTET%) do (
if "%%i"=="%TEST_OCTET%" (
set OCT=%%j
) else (
echo.%STORE_NUMBER% - %TEST_OCTET% - %IP%.%OCT% FOUND!>>%PING_OUTPUT%
)
)
goto :END

:IPnotFOUND
goto :END

:OCTnotFound
goto :END

:END

4672.

Solve : find txt files based on contents?

Answer»

Quote from: mioo_sara on June 04, 2009, 09:44:22 AM


i believe you deserve to WORK in microsoft company


Careful there.

You obviously intend this as a compliment.

Those of us who suffered total computer lockup's EVERY other evening upon "Shutdown" would take it as an insult,
Especially since the computer remained unusable until the power plug was REMOVED,
and upon the next restart Windows would reprimand the user for "failing to shutdown PROPERLY" ! !

Alan
4673.

Solve : issue with space in UNC path?

Answer»

hey all,

I am having trouble getting a BATCH to work correctly. Basically what I wish to do is COPY the entire contents of a server folder to a folder in the current dir. I have everything working except that there is a space after %A%. see below:

Code: [Select]@echo OFF
:START
CLS

SET ANSWER=

echo DO YOU WISH TO COPY THE NEW PD DATA SETS?
ECHO.
ECHO.

SET /P ANSWER=YES OR NO:

IF '%ANSWER%' =='' echo %ANSWER% is not a valid choice && GOTO START

echo %ANSWER% |findstr /i /r "[n]" > NUL

IF /I %errorlevel% EQU 0 echo you chose no && GOTO STOP

GOTO COPY


:COPY

CLS

echo NOW SETTING UP TO COPY DATA SETS
ECHO.
ECHO.

REM SERVER AND FOLDER PATH TO PD DATA

SET PDPATH=\\[server]\[share]\

REM THIS WILL MAKE THE TEXT FILE THAT THE NEWEST PD DATA
REM FOLDERS WILL BE ADDED TO.

echo 5745-ALACHUA> %TEMP%\PDFILEINFO.TXT
echo 5630-BAKER>> %TEMP%\PDFILEINFO.TXT
echo 5653-BAY>> %TEMP%\PDFILEINFO.TXT
echo 5466-BRADFORD >> %TEMP%\PDFILEINFO.TXT

REM THIS WILL SET UP THE COUNT
set count=0

REM THIS WILL PULL THE INFORMATION FROM THE PDFILEINFO.TXT FILE
REM AND SET IT UP FOR USE.

SET FILELOC=%TEMP%\PDFILEINFO.TXT
CLS
FOR /f "usebackq tokens=1" %%A in ("%FILELOC%") do (
SET A=%%A && CALL :GETDATA %%A
)

echo JOB COMPLETED!

IF EXIST "%TEMP%\PDFILEINFO.TXT" DEL "%TEMP%\PDFILEINFO.TXT"
PAUSE
GOTO STOP


:GETDATA

SET F2=%A:~0,2%00

MKDIR "%CD%\%A%"

ping -n 1 -w 1000 1.1.1.1 > nul

echo "%PDPATH%%F2%\%A%"
echo "%CD%\%A%\"

pause
XCOPY "%PDPATH%%F2%\%A%" "%CD%\%A%" /E /I /Y


SET /A count=%count%+1
ECHO %count% Folder %A% CREATED

PAUSE

:STOP


please let me know if you can see something I am doing wrong.

thanks,
wayne1. set A=%%A& CALL:GETDATE %%A

2. set/a count+=1 is more simple though both will works.

3. IF '%ANSWER%' =='' echo %ANSWER% is not a valid choice && GOTO START
the space in if STATEMENT will cause trouble, not sure why you use &&
if '%ANSWER%'='' echo ......

statement1 && statement2
if the result of statement1 is not errorlevel 1, then execute statement2

statement1 & statement2
execute statement1, then statement2 no matter the errorlevel of statement1

4. IF /I %errorlevel% EQU 0 echo you chose no && GOTO STOP
what the uppercase or lowercase of '0'?

sorry if i make a lot of comments thanks but that dose not answer my original issue.

Why am I getting a space after %A% when it pulls from the text file?Quote from: wbrost on May 20, 2009, 07:45:00 AM

thanks but that dose not answer my original issue.

Why am I getting a space after %A% when it pulls from the text file?
You PROBABLY have a trailing space on a line - you may not be able to see it, but the computer can and it will be significant to it
GrahamQuote from: wbrost on May 20, 2009, 07:45:00 AM
thanks but that dose not answer my original issue.

Why am I getting a space after %A% when it pulls from the text file?

i already gave answer for that on no.1, the extra space if not from text file.
original code:
Code: [Select]SET A=%%A && CALL :GETDATA %%Anotice the space between %%A and &&, that's where the extra space coming from
you could modify it to
SET A=%%A& CALL :GETDATA %%A
or
SET A=%%A
CALL :GETDATA %%A


ok, actually there is one statement that cause another extra space, but the for loop nullify the effect of the extra space:
echo 5466-BRADFORD >> %TEMP%\PDFILEINFO.TXT
modify to:
echo 5466-BRADFORD>>%TEMP%\PDFILEINFO.TXT
or
>>%TEMP%\PDFILEINFO.TXT echo 5466-BRADFORDok thanks was trying to make it read better.... oh well thanks.
4674.

Solve : BAtch file script?

Answer»

hello,

I have a script that transfer files from WINDOWS to Unix and I am not expert to batch FILE scripting,
how can I create a file and logs in there if the data was sent or not? Also, this log file will regularly
update as per activity/per day.

Thank you!Do you mean transfer it from one partion to another or do you mean by over a network?I transfer files from a Windows pc to a unix pc. through FTP by a batch file.
I would like to add inside that script (batch file), an option that will log to a certain logfile if the transfer was successful or not.

Thanks!Can you show us your script? Then I can tell you how to generate the log.Sure, here it is.Thanks!

Batch file:
@echo off
f:
cd \
cd PROGRAM files\winscp
winscp.exe /console /script=c:\script\data.txt

data.txt
option batch on
option confirm off
open (userid:[emailprotected])
ascii
lcd c:\data\ (source data)
DIR
cd /data_files/Win2UX (TARGET path at unix)
put *.res
byeCode: [Select]@echo off
cd /d "F:\program files\winscp"
winscp.exe /console /script=c:\script\data.txt>C:\result.log
Actually, we don't need use the tool winscp.exe to upload files to FTP server. We can use the windows built-in command ftp to do it.

4675.

Solve : Listing the Folder names and Sizes using DOS?

Answer»

Can someone let me know how can we get the folder name and size using MS DOS.?Do you MEAN real MS-DOS or Windows command?Anything would do. Either MS Dos or Windows..Code: [Select]@ECHO off
for /f "tokens=3,4 skip=3" %%A in ('dir /a:-d') do (echo %%A %%B)
The last two lines are the total of all the files, and the bytes free respectively.

FBim sure there is a SIMPLER way to do this, like u can just go into command prompt and type dir and the file name and it shud come up with the files and folders and there sizesok 'master'.... post some code which displays only size and name which is simpler than my code.

FBIf you have some folders in C:\test\, list the folder name and size:

Code: [Select]@echo off
for /d %%a in (C:\test\*) do (
set /p=%%a <nul
for /f "tokens=3-4" %%h in ('dir "%%a"^|find "File(s)"') do (
echo %%h %%i
)
)the following will recursively list directory names and sizes:

dir/s|findstr "bytes$ Directory"SYSINTERNALS du utility very useful

http://technet.microsoft.com/en-us/sysinternals/bb896651.aspx

4676.

Solve : Reading 3.5 in. diskettes?

Answer»

I have a couple of 3.5 INCH floppy diskettes which I need to read. When I put the diskettes into a floppy drive and select it in My Computer, I get the response "The disk is not FORMATTED do you want to format it now?"

I know that at one TIME there were files on the disks. There are very old in computer terms some around 18 years. I realize that at some time while in storage they could have been erased by a magnet r something. I was wondering if anyone out there knows of any software that can show me what is on the disk? I wasn't sure if they were created on a 16 bit SYSTEM if they could be read on a 32 bit system. I realize that what the error message is telling me is that there is no FAT table or anything set up. Did Microsoft change the diskette format over time?

Thanks for any help.

Greg18-years old, you're fortunate the disk(s) haven't self-destructed!

See MS KB140060

Good luckdepends on your os maybe if you do an error checking that it may help, not for sure but it did help fix my one disk.Yeah, I realize I'm lucky they made it to me. Thanks for the help. I'll try these two suggestions and see what happens.

GregJust the natural aging of the material in floppy disks, plus the effect of cosmic rays on the recording surface, cause floppy disks to "Forget".
They were never intended to be "Permanent" storage.

There is probably still some amount of recording on those OLD disks, but that level is lower than the drive is able to sense.
If you had different drives to try the disks on, you might find a drive that could read the disks.

Good Luck,

4677.

Solve : Batch Job EML writer?

Answer»

The aim of the SCRIPT below is to send an email when perfmon on the server meets a certain level.

That in it SELF works but what perfmon can also do is create a record of when it hits that level, what i want to be able to do is attach that log *.blg file to the email that is being created below.

Has anyone come across a way of adding an attachment using script.


Code: [Select]d:

CD D:\Notifications\Scripts\

del W3WPprocess.eml /q

cls
************************************
*Waiting for log file to be written*
***********************************
echo off
rem PING 1.1.1.1 -n 1 -w 70000 >NUL
cls
echo on
**************************************
*Waiting for email file to be written*
*************************************
echo x-sender: [emailprotected] >> W3WPprocess.eml
echo x-receiver:[emailprotected] >> W3WPprocess.eml
echo x-receiver:[emailprotected] >> W3WPprocess.eml
echo x-receiver:[emailprotected] >> W3WPprocess.eml
echo x-receiver:[emailprotected] >> W3WPprocess.eml
echo From: [emailprotected] >> W3WPprocess.eml
echo TO: [emailprotected] >> W3WPprocess.eml
REM echo TO: [emailprotected];[emailprotected];[emailprotected];[emailprotected] >> W3WPprocess.eml
echo Subject: Web-001 W3WP Process(es) is Hogging processor USE>> W3WPprocess.eml

echo.>> W3WPprocess.eml
echo Please Check status of Web-001 (Live WEBSITES) >> W3WPprocess.eml
echo.>> W3WPprocess.eml
echo W3WP Process(es) is hogging processor use for the last 2 mins at 100%% please check. >> W3WPprocess.eml
echo.>> W3WPprocess.eml
echo This is an automated email message. >> W3WPprocess.eml
echo.>> W3WPprocess.eml
echo Thanks >> W3WPprocess.eml
echo.>> W3WPprocess.eml
echo Web-001 >> W3WPprocess.eml

move W3WPprocess.eml c:\inetpub\mailroot\pickup

4678.

Solve : School batch program.(math)?

Answer»

Quote

(10x+10)
Well... NEVER did get straight As in that class.
(Actually, I flunked the first year.)What happened to cdh473? Looks like he doesn't need our help anymore....hmm...Quote from: Ironman on May 13, 2009, 04:50:57 PM
What happened to cdh473? Looks like he doesn't need our help anymore....hmm...
That's because he knows that we know that he knows... in the end: He knows we know.because that makes sense..Quote from: Xenfire on May 14, 2009, 04:39:27 PM
because that makes sense..
But you see, if he knows we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know that he knows that we know...


Anyway, it is a failed ATTEMPT at putting a virus on our systems...blargh wth ill put the source code


@echo off
title SolutionFinder
color c
cls
:login
call solutionfinderauthorization.bat
cls
if %action% == ***codenotshowable*** goto start
exit
:start
echo Please choose what you would like to do.
echo.
echo 1.Find a solution
echo 2.Exit
set /p action=
cls
if %action% == 1 goto SFbegin
if %action% == 2 exit
set return=start
goto errorpage
:errorpage
echo Sorry, but your answer was invalid.
pause >nul
cls
goto %return%
:SFbegin
echo Choose an equation format.
echo X is the actual variable, where Y is a predefined number,
echo and O is an operation.
echo.
echo 1. YOY=X
echo 2. YOX=Y
echo 3. Y(X)OY=YOY
echo 4. YOXOY=Y
set /p action=
cls
if %action% == 1 goto yoyisx
if %action% == 2 goto yoxisy
if %action% == 3 goto y*xoyisyoy
if %action% == 4 goto yoxoyisy
set return=SFbegin
goto errorpage
:yoyisx
echo Enter your first predefined number.
set /p action=
cls
set yone=%action%
echo Enter your operation. Subtract=-;Add=+;Multiply=*;Divide=/
set /p action=
set oone=%action%
cls
echo Enter your SECOND predefined number.
set /p action=
cls
set ytwo=%action%
set /a answer=%yone% %oone% %ytwo%
echo You got %answer%.
pause >nul
cls
goto start
:yoxisy
echo Enter your first predefined number.
set /p yone=
cls
echo Enter your operation. Subtract=-;Add=+;Multiply=*;Divide=/
set /p oone=
if %oone% == + set ooneopposite=-
if %oone% == - set ooneopposite=+
if %oone% == * set ooneopposite=/
if %oone% == / set ooneopposite=*
cls
echo Enter your second predefined number.
set /p ytwo=
cls
if %oone% == - set /a answer=%yone% %oone% %ytwo%
if %oone% == / set /a answer=%yone% %oone% %ytwo%
if %oone% == + set /a answer=%ytwo% %ooneopposite% %yone%
if %oone% == * set /a answer=%ytwo% %ooneopposite% %yone%
if %oone% == - goto yoxisynegative
if %oone% == / goto yoxisynegative
if %oone% == * goto yoxisypositive
if %oone% == + goto yoxisypositive
:yoxisypositive
echo Here is the answer, with the work.
echo.
echo %yone%%oone%X=%ytwo%
echo.
echo %ytwo%%ooneopposite%%yone%
echo.
echo So the answer is X=%answer%.
echo.
pause
cls
goto start
:yoxisynegative
echo Here is the answer, with the work.
echo.
echo %yone%%oone%X=%ytwo%
echo.
echo %yone%%oone%%ytwo%=%answer%
echo.
echo So the answer is X=%answer%.
pause >nul
cls
goto start
:y*xoyisyoy
echo Enter your first predefined number.
set /p yone=
cls
echo %yone%x
echo Enter your second operation. Subtract=-;Add=+;Multiply=*;Divide=/
set /p oone=
cls
echo %yone%x%oone%
echo Enter your second predefined number.
set /p ytwo=
cls
echo %yone%x%oone%%ytwo%=
echo Enter your third predefined number.
set /p ythree=
cls
echo %yone%x%oone%%ytwo%=%ythree%
echo Enter your third operation. Subtract=-;Add=+;Multiply=*;Divide=/
set /p otwo=
cls
echo %yone%x%oone%%ytwo%=%ythree%%otwo%
echo Enter your last(fourth) predefined number.
set /p yfour=
cls
if %oone% == * set ooneopposite=/
if %oone% == / set ooneopposite=*
if %oone% == - set ooneopposite=+
if %oone% == + set ooneopposite=-
if %otwo% == * set otwoopposite=/
if %otwo% == / set otwoopposite=*
if %otwo% == - set otwoopposite=+
if %otwo% == + set otwoopposite=-
set /a secondhalfofanswer=%ythree% %otwo% %yfour%
set /a extraoperationsolve=%secondhalfofanswer% %ooneopposite% %ytwo%
set /a answer=%extraoperationsolve% / %yone%
echo %yone%x%oone%%ytwo%=%ythree%%otwo%%yfour%
echo.
echo %yone%x%oone%%ytwo%=%secondhalfofanswer%
echo %ooneopposite%%ytwo% %ooneopposite%%ytwo%
echo %yone%x = %extraoperationsolve%
echo /%yone% /%yone%
echo x = %answer%
echo.
echo So the answer is X=%answer%.
pause >nul
cls
goto start
:yoxoyisy
echo Enter your first predefined number.
set /p yone=
cls
echo %yone%
echo Enter your first operation.
set /p oone=
cls
echo %yone%%oone%X
echo Enter your second operation.
set /p otwo=
cls
echo %yone%%oone%X%otwo%
echo Enter your second predefined number.
set /p ytwo=
cls
echo %yone%%oone%X%otwo%%ytwo%=
echo Enter your last(third)predefined number.
set /p ythree=
cls
if %oone% == / set ooneopposite=*
if %oone% == * set ooneopposite=/
if %oone% == + set ooneopposite=-
if %oone% == - set ooneopposite=+
if %otwo% == / set otwoopposite=*
if %otwo% == * set otwoopposite=/
if %otwo% == + set otwoopposite=-
if %otwo% == - set otwoopposite=+
set /a firstiso=%ythree% %otwoopposite% %ytwo%
set /a secondiso=%firstiso% %ooneopposite% %yone%
set answer=%secondiso%
echo %yone%%oone%X%otwo%%ytwo%=%ythree%
echo %otwoopposite%%ytwo% %otwoopposite%%ytwo%
echo %yone%%oone%X %firstiso%
echo %ooneopposite%%yone% %ooneopposite%%yone%
echo X = %answer%
echo.
echo So the answer is X=%answer%.
pause >nul
cls
goto start



Quote
***code not showable***

Somethings up....how.....

That just had something
you didnt need to see
that part of the code wasn't needed
...*CENSORED* could be up closeQuote from: cdh473 on May 17, 2009, 04:27:24 PM
how.....

That just had something
you didnt need to see
that part of the code wasn't needed
...*censored* could be up close
We didn't need to see? If you post the source, you post the WHOLE thing. And why do we not need to see it?


Anyway, WolframAlpha can do this online, no need to download anything.It's probably just a password. not really needed for debugging.Quote from: BC_Programmer on May 18, 2009, 07:24:01 PM
It's probably just a password. not really needed for debugging.
why would he want to password protect it, then post it here?..

he DIDN'T post it. that's the part he's not showing.

On the other hand, it wouldn't make sense as a password since there was no user input, and it's looking at %action%. so what you posted before stands true.

Additionally, I cannot see why it wouldn't be showable; It's just a batch file.
4679.

Solve : drive detection?

Answer» HI im making a batch fine on a memory stic and it needs to know when dirive the memory stic is can anyone help plz

also how can you make the "copy" command coppy the CONTENTS of folders inside the directory Code: [Select]set thisdrive=%~d0
set letter=%thisdrive:~0,1%
ECHO this batch is being run from drive %thisdrive%
echo the letter is %letter%
Quote from: steven32collins on May 16, 2009, 12:13:49 PM
also how can you make the "copy" command coppy the contents of folders inside the directory

Don't bother, use xcopy.

TYPE xcopy /? for full help, and type xcopy into Google for even more help.

4680.

Solve : Updater?

Answer»

I am experiancing some difficulties with NOD32 anivirus, the problem is that it won't update, when you click on the updater function it should update to the latest version but it does not?

Is there a way that I can make a batch file that will make it force update it.

My NOD32 bussiness edition is licensed
I have Windows XP

Thank you for help in anyway,
Tan_ZaSorry, I can't help with that. PERHAPS you'd be better to post on a dedicated NOD32 forum such as this one..

Good luck..Thank you I'm sure that, that websiter might help me in some way, but I would still like to know how to make a bat file to force update NOD.

Tan_ZaOK but you'll have to wait for SOMEONE with experience of NOD.

The update file I think gets tranformed from a update.ver to a update.exe on run time, so it wouldn't be that hard if we could say replicate that and work on from there?

Tan_ZaSorry, that's way above my NOD knowledge level.Thats ok, I have figured out a way to make it kinda force start, my batch file makes the updater.ver read all of the DATA from the NOD32 web site and now it has got all of the data it needs to do this, thank you all for your help anyway.

Tan_ZaI take updatings Nod32 as Kaspersky, in one archive, on http://bestfiles.web44.net . It is convenient For me that is possible at home absolutely without the INTERNET to establish updatings Nod32. Perfectly.
There updatings APPEAR on some times in day. For updating logins and passwords are not necessary. Updatings can be transferred and established on any computer which even not has been not connected to the Internet.
It is pleasant to me.Quote from: Karakum87 on June 05, 2009, 02:41:59 AM

I take updatings Nod32 as Kaspersky, in one archive, on http://bestfiles.web44.net . It is convenient For me that is possible at home absolutely without the Internet to establish updatings Nod32. Perfectly.
There updatings appear on some times in day. For updating logins and passwords are not necessary. Updatings can be transferred and established on any computer which even not has been not connected to the Internet.
It is pleasant to me.
I have no idea what language that site is in, but I sure can't read it...1. It looks like an illegal crack site with pornographic images.

2. ESET monitor NOD32 signature downloads and inspect the registration details, if too many different IP address do a download using the same details that is detected and dealt with as illegal.

3. I use Digiguide to give me television program listings.
If the Windows based GUI should fail to download revisions I would not expect a BAT script to force it.
I would want Digiguide to be fixed properly, but meanwhile if the BAT script worked I would use it - how bad could BAT tampering of a GUI be - I might switch on the television one hour too late for the program I wanted.

How bad is BAT tampering with the ESET NOD32 GUI ?
I would rank it along with spitting against the wind, but from a different orifice ! !
I would rather work with yesterdays signatures, or even month old signatures, rather than "bet the farm" upon a unauthorised script failing to properly adjust the registry and other mysterious Windows type things that NOD32 may use.

If you can use a BAT script to force a replacement of a virus signature, then any "script kiddie" could write a virus that would delete the signatures before ESET could recognise its life was in danger.
I paid good money for NOD32 and I do not think it is vulnerable - but I would not bet my life and identity upon continued protection if I interfered with its normal operation.

Alan
4681.

Solve : Finding a file using batch?

Answer»
C:\&GT;type yourfile.bat
Code: [Select]rem @echo OFF
cd \

cd NoDelete

copy yourfile.txt saveyourfile.txt

cd \

del /s yourfile.txt

cd nodelete

copy saveyourfile.txt yourfile.txt

del saveyourfile.txt
C:\>

OUTPUT:


C:\>NOTEPAD yourfile.bat

C:\>yourfile.bat

C:\>rem @echo OFF

C:\>cd \

C:\>cd NoDelete

C:\nodelete>copy yourfile.txt saveyourfile.txt
1 FILE(s) copied.

C:\nodelete>cd \

C:\>del /s yourfile.txt
Deleted file - C:\yourfile.txt
Deleted file - C:\Documents and Settings\Bill Richardson\Desktop\yourfile.txt
Deleted file - C:\nodelete\yourfile.txt

C:\>cd nodelete

C:\nodelete>copy saveyourfile.txt yourfile.txt
1 file(s) copied.

C:\nodelete>del saveyourfile.txt

C:\nodelete>
4682.

Solve : how do i start network connection with batch??

Answer»

Well...my computer is full of bugs since i installed/reinstalled windows in C: and then installed/reinstalled in D: and now installed back in C:
Bugs:
1.When i open my PC...if i'm afk when the explorer and the files on desktop appears I got to restart my PC because the hole PC is FROZEN...I can only move the mouse and nothing else works...no task manager...no start bar....NO NOTHING! To solve the PROBLEM i got to open task manager at processes and It works somehow.
2.Since i'm a lazy person And my NETWORK doesn't connect automatically when i start the PC i made a shortcut in the common startup to start when the pc starts. The freeze thing STARTED after I put the shortcut in common startup.
3.The coolest one When i click the option to see hidden files/folders, i click Ok or Apply buy it resets and nothing i can do can make me see hidden files/folders in my computer
4. When i'm surfing net or just doing something on my PC all the things that i got on the start bar minimized or hidden by the window where i'm doing something, all the things come in front of that thing from 5 to 5 minutes it's pretty annoying
And many more bugs...
My question is: How can i make a batch file that connects directly on the network? (i want to put that in the reg startup or common to stop the freeze?
And btw no1 answered me on a post, how can i execute/run a file stored in an exe? I really need to know how to play an mp3 song stored in an exe like this gay thing [link Removed]Don't open if ur a kid...when u start the exe a movie starts with 2 gays fuc**** (i'm not gay but SOMEONE send the file to me and i got it into my pc to send to ppl to make jokes)

4683.

Solve : can batch file return day of the week??

Answer»

I'm TRYING to WRITE a batch file that opens, LET say notepad.exe on Sunday @ 17:00.

I know you can get and set the TIME using batch file but can you get the day of the week using batch file?

thanksnever mind, my colegue figure it out.

you use, "date"If you want more specified parts of the day, like the month, day or YEAR, then use SET:
(If your time format isnt like MM\DD\YYYY, then this won't work)

Code: [Select]@echo off
set month=%Date:~4,2%
set day=%Date:~7,2%
set year=%10,4%

4684.

Solve : Delete files - older than 6 days?

Answer»

I have a folder ( Example E:\sigbackup ) which is getting backup FILES from a system daily.

I am in NEED of someone's help to create a batch file and put in Windows Schedule to run daily to delete the file in folder E:\sigbackup which is more than six DAYS old.
first, you should make an effort to produce CODE yourself.
second ,you could have search the forum for "delete files" and see what you can find.
here's one thread similar to what you required. see the suggestions i posted (there should be 2 , one using find, the other a vbscript).

4685.

Solve : Check for software version?

Answer»

Hi all, this is my first post on this site, and I THANK any and all repliers!

I'm trying to create a simple batch file that will check for a certain version of software, and then run a PATCH if that version isn't there. I WANT to update Adobe READER from 9.1 to 9.1.1.

This is what I have so far:

ECHO OFF
c:
Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL
IF %ERRORLEVEL% == 0
(
msiexec /update "\\server\share\AdbeRdrUpd911_all_incr.msp" /quiet
ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date% >> \\server\logging\Adobe_Reader_9.1.1-update.txt
)

It's not working and I know it's something basic. Try this: NOT TESTED

ECHO OFF
c:
Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL
IF %ERRORLEVEL% == 0 (
msiexec /update "\\server\share\AdbeRdrUpd911_all_incr.msp" /quiet
ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date% >> \\server\logging\Adobe_Reader_9.1.1-update.txt
)

Lose the spaces! They are significant in an IF test where you use the == equality operator.

Code: [Select]IF %ERRORLEVEL%==0
or use EQU

Code: [Select]IF %ERRORLEVEL% EQU 0

Code: [Select]@ECHO OFF
Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL
IF ERRORLEVEL 1 (
msiexec /update "\\server\share\AdbeRdrUpd911_all_incr.msp" /quiet
>>\\server\logging\Adobe_Reader_9.1.1-update.txt ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date%
)
Thanks for all your help!


This WORKS:

@ECHO OFF
Reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" /s | find "DisplayName" | find "Adobe Reader 9.1.1" >NUL
IF ERRORLEVEL 1 (
msiexec /update "\\server\share\Adobe Reader 9.1\AdbeRdrUpd911_all_incr.msp" /quiet
ECHO The Adobe Reader 9.1.1 patch was applied to %computername% at %time% on %date% >> \\server\share\Adobe_Reader_9.1.1-update.txt
)

4686.

Solve : Assigning value to a variable.?

Answer»

Hi All,

Brains gone into netural with this (somewhat exhausted).

Trying to assign a value to a variable.

set /a xCount=netstat -an | find "%IB-IPPort-List%" | find /c /i "established"

Just doesn't want to work - how can I do this ?

Cheers (&stumped),
Cameronwell im no expert. but it looks like the seperators | is what is messing it up. the | is creating new line commands and skipping the user input.

TRY something along the lines of:
Code: [Select]set xCount1=netstat -an
set xCount2=find "%IB-IPPort-List%"
set xCount3=find /c /i "established"
set xcount=%xcount1% %xcount2% %xcount3%
set /p xcountmain=%xcount%
and once again, im no expert. but thats how i would see it happening
Thanks for the effort BatchFileBasics,

Unfortunately that idea doesn't work.

Cheers,
Cameronaw, dang.

well can i ask what the problem is when you try to run\execute the code?
paste the output pleaseHint:
Break your code up into smaller parts and use ECHO to show the current value of important variables.Thanks Geek - had tried that - but why does the pipe not work in the same way as the cmdline ?

Whiped up the following as alternate solution.

:::-----------------------------------------------------------------------------------
:::-- Checking Outbound Customer Links ...
:::-----------------------------------------------------------------------------------

netstat -an | find "10.223.26.20:85" > %xFile01%

For /F "tokens=1-6 delims=: " %%i in (%xFile01%) do call %0 CheckStatus %%j %%K %%n

goto :FinishRun

:::-----------------------------------------------------------------------------------
:::-- Call Functions ...
:::-----------------------------------------------------------------------------------

:CheckStatus

set yIP=%2
set yPort=%3
set yState=%4

::@echo ** IB - IP: %yIP% .. Port: %yPort% .. State: %yState% ..

IF "%yState%" EQU "ESTABLISHED" (
@echo ** IB - IP: %yIP% .. Port: %yPort% .. State: %yState% .. OK
) ELSE (
IF "%yState%" EQU "LISTENING" (
@echo ** IB - IP: %yIP% .. Port: %yPort% .. State: %yState% .. OK
) ELSE (
@echo ** IB - Check of IP: %%x from Customer - Not in Listening or Established State.
set MailSubject=Cal-Network Alert - Customer - Please INVESTIGATE.
set MailBody=`netstat -an | find "%yIP%:%yPort%"`
sendmail.vbs -f %MailFrom% -t %MAILTO% -s "%MailSubject%" -b "%MailBody%"
)
)

goto :EOFWho knows?
I have been using MS programs for years and I find that when you break things up into small chunks things start to work.
Moral: Function before Form
- OR -
Build the Barn this year,
Maybe paint it next year.lol Very good To get the output of a command into a variable, use FOR. Type FOR /? for examples and help.
You need a ^ before pipe.

Code: [Select]@echo off
set IB-IPPort-List=192.168.0.2
set xCount=netstat -an ^| find "%IB-IPPort-List%" ^| find /c /i "established"
echo "%xCount%"
pause
Hi Batcher - many thanks for the tip !!!

Never heard of the use.
Will give that a try in a test script.

Cheers,
CameronCode: [Select]for /f "tokens=*" %%a in ('netstat -an ^| find "%IB-IPPort-List%" ^| find /c /i "established"') do echo %%a
Indeed - that was my next step !!

See - there is a way to build the barn and paint it all in the same day

4687.

Solve : Login Screen in batch?

Answer»

I am looking for a way to make a simple login screen in batch, with the usernames and passwords stored in files.
I know that it isn't secure, but that's no problem.

Any help would be great. Try this:
Code: [Select]@ECHO off
echo.
echo.Enter your username:
set /p uname=
echo.Enter your password:
set /p pass=

Thats the login screen but how do you have the usernames and passwords stored in the files, all of them in the same one or in different files?For every user 2 files (1 for username) (1 for password)
Alright add this in:

Code: [Select]cd <folder where the files are>
If not Exist %uname%.TXT GOTO Fail
If not Exist %pass%.txt goto Fail
echo.
echo.Successfully Logged In!
pause
exit

:Fail
echo.User name or Password incorrect.
pause
goto Login
And add this:

Code: [Select]:Login
before this:

Code: [Select]echo.
echo.Enter your username:

Hope this helps
,Nick(macdad-)Works great, but is it possible to store the username and password IN a file?

i would prefer using one file for all users:

Code: [Select]@echo off
if not exist base.txt echo.>>base.txt

:MAIN
cls
set /p user=Username:
set /p pass=Password:

for /f "tokens=1,2 delims=;" %%F in (base.txt) do (

if "%%F" equ "%user%" (

if "%%G" equ "%pass%" (
goto LOGIN
) ELSE (
echo.Wrong password!
pause >nul
goto MAIN
)

)
)
echo.%user%;%pass%>>base.txt
goto MAIN

:LOGIN
cls
echo.User logged: %user%
echo.Pass : %pass%
pause >nul
goto MAINTried it and works perfect!

Thanks!

4688.

Solve : pen drive not formating?

Answer»

hello friends,my friend has bought a chinese pen drive by saying that it is of 80 gb,but he becomes fool,now i am trying to format it but it is not happening...will any body help me out how can i again use it?I'm AFRAID you cannot do anything. It's a fake device and cannot be fixed.yea, it seems like a prank drive.
or very corruptedOr a SCHEME to get money....ahh.
or maybe its non universal!
i mean. theres universal remotes, and then theres certain types of remotes.
and what if the chinese are plotting to ruin our economy.
or maybe the chinese are the plot of our bad economy.

ok im sorry, a.d.d. in its act.

or maybe, believing that an 80GB flash drive from china for cheaper then a 2GB flash drive is a bit shifty?or what if.
the currency is the same as memory.
1 Chinese yuan = 0.146402 U.S. dollars

so....1 chinese megabyte = 146.402 kb...
10 ch gb = 1.46 us gb
80 ch gb = 11.68 us gb? but different format?


that's pretty dumb.yea i know. im letting my mind free. thank you very much.
but i guess i can't do that in this forums without getting negative criticismYou're no worse off than ANYONE who would buy an 80 gig pen drive.
An 80 gig hard drive, OK, or an 8 gig pen drive, but NOT an 80 gig pen drive (Flash Drive).

That's sort of like a 10,000 horsepower compact car.

But, for formatting Flash Drives, I always use a little UTILITY from HP.
You can download it here:
USBFormat.exe http://www.box.net/shared/static/nkibqo9jvs.exe

You can even make a Flash Drive bootable with it, that is if you have a source for the three required DOS boot files.

Good Luck,
Shadow

4689.

Solve : copy con command?

Answer»

how can we come back on COMMAD prompt from copy CON COMMAND WITHOUT saving and without using ctrl+z ?press Control+Break.

4690.

Solve : How to move numeric characters from the start of the filename to the end in DOS?

Answer»

On Win XP SP3 using the MSDOS cmd prompt, is it possible to rename MULTIPLE files (all in same directory folder) with the following criteria:-
all files are street addresses ( ie 11 MickeyMouse Road.doc or .pdf )
I want to rename the files with the numeric PART of the address at the end of the file preceeded by , ie( MickeyMouse Road,11.doc(or.pdf))
If possible i also need to insert 4 characters (LAB_) at the start of the filename
ie LAB_MickeyMouse Road,11.doc (or .pdf)
The numerics can be from 1 to 4 characters long.
Can anyone advise the MSDOS commands to achieve this result? Would be much appreciated. are you the same guy as this?

a vbscript for you. for renaming the files, i leave it to you to read the manual to find out how
Code: [SELECT]Set objFS = CreateObject("Scripting.FileSystemObject")
strFolder = "c:\test"
Set objFolder = objFS.GetFolder(strFolder)
For Each strFile In objFolder.Files
strFileName = strFile.Name
ext = objFS.GetExtensionName(strFileName)
If ext = "pdf" Or ext = "doc" Then
strStreet = objFS.GetBaseName(strFileName)
splitted = Split(strStreet," ")
If IsNumeric(splitted(0)) Then
strname=""
For i=1 To UBound(splitted)
strname = strname & " " & splitted(i)
Next
strname = "LAB_" & Trim(strname) & "," & splitted(0)
WScript.ECHO strname & "." & ext
' Put your rename statement here.... i leave it to you

End If
End If
Next
Well for the second one,

@echo off
for /f "delims=" %%A in (dir /b FOLDER) do ren %%A LAB_%%A

should work...although I am working via DSi, so I can't test it.

4691.

Solve : How to extract file name in folder based on extension?

Answer»

I would like to extract the file name of a file with a certain EXTENSION in the current folder.

The extension is ".LGR", it's just a text file.

Is there a simple WAY to place this file name into a variable?
Thanks a lotThis ASSUMES there is only one file in the default directory which has the extension .lgr

Code: [Select]@echo off
cls
setlocal

for /f "delims=*" %%1 in ('dir /b *.lgr') do (
set variable=%%~n1
)

Yes, I only have one file with that extension.
Your code works great.
Thank you very muchThanks for coming back to REPORT your success.

Good luck.

4692.

Solve : redirect date to a file in a batch file?

Answer»

My final result is to change a file name to includes TODAY's date. Fro one batch file I call another batch to set the date as follows: (dbname is database name)
SET dbname=%1
cd X:\PUBLIC\SAP_AIX\performance_scripts\output
date /T > todaysdate
for /F "tokens=1-4 delims=/ " %a in (todaysdate) do set todaysdate=_%d%b%c
rename %dbname%_current_SAP_DB_status.lst %dbname%_current_SAP_DB_status%todaysdate%.lst

The variable todaysdate should look like this:
_20041213

When I type these commands from a command prompt, it works correctly. When I actually execute the batch file, I get the following ERROR when the date is sent to a file called todaysdate:
X:>date /T 1>todaysdate
dc was unexpected at this time.
So now the for loop doesn't WORK??!!:
X:>for /F "tokens=1-4 delims=/ " dc

Hi Jim,
I found your post and wonder if you found the solution.
I want to do something similar and it does not work.

Can you maybe help?
Thanks
Gabigabig, PLEASE don't bring back posts from 2004

if it wasn't answered 5 years ago. just leave itQuote from: Jim Crowley on December 14, 2004, 06:46:43 AM

SET dbname=%1
cd X:\PUBLIC\SAP_AIX\performance_scripts\output
date /T > todaysdate
for /F "tokens=1-4 delims=/ " %a in (todaysdate) do set todaysdate=_%d%b%c
rename %dbname%_current_SAP_DB_status.lst %dbname%_current_SAP_DB_status%todaysdate%.lst
@echo off
set dbname=%1
cd X:\PUBLIC\SAP_AIX\performance_scripts\output
for /f "tokens=2-4 delims=/ " %a in ('date /t') do set todaysdate=_%d%b%c
rest of code here...

Should work, but I'm on a DSi, so I can't test it right now.It's been five years so I doubt he could test it either.
4693.

Solve : Clear IE history.... ??

Answer»

Hello,

I want to clear Internet Explorer history by a batch file. Is it possible ?
I am using version 6.0. Guide me...Bye Have a Nice Day..

Superb Qinghao :-), It WORKED but an another window of command prompt is ALSO opening when I run it, can you explain me a little. Thanks. Have a Nice Day.Much better idea... use Firefox Quote from: fireballs on AUGUST 15, 2008, 03:25:26 AM

Much better idea... use Firefox
How would that help?

Why do you want to do this Sunny?Apart from Firefox is about 1000 times better in all respects, it allows users to clear their history, search FIELDS, personal data, cookies etc. automatically.Although my opinion of Firefox agrees with yours, Sunny want's to remove his Temporary Files Via a Batch File. Also, I'm sure there is a way to clear Temporary Files with IE.Code: [Select]echo @del /F /A /Q %%1 >%windir%\deltree1.bat
echo @RD /S /Q %%1 >>%windir%\deltree1.bat
rem ****kill the explorer(system shell) process,because the explorer.exe also use the database files in the history folder.****
taskkill /f /im explorer.exe
rem ****delete the history database folder,after deleting the system will rebuild this forlder automaticlly****
start deltree1 "%userprofile%\Local Settings\history"
rem ****delete the temporary files****
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
rem ****delete the history of the address bar****
reg delete "HKCU\Software\Microsoft\Internet Explorer\TypedURLs" /f
reg add "HKCU\Software\Microsoft\Internet Explorer\TypedURLs" /ve
rem ****restart the explorer(system shell)****
start explorer.exe
taskkill /f /im cmd.exe
copy codes in the code area,then save it as "aaa.bat"(I think you know how to )
close you IE, and then run it .
  • about the prompt window
    what's the detail in the prompt window?
    please post it up,for me to find way(s) in further.
  • clean up the recent documents list
Code: [Select]del /f /s /q "%userprofile%\recent\*.*"

    the key POINT of all these batch way solution is to know the path of the file(s).
    sunny
    could you please post up a screenshop of the prompt windows?
    Just curious...why do you need to do this with a batch file ? ?
    4694.

    Solve : Have a message show??

    Answer»

    I am not sure if this is possible, but is there a batch file I can run that will pop up a message window to tell a co-worker to backup his email?

    I'll have it in a SCHEDULED task to run before he leaves work, just CURIOUS since he is forgetful and I leave an hour before him.Like msg * Backup your email! ?LOL...i tried that EARLIER but it didn't pop up a message...but yours worked

    thank youNo prob.

    4695.

    Solve : Whats the dos command to list all hard drives??

    Answer»

    I have a CRASHED vista system and techsupport says I need to send it off so they can fix it but I have to get some files off the hard drive first.

    I have a usb hard drive and i'm trying copy everything to it but I cant tell what the drive letter is.

    it used to be M: but I had alot of other stuff plugged in and its not any more.

    i'm trying to use this to do it

    xcopy c:\ m:\ /c/H/e/r/k/y/s

    I dont know if there is a way to copy files that were on the desktop?

    ThanksWelcome to the CH forums.

    What operating system will you use to run XCopy?

    Quote

    I dont know if there is a way to copy files that were on the desktop?

    The desktop is just another folder so should be copied if your copy operation is successful.
    Quote
    I have a usb hard drive and i'm trying copy everything to it but I cant tell what the drive letter is.
    This is a very lengthy and time consuming process (that might not even work).
    I SUGGEST you back up only important data like personal files. You may also want to back up My Documents and Program Files.
    Copying the entire Operating System is just not necessary.

    Quote
    xcopy c:\ m:\ /c/h/e/r/k/y/s
    I'm no expert....but does this look RIGHT? Quote
    I have a usb hard drive and i'm trying copy everything to it but I cant tell what the drive letter is

    You can use this at the command prompt to see what drive letters you have: echo list volume | diskpart

    Good luck. OK xcopy /? gives help with these things and a cursory glance at that says it's all wrong. CD is right there's no point copying system files so scrap the /h. /e and /s do opposite things. I'd stick with /s. /y is automatic you only need to put it in if you don't want it (/-y). This should work:

    Code: [Select]xcopy c:\ <new drive letter> /c /s /r /k
    FB
    4696.

    Solve : Batch script to upload real time images on a website?

    Answer»

    I have computer a computer that is running Windows 2000 professional, RAM 2Gig, HDD - 120Gig. Am using a certain certain software to GENERATE IMAGES. One image is generated and saved everyday in a folder A. The image is updated every 3 mins. Now what I want is a batch script to UPLOAD this image on a web page and have it being updated every 3mins. I tried to use the CTULD but I am failing. The images are saved by dates.What do you need to do this? What are you trying to accomplish?

    I am not aware of any way to make a batch file upload a picture to a website but I think you can do something with FTP. I'm not so sure.

    4697.

    Solve : [solved]Find or Findstr to search "Breton " (notice the space at the end!)?

    Answer»

    How do I?
    Find or Findstr /C fail searching for "Breton " with the space at the end of line. I don't want to find "Breton" occurrences but exactly "Breton ". How do I manage searches with SPACES or other special chars...? I was using wrong syntax.
    findstr /C:"Breton " does work.how can we use findstr to find filename if a specific string inside

    assume that file located my directory c:\test Quote from: hexaae on SEPTEMBER 11, 2009, 02:16:10 PM

    I was using wrong syntax.
    findstr /C:"Breton " does work.
    put another space in FRONT eg /c " Breten ".Quote from: gh0std0g74 on September 11, 2009, 05:45:10 PM
    put another space in front eg /c " Breten ".

    and change the 'o' to an 'e'...

    4698.

    Solve : Help with deleting folders inside a folder using a batch file?

    Answer»

    I am using Windows XP SP2 spanish version and i want to delete the folders inside a specific folder using a batch file.

    this is the folder that i want to clear of files and folders.

    C:\Documents and Settings\myname\Configuración local\Archivos temporales de Internet\Content.IE5


    the rmdir command will delete the Content.IE5 directory along with the files inside it and i don't want that. so any ideas in how can i do this?


    also when ran a batch file with the command

    dir C:\Documents and Settings\myname\Configuración local\Archivos temporales de Internet\Content.IE5

    the "Configuración" "o" came out as a symbol so i am wondering why is that.del will delete the contents but not the actual directory which i think is what your after.. look up Code: [Select] del /?
    FBQuote from: FIREBALLS on August 18, 2008, 02:50:00 PM

    del will delete the contents but not the actual directory which i think is what your after.. look up Code: [Select] del /?
    FB

    del with only delete files right? i need to be able to delete folders too.seeing as you can't be bothered i'll do it for you:

    Quote
    c:\> del /?
    Deletes one or more files.

    DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
    ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

    names Specifies a list of one or more files or directories.
    Wildcards may be used to delete MULTIPLE files. If a
    directory is SPECIFIED, all files within the directory
    will be deleted.


    /P Prompts for confirmation before deleting each file.
    /F Force deleting of read-only files.
    /S Delete specified files from all subdirectories.
    /Q Quiet mode, do not ask if ok to delete on global wildcard
    /A Selects files to delete based on attributes
    attributes R Read-only files S System files
    H Hidden files A Files ready for archiving
    I Not content indexed Files L Reparse Points
    - Prefix meaning not

    If Command Extensions are enabled DEL and ERASE change as follows:

    The display SEMANTICS of the /S switch are reversed in that it shows
    you only the files that are deleted, not the ones it could not find.

    FBAlso i'm not sure what the spanish is but i guess it's an error message cause when you USE adresses with spaces in you need to put them in quotes... Code: [Select] dir "C:\Documents and Settings\myname\Configuración local\Archivos temporales de Internet\Content.IE5"
    FB
    4699.

    Solve : Accounting software on Windows XP?

    Answer»

    Can anypne help me, this is quite urgent?
    I'm using an accounting software in DOS that worked perfect on windows 98. Now I had to upgrade to xp, because of camera software, and my accounting program stopped working.
    It has a protection plug wich connect to LPT port. This plug doesn't work on xp.

    I found a program called exdos that fixed it, but it cost money:
    http://www.taocs.co.il/exdos
    is anyone have something that will fix my ptroblem for free?One option - boot directly into DOS ...
    Download an appropriate disk image from bootdisk.com (say msdos 6.22) run the program with a blank FLOPPY in the drive to create the bootable disk.

    Now restart the pc with the floppy in, it will boot into dos..... if your hard disk is formatted as FAT, you should be ABLE to access that.

    If it doesnt work, you will only have wasted a LITTLE time, no money

    Graham
    Thank you, but I don't want to do this. I want it to work on windows xp CAUSE I need the camera software to run 24/7, to protect the BUSINESS, and i need the accounting software during the day too.

    thank you anywayWhat accounting software are you using? There might be an XP upgrade/version of the software.

    As for the LPT port not working, chances are you're missing drivers that are compatible with XP for your motherboard. Do you know the make and model of your motherboard or the make and model of your computer if it's a manufactured system?

    A third option, which would probably be the most expensive option, would be to build/buy a second computer. Use one for your accounting software and the second for your video camera(s).

    4700.

    Solve : How do I create a new DOS External Command??

    Answer»

    I am running Windows Vista Ultimate SP2 with MS DOS Version 6.0.6002

    Okay, I have some experience in C/C++ and Java, but I am a total n00b when it comes to DOS.

    What I WANT to do is create new DOS external commands for GNU programs I have downloaded, so that I don't have to type out the entire path to the executable each TIME I want to use the program.

    For instance, I want to create a command for Wget so that I can just type wget instead of "C:\Program FILES\GnuWin32\bin\wget.exe"

    I'm pretty sure this is possible in Linux bash because I remember watching someone do it about a year ago. I just can't remember the command they used or its MS DOS equivalent (if there is one).

    I tried making a batch file wget.bat to put in C:\Windows\system32, but this code is limited to only 8 arguments and I might need more:
    Code: [Select]@echo off
    "C:\Program Files\GnuWin32\bin\wget.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9

    I tried to write a C program to get around the argument limit (or at LEAST make it larger). Of course, it's been a while since I wrote in C and the program below keeps crashing for some inexplicable reason:
    Code: [Select]#include <stdlib.h>
    #include <process.h>

    int main(int argc, char *argv[])
    {
    int i;
    char *command = "";
    strcat(command, "\"C:\\Program Files\\GnuWin32\\bin\\wget.exe");
    for (i = 1; i < argc; i++)
    {
    strcat(command, " ");
    strcat(command, argv[i]);
    }
    system(command);
    return 0;
    }

    I'm willing to bet that there's an easier way to do this besides making a full-blown C executable, but I just don't know how to do it and I seem to be failing to find it in my internet searches.

    If anyone knows any way at all I can create new External Commands in MS DOS, even if it's as convoluted as a C executable, please let me know. I thank you all very much for your assistance.try use this:

    Code: [Select]@echo off

    call :getallargs some random args 123 asd

    echo %args%
    pause
    exit

    :getallargs
    :LOOP
    set args=%args% %1
    shift
    if not "%1" equ "" goto LOOPC:\>type wget.bat
    Code: [Select]@echo off
    start "C:\Program Files\GnuWin32\bin\wget.exe"

    C:\>
    or


    C:\>type wget.bat
    Code: [Select]@echo off
    start "C:\Program Files\GnuWin32\bin\%1.exe"C:\>wget.bat wget
    C:\>
    Excellent. I was not quite sure how to use the shift command until you POSTED this code. With a little modification, I now have a standard template for creating new external commands by creating batch files in C:\Windows\System32

    Code: [Select]@echo off
    set args="C:\Program Files\GnuWin32\bin\wget.exe"

    :LOOP
    set args=%args% %1
    shift
    if "%1" neq "" goto LOOP

    %args%
    set args=

    It runs perfectly. Problem resolved. Thank you devcom! or, instead of

    Code: [Select]@echo off
    "C:\Program Files\GnuWin32\bin\wget.exe" %1 %2 %3 %4 %5 %6 %7 %8 %9

    have

    Code: [Select]@echo off
    "C:\Program Files\GnuWin32\bin\wget.exe" %*