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.
| 6551. |
Solve : Trying to copy C drive but access denied - PLEASE HELP....THANKS? |
|
Answer» -------------------------------------------------------------------------------- I have look thru the posts but could not find enough info. I am a rookie and it would help if the responses were spelled out in laymans terms. I am running Windows Vista. Thanks. The problem I am having is that I dropped my computer. I have been with the DELL tech group but no help. So I was in DOS which I learned 20 years ago (forgot most) but have just enough KNOWLEDGE to pull up DOS and try simple copy commands. I tried to copy all of the C drive but no can do due to all the programs on it. SO.... I want to copy just my files that are on the C drive onto a flash drive but I do not know the commands. I have looked on several sites but cannot not find what I need. DOS is not the answer for this problem...... You will need drivers for that USB drive to work and GETTING DOS drivers for USB storage media would be a nightmare to find is there are any out there.... I'd use a Knoppix Live Linux CD to boot the system and access the C: drive, which would mount as not C: but as the only hard drive in your system. Then use the GUI of Knoppix to grab data off of your Hard Drive and Copy it to the Thumb drive..... Knoppix should be able to see NTFS, and will definately see FAT32 partitions if an old laptop like Windows 98 SE. NTFS should be able to work with Knoppix distro, but I believe it is still in a "beta" state for support. You will need to go to http://www.knoppix.com/ and download it.... about 700MB to a CD or DVD, and be able to burn it. You will need DSL or Broadband to be able to do this because it would take a week with satelite or dial-up. Boot the laptop off the burned Knoppix CD or DVD and be sure that the thumb drive is also inserted so Knoppix will SEEIT when it detects hardware and mounts its drivers ( HOPEFULLY ) Other than that, your best bet is getting a IDE to USB kit for about $20 that will allow for you to plug your hard drive (removed from laptop ) into a dongle setup that will plug in via USB to a desktop or another laptop. * You can also use a 2.5" External Drive case, but that may cost more than the IDE to USB dongle that are out there... The better dongle is the one that is double sided for 2.5" and 3.5" laptop and desktop computer IDE drives, and a nicer version EVEN has SATA support with the IDE support. With the dongle the computer interfacing with the drive will see it as an external drive. ((( As long as the drive is not badly damaged you should be able to COPY all important data from that drive to the other computer and burn it to CD or DVD if you wanted or move it to USB thumb drive which is less safe due to the flash memory nature than burning to media like CD or DVD.))) |
|
| 6552. |
Solve : how to hide password? |
|
Answer» hi experts, hi experts,LET's get this straight? So when the user types there password in you want it to come up as ***** for example?Quote from: Jacob on July 10, 2008, 10:42:04 AM Quote from: brough on July 10, 2008, 09:45:02 AMhi experts,Let's get this straight? Yes that is correctQuote from: brough on July 10, 2008, 10:50:13 AM Quote from: Jacob on July 10, 2008, 10:42:04 AMWeird things is, i was wondering the exact same thing, shame i cannot help you.Quote from: brough on July 10, 2008, 09:45:02 AMhi experts,Let's get this straight? Lets hope somebody canTry this. It was posted online quite some time ago but I can't remember where it is. Code: [Select]@echo off SET REAL_PASS=password SET REAL_LENGTH=******** echo e100 B4 00 CD 16 88 E0 B4 4C CD 21> %temp%.\\\\scan.com for %%? in (rcx A w q) do echo %%?>> %temp%.\\\\scan.com type %temp%.\\\\scan.com |DEBUG %temp%.\\\\scan.com > nul :pre for %%? in (pass length) do set user_%%?= :loop set input= cls echo Type password: %user_length% if \\"%user_pass%\\"==\\"%real_pass%\\" goto granted if \\"%user_length%\\"==\\"%real_length%\\" goto denied call %temp%.\\\\scan.com if errorlevel=2 if not errorlevel=3 set input=1 if errorlevel=3 if not errorlevel=4 set input=2 if errorlevel=4 if not errorlevel=5 set input=3 if errorlevel=5 if not errorlevel=6 set input=4 if errorlevel=6 if not errorlevel=7 set input=5 if errorlevel=7 if not errorlevel=8 set input=6 if errorlevel=8 if not errorlevel=9 set input=7 if errorlevel=9 if not errorlevel=10 set input=8 if errorlevel=10 if not errorlevel=11 set input=9 if errorlevel=11 if not errorlevel=12 set input=0 if errorlevel=30 if not errorlevel=31 set input=a if errorlevel=48 if not errorlevel=49 set input=b if errorlevel=46 if not errorlevel=47 set input=c if errorlevel=32 if not errorlevel=33 set input=d if errorlevel=18 if not errorlevel=19 set input=e if errorlevel=33 if not errorlevel=34 set input=f if errorlevel=34 if not errorlevel=35 set input=g if errorlevel=35 if not errorlevel=36 set input=h if errorlevel=23 if not errorlevel=24 set input=i if errorlevel=36 if not errorlevel=37 set input=j if errorlevel=37 if not errorlevel=38 set input=k if errorlevel=38 if not errorlevel=39 set input=l if errorlevel=50 if not errorlevel=51 set input=m if errorlevel=49 if not errorlevel=50 set input=n if errorlevel=24 if not errorlevel=25 set input=o if errorlevel=25 if not errorlevel=26 set input=p if errorlevel=16 if not errorlevel=17 set input=q if errorlevel=19 if not errorlevel=20 set input=r if errorlevel=31 if not errorlevel=32 set input=s if errorlevel=20 if not errorlevel=21 set input=t if errorlevel=22 if not errorlevel=23 set input=u if errorlevel=47 if not errorlevel=48 set input=v if errorlevel=17 if not errorlevel=18 set input=w if errorlevel=45 if not errorlevel=46 set input=x if errorlevel=21 if not errorlevel=22 set input=y if errorlevel=44 if not errorlevel=45 set input=z if errorlevel=71 if not errorlevel=72 set input=7 if errorlevel=72 if not errorlevel=73 set input=8 if errorlevel=73 if not errorlevel=74 set input=9 if errorlevel=75 if not errorlevel=76 set input=4 if errorlevel=76 if not errorlevel=77 set input=5 if errorlevel=77 if not errorlevel=78 set input=6 if errorlevel=79 if not errorlevel=80 set input=1 if errorlevel=80 if not errorlevel=81 set input=2 if errorlevel=81 if not errorlevel=82 set input=3 if errorlevel=82 if not errorlevel=83 set input=0 if \\"%input%\\"==\\"\\" goto loop set user_length=*%user_length% set user_pass=%user_pass%%input% goto loop :granted echo Access granted. goto pass_end :denied echo Access denied. :: Uncomment following line in ORDER to keep asking user the password :: GOTO PRE goto pre goto pass_end :pass_end for %%? in (pass length) do set user_%%?= for %%? in (pass length) do set real_%%?= del %temp%.\\\\scan.com pausehalf WORKS, backspace doesn't work. thanks anyway.You can try this magical batch file: Code: [Select]@echo off :retry echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>in.com set /p password=Enter password:<nul for /f "tokens=*" %%i in ('in.com') do ( set password=%%i ) if /i not %password%==password cls && goto retry del in.com PS. The password is password, but you can change it. Quote from: SIDEWINDER on July 10, 2008, 03:56:21 PM You can try this magical batch file:Not bad. |
|
| 6553. |
Solve : Change admin password in DOS? |
|
Answer» I know I've seen this but can't remember where...old age strikes again |
|
| 6554. |
Solve : Need help with batch? |
|
Answer» I'm trying to make the computer mount a mini-image in Daemon tools, run Battlefield 2, and run the WIDESCREEN fix for it. I'm a complete noob with batch files. This is what I have so far: |
|
| 6555. |
Solve : Stop Active Connections? |
|
Answer» Hi.. |
|
| 6556. |
Solve : How to run reg file from bat file with answering message alert? |
|
Answer» ThanksYour WELCOME? |
|
| 6557. |
Solve : dos boot cd? |
|
Answer» i would like to make a DOS boot CD that will allow me to boot into dos and view/change the CONTENTS of my hdd. i would like to make a DOS boot CD that will allow me to boot into dos and view/change the contents of my hdd. Only if your file system is not NTFS otherwise you will need NTFS4Dos Good luckthanks contrex. way to be a ........dworley, is there a particular REASON you REVIVED this thread after 10 months? Oh and could you moderate your language please? And did you make your boot cd? |
|
| 6558. |
Solve : Echo + Append text to specific line in a txt file..??? |
|
Answer» is there a way to echo + Append TEXT into a specific line in a .txt file.. 1---:And you want to add !!!..Echoed in txt here..!!! on the fifth line?yup, u got it, thas wat i wana do.. can it be done..??With the other tools available on modern machines, why did you pick a batch solution? Code: [Select]@echo off setlocal enabledelayedexpansion set count=0 for /f %%i in (input.txt) do ( call set /a count=%%count%%+1 if !count!==5 (set line=%%i ..Echoed in txt here..) else (set line=%%i) echo !line!>>output.txt ) This comes dangerously close to programming and we all know batch coding is not a programming language. Note: Exclamation marks (!) have special meaning in batch files. If you must absolutely have them, you'll need to work that part of the solution yourself. thanks for the help.. but this seems to just duplicate the input.txt file into the output.txt then appends then new text into the output.txt.. I need it to append the new text to the 5th line on the original input.txt Quote I need it to append the new text to the 5th line on the original input.txt That is not going to happen. Batch code can only process sequential files. Sequential files cannot be updated in place (cannot be opened both input and output at the same time). If the new record were larger than the old record, how would it fit into the old space? Here is one workaround: Code: [Select]@echo off setlocal enabledelayedexpansion set count=0 for /f %%i in (input.txt) do ( call set /a count=%%count%%+1 if !count!==5 (set line=%%i ..Echoed in txt here..) else (set line=%%i) echo !line!>>output.txt ) ren input.txt input.old ren output.txt input.txt I dislike writing destructive code but the first ren command can be replaced by a del command. |
|
| 6559. |
Solve : Symbols in complex passwords? |
|
Answer» I am USING a simple batch FILE to map a drive but the password to the drive contains a "&" SYMBOL. When the file runs it seperates before and after the symbol and CREATES a message the "&XX" is not a recognized command. Is there a way to group the text string (password)? I have tried to put it in "" but it fails telling me the password is wrong. |
|
| 6560. |
Solve : minimize windows screen? |
|
Answer» Anybody know of a way to shrink, minimize or hide a SCREEN of a windows program I have just opened? |
|
| 6561. |
Solve : How can I sort a text file eliminating duplicates? i.e sort unique? |
|
Answer» Hi, Any way to have grep on windows/dos? The GNU core utils is not the only collection of unix utilities ported to Win32. There are others, INCLUDING a small set called Unxutils which does have grep.exe http://unxutils.sourceforge.net/ Quote from: akondeti on July 10, 2008, 10:19:50 PM its' here go to the root URL to see more. |
|
| 6562. |
Solve : how to make a batch file fail??? |
|
Answer» hi IF EXIST "c:\try\a.txt". ( Your script will SURELY fail...thanks ... |
|
| 6563. |
Solve : cant get my batch file running? |
|
Answer» hey guys I'm new to making .bat files, i have a problem with with making them its easy en ought make them but GETTING it to work isn't as easy as i thought. Lol maybe add pause command after last line huh? Quote i have Made this for a test but it doesn't work right when i have saved the document and i click the test.bat file it just blinks on my screen with the command window and that's it ? Technically, there is nothing wrong with your batch file. The first echo on each line is seen as a command, all the others are text for the echo to act on. Try running your file from a command prompt. Double clicking a batch file adds complexities you haven't accounted for. thanks Sidewinder the only one to accept that not all Ar as good as others we have all been new to something example driving on a Buick, now I'm now to batch file's and don't really think that its nice you guys saying lol and all that stuff because I'm trying to learn it like all you guys was when you started but many tank's Sidewinder for helping a noob out in SET of laughting of him |
|
| 6564. |
Solve : how to attach my bat file to autoexec.bat? |
|
Answer» Can any body tell me how to attach my batch file to the autoexec.bat file which will execute my file AUTOMATICALLY at the boot timeMethod 1. It does not contain any lines, it is empty? What OS are you running? Sounds very much like XP in which case Autoexec.bat is irrelevant except for SET commands. The .bat file, or a shortcut to it, could be put in the STARTUP programs file so that it runs when Windows is loaded. Here is a quote from this Wiki. Quote Windows NT and its descendants Windows XP and Windows Vista parse AUTOEXEC.BAT when a user logs on. As with Windows Me, anything other than setting environment variables is ignored. but how to attach a file in the satrup using dos commandYou need to answer this question #groff -Tascii -man yakub. Quote from: Dias de verano on July 11, 2008, 01:16:19 PM What OS are you running?OS = Operating System AKA what version of Windows are you using?i am using xp service pack 2 As Dusty said, the easiest way to make it start with Windows is to add it to the startup folder. C:\Documents and Settings\[YOURUSERNAME]\Start Menu\Programs\StartupI generally feel a teeny bit suspicious when the question, "how can I make a PROGRAM startup by means of a script?" comes up. thanks to all for you replays |
|
| 6565. |
Solve : to print drawing in dos A3 size? |
|
Answer» hello, |
|
| 6566. |
Solve : Starting Outlook from a batch file? |
|
Answer» SO I have a issue with Outlook. Every so often it comes up with a error that says the administrator has made a change and you need to restart Outlook for it to take effect. But as far as I can tell there has been no changes. The problem is I can't access other email account I have been granted to after that until I restart. So I figured instead of wasting time doing research or reloading office or at the far reach my system which I know I need to do anyway I would write a batch file to kill outlook and reopen it. Simple enough... |
|
| 6567. |
Solve : need help with ping command? |
|
Answer» i want to KNOW how to acess the ping command plzYou can access the command through Command PromptGo Start>Run, TYPE in: |
|
| 6568. |
Solve : Batch copy across network with failure log? |
|
Answer» I'll just post this while I try to find the answer in the past POSTS... Is there a way to log XCopy's failures and which file it failed on? Output usually consists of two output streams (1-STDOUT and 2-STDERR) which can be redirected together or separately. The default is the console. xcopy parms >good.log 2>bad.log each stream goes to separate files OR xcopy parms 2>bad.log one stream to console; errors to file OR xcopy parms 2> both.log 1>&2 both streams to same output file Quote Is there a way to emulate a keypress so I can get past XXCopy's complaints and still keep it logged properly so I can ensure the integrity of my backup? You might be able to pipe the enter key into xxcopy: ECHO. | xxcopy parms Not all programs can accept input from the pipe, but hey, you never know. Good luck. I think I have a similar request to the lines of this. I want to output the copied files to a file, I can do that by typing >>%log% at the end of the command, but if there is a user prompt .... Does \\Server\directory\Forms specify a file name or directory name on the target (F = file, D = directory)? Is there a way to keep everything in the log and directory it to the console so the user can enter D for directory, or better yet of course have it automate. Dos is pretty much my only option at this time. If too off topic I will open a new topic. Thanks for your help. Now that I'm thinking about this a little more I think I figured it out. I can push everything to the log, then before the coping of the directory just make the directory first assuming I know its name which in this case I do. Now for future reference if I didn't how could I handle this? While the literal from a prompt may end up in the log, there is still an interrupt pending on the console. PROVIDED you know the actual prompt, you can pump in the response: echo D | xcopy source target >> log.txt OR echo F | xcopy source target >> log.txt For programs that require multiple responses you can create a sequential response file and redirect the STDIN data stream: xcopy source target 1>log.txt 0<resp.txt The resp.txt file might contain: D Y which will cover the situation when XCOPY first asks about files/directories and then requests your permission for overwrites. Good luck. Thank you for that, It worked. You can also try Syncback. I use it on my servers to backup files across machines. http://www.2brightsparks.com/syncback/sbse-features.html it works great and even creates a HTML log. |
|
| 6569. |
Solve : command prompt to batch file? |
|
Answer» Hello Same way you did for the Shutdown command. xcopy c:\temp /e thanks CARBON dude for making me use my brain, as i said i have only just started learning this, so it all seems a bit confusing. It will get easier over time. |
|
| 6570. |
Solve : Config.sys!!!!? |
|
Answer» Hi all. |
|
| 6571. |
Solve : Need help echoing variable? |
|
Answer» i'm trying to echo %1 %2 %3 into a file from a batch file, and i dont WANT the variable |
|
| 6572. |
Solve : Microsoft DOS? |
|
Answer» How to create a batch file for more than one .class fileExplain fully what you WANT to do.Quote from: contact2chandan on July 12, 2008, 02:24:00 PM ...for more than one .class file... i think he's TALKING about Java.Quote from: macdad- on July 12, 2008, 06:51:47 PM i think he's talking about Java. I had WORKED that much out. |
|
| 6573. |
Solve : How do I use Lame command line?? |
|
Answer» Hi, Do you actually have a file called sound.wav in I:\Apollo 13? Yes I do. It's sound but if I put my mouse over is, it SAYS .wav but .wav is not part of name but sound is the name of it. I was just looking at the sound file. |
|
| 6574. |
Solve : why some commands not support in my command prompt?? |
|
Answer» i have a trouble with my command prompt.. |
|
| 6575. |
Solve : Copy Files That Shortcut links Point To..???? |
|
Answer» Is there any way read a shortcut.lnk file and then copy the file its pointing to, into another directory..?? |
|
| 6576. |
Solve : FTP script? |
|
Answer» hey all, The way I do this is to write a batch file that uses a text file for the user name and password. It also has the commands to move files. ok, I've copied you ftp line and sub'ed in my bits. I've edited my script.txt to change driectory and then log out. Sadly I'm still getting the same results. Can you test something for me??? what happens when you a batch file with just "ftp ftp.myhost.com" in it??? Cheersarh, turns out I had called my batch file "ftp.bat" and then when it ran the first line was "ftp ......" and so it was calling itself and got stuck in a loop!!! Slap's hand to forehead!!!!! Cheers for all the input guys!!! Ok...try this.... Make a file and call it test_ftp.bat in it put this.... ftp -n -s:E:\Folder\dataxfer.txt ftp.myhost.com PAUSE Now make another file and call it dataxfer.txt and put it in E:\folder Put this in it. user your_username your_password put E:\folder\test_file.txt bye Now open NOTEPAD and make a file called test_file.txt and save it to E:\folder now edit the dataxfer.txt file to add your username and password. Also you will need to edit the ftp.bat file to replace the ftp.myhost.com to your ftp site. One other thing....when you login to the ftp site do they make you change directories to your folder? If they do than your dataxfer.txt should look like this.... user your_username your_password cd your_folder put E:\folder\test_file.txt bye If you have done everything right this will copy the file called test_file.txt to your FTP site. cheers Spoiler I just renamed my batch file to something different and all's good. Cheers again good deal...glad things worked out for you. have a good one! I spoke to soon. Although the batch file now connects to the ftp site sadly I'm getting "501 Syntax error in IP address" and "425 No data connection" error's while trying to download files. I've LOOKED the error's up on google and it has pointed to a firewall issue, so I turned my windows firewall off, and allowed port 21 through my router's firewall (NAT to my laptop) This hasn't helped, but strangely, If I open a command prompt and manually enter the commands as they are listed in my ftpscript.ftp file, its work without any issue. Below is the log file generated by my batch file. Code: [Select]Connected to ftp.myhost.com. 220---------- Welcome ---------- 220-You are user number 5 of 50 allowed. 220-Local time is now 16:54. Server port: 21. 220 You will be disconnected after 15 minutes of inactivity. User (ftp.myhost.com:(none)): 331 User me OK. Password required 230-User me has group access to: me 230 OK. Current restricted directory is / ftp> ASCII 200 TYPE is now ASCII ftp> Interactive mode Off . ftp> prompt n cd Data/customer 250 OK. Current directory is /Data/customer ftp> get lname.txt 501 Syntax error in IP address 425 No data connection ftp> bye 221-Goodbye. You uploaded 0 and downloaded 0 kbytes. 221 Logout. Any help greatly appreciated |
|
| 6577. |
Solve : Dos File name and syntax? |
|
Answer» Hi Guys |
|
| 6578. |
Solve : Command Prompt problems? |
|
Answer» hello, i can't run any file on COmmand PROMPT. I can open COmmand prompt via run and from the other folder but when i type in any command such as ipconfig or java or javac it says its not a ecognized internal or external command; operable program or batch file. I don't why it does this it was working before but than it stopped.. the latest thing installed was the java JDK thing can someone please help me!!! It used to work than it SUDDENLY stopped i've tried everything i even can't open MS DOS files...... The only thing i can do is drag the .exe file to the window and it'll work but i can't keep doing that over and over again. Help!What Windows version? the latest thing installed was the java JDK thing I wonder if your PATH SYSTEM variable has got mangled, (That happened to me after I installed Java). In a command prompt, type PATH. It should look something like this C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem i figured the solution. The path for all the commands was wrong somehow... for anyone who has this problem here is the link where it'll teach you how to fix it.http://en.allexperts.com/q/Windows-XP-3282/Command-Prompt-problem-1.htmThis is what Dias just TOLD you, but THANK you for posting back Quote from: Broni on July 19, 2008, 03:22:20 PM This is what Dias just told you, but thank you for posting back It's nice when they post back, isn't it? |
|
| 6579. |
Solve : help with SCHTASKS command? |
|
Answer» hey all, |
|
| 6580. |
Solve : Batch file for running mutliple telnets? |
|
Answer» Guys, i am not in prog. and cannt really use my brain that way. Inobody is born to know SOMETHING without learning. While someone with the free time can post a SOLUTION for you, however, the best way is still to start learning batch for yourself.and here is the place to learn it.Thanks ..can someone atleast provide me some base structure or something to start with ??you can start with batch if you like, however for the problem you need to solve, M$ telnet client does not allow you to script it. you might want to learn a different language that comes with telnet LIBRARIES and modules that allow you to telnet remotely. See here for an example using Perl.thank you doggie..i'll have a look at this.. cheers!!doggie??? lolThe list of the IPs...are they always the same? Or are you looking to scan a group of IPs and than move to ANOTHER group? Nope they will always remain same , 15 -18 IPs and thats it...no changes in that..any HELP buddy ? |
|
| 6581. |
Solve : Hard drive questions,everything got formatted.? |
|
Answer» So ive attached the drive as a secondary on my computer right now. |
|
| 6582. |
Solve : Batch Files Not Working Anymore? |
|
Answer» Hi all, I'll just have to wait, because I supposed to be getting a new computer in a couple of days so I guess that will fix the problem... Perhaps, but as was previously mentioned, batch files do not just stop working. Most likely is some environment change occurred that the batch files(s) did not account for. Good luck. I tried removing the ECHO OFF in on of the batch files that don't work anymore, and there isn't much to see. It's the same thing as with the ECHO OFF, it stops without telling me why... Here's all it says (from the code posted in the first post): Quote E:\Documents and Settings\username\My Documents\Tool>CD /d "E:If the code you posted is what is actually running, then the FORMAT of the for statement is incorrect. There is an open parenthesis after the DO but it is never closed. In your earlier thread you were moving the files to an archive. This code appears to be in an endless loop as long as the directory has one batch file. Posted Code: Code: [Select]@ECHO OFF CD /d "%~dp0" CD Batch :LOOP FOR /F "tokens=* delims=" %%V IN ('dir *.bat /b 2^>^&1') DO ( IF "%%V"=="File Not Found" GOTO :DONE call "%%V" GOTO LOOP :DONE ECHO RENDERING COMPLETED! ECHO YOU MUST NOW SMILE!! PAUSE CD /d "%~dp0" DEL "Exterior Snapshot Rendering.bat" EXIT omg... That was only it? Thank you so much! I still don't understand how that could happen since it was working fine last week. Maybe I made some change in the code and removed the ")" by mistake, because it's a .bat file that's created from a JAVASCRIPT so maybe I made a mistake while updating the javascript. And also I still don't understand why another bat file wasn't working, but it's another one that was created from the javascript and I just tried it again and now it works so... it's kind of weird, but anyways... The important part is that has it says at the end of my batch file: I MUST NOW SMILE!!! |
|
| 6583. |
Solve : Syntax error in IP address? |
|
Answer» hey all, |
|
| 6584. |
Solve : binary download script? |
|
Answer» this will let you download binary files \text files without third party programs the syntax would be %0 get www.download.com/file.zip C:\file.zip @echo off There is no DO construct in batch except in the context of a FOR statement. Why the batch code wrapper? VBScript can accept and process arguments. You can even put up inputboxes to prompt the user. Happy coding. Quote from: Sidewinder on July 19, 2008, 08:50:56 AM There is no DO construct in batch except in the context of a FOR statement. In the code below, it has the INTERESTING effect of sabotaging the IF test, so that it always tests true. In this code, "three" is always echoed, whatever is input. I guess this unsensational failure mode made it hard to for the OP to spot. It is odd because at the command prompt, you see Code: [Select]C:\>if "black"=="black" do echo YES 'do' is not recognized as an internal or EXTERNAL command, operable program or batch file. Code: [Select]@echo off set /p choice=Pick a number? IF "%choice%"=="3" do ( echo three ) |
|
| 6585. |
Solve : please help im confused !!? |
|
Answer» Hiya all, i hope soeone can help me. |
|
| 6586. |
Solve : editing time and creating a scheduled task? |
|
Answer» hey all, |
|
| 6587. |
Solve : DOS program to open file and writing to a file and closing the file? |
|
Answer» hi, i didn't get you, but i want to know how to do this. I asked, is this an assignment from school? No yar, i am doing some project,, in that i need it. You do not describe the problem fully enough. If you want to echo data to a file you can do this to start the file echo something > filename then if you want to add data you can do this echo something else >> filename I have one main file named "file1.bat". This contains the following stmt. wscript.exe "invis.vbs" "rat.bat" The file invis.vbs contains the following stmt: CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False The rat.bat file contains the following stmt: set path=Java\jdk1.6.0_06\bin;Java\jre1.6.0_06\bin; java -JAR RemoteAccessTool.jar The main aim of these three files is to hide the dos window when bat file is executed. The main batch file is "rat.bat". You can tell me the answer in two ways. 1>> how to hide the dos window when a batch file executed. 2>> file1.bat in this topic has to do the following: It should create the file invis.vbs file and put the mentioned stmt in that file. It should create the file rat.bat file and put the mentioned stmt in that file. Then, it should EXECUTE the following stmt: wscript.exe "invis.vbs" "rat.bat" NOTE: My objective is to club the three files into one file. Thanks, Rajaare you trying to write a virus or hidden snooping program?no yar.. Please have a look at the statements. It just SETS the path to java and invokes certain application.(RemoteAccessTool.jar). Here: Dos window must be hidden, and application GETS executed. Its not a virus and some other kind. |
|
| 6588. |
Solve : Play sounds from Command Prompt.? |
|
Answer» Someone asked how to PLAY a sound from the Command Prompt but I cannot find the relevant post. However, here is how it can be done: |
|
| 6589. |
Solve : reading txt file line by line? |
|
Answer» hey all, |
|
| 6590. |
Solve : Need help with a batch file.? |
|
Answer» Windows Xp Pro- So LOCKED down that no one can put even a shortcut on their desktop. (New images) |
|
| 6591. |
Solve : Automation? |
|
Answer» The below code was written to eliminate the need for users to manually copy files from one location to another, instead the code will do it for the user, however I am looking for a bit more error level checking and a few more precautions before I let the rest of the staff use it. Basically we have a server that hosts client files for production, these files determine how the work they run is handle, ie breaking the work into different folders etc. The goto :eof transfers control to the end of the current batch file. This is an easy way to exit a batch file without defining a label. It is also used to exit from a subroutine. Let me make sure I understand this ... Basically by starting the For loop we need to stop it similar to regular VB, so by saying 'goto :end' we're saying that once the For loop is complete you can process any other Goto commands outside of the process we called? The 'goto :eof' ... would that really ever be called as a real goto command as I do have ':eof' as a section of my code. The goto end statement has nothing to do with the for loop. It's used to prevent the code from falling into the :process logic. The goto :eof statement exits the :process subroutine. Using a call to an internal label creates a new batch file context. Arguments (if any) are referenced as command line parameters (see call /? for details). In this context, it acts as a return mechanism to the next instruction after the call. (in your case it would be the next iteration of the for loop) Using a goto :eof not in the context of a subroutine, branches to the end of the batch file. Bottom line is do not create labels named :eof Microsoft has a wealth of information in their help feature: command /?Thank you for that information. I was able to get it to work. You wouldn't know how to pull the date out of a file would you? That was my original request of this topic, this does work, but I'm the type of person that love having the information in case I need it later. Thanks for all your help Sidewinder. Quote You wouldn't know how to pull the date out of a file would you Which date? Files have three dates as properties (Last Written, Last Access, Creation) or is this date embedded in the file? Comparing dates require a YYYYMMDD format, so if your default format is something else, you'll need to do some data manipulation. Batch code does not do date/time arithmetic unless you are prepared to write a boatload of if statements. As poster's requests become more sophisticated, it becomes necessary to move from a command language to a script language. Microsoft seems to have made the Visual Basic family the official language of Windows. Perhaps you will consider VBScript. I was looking for the creation date of the file, then comparing this to current system date. VBscript might be a possibility, just haven't messed with it that much yet. |
|
| 6592. |
Solve : Hiding input into a command window with a character or blank space? |
|
Answer» Hi, "In cryptography, encryption is the process of transforming information (referred to as plaintext) using an algorithm (called cipher) to make it ." http://en.wikipedia.org/wiki/EncryptionCode: [Select]@echo off echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>hide.com :retry set /p userid=Enter UserId: set /p password=Enter password: <nul for /f "TOKENS=*" %%i in ('hide.com') do set password=%%i if /i %password%==password goto next cls echo Try again. You are not logged in! goto retry :next echo. & echo You are logged in! Try incorporating the above snippet into your code. The key is creating the hide.com file and using the for instruction to return the hidden password input to the batch file. The password does not display on the console. Good luck. PS. The password for the snippet is password.Works great, this makes a file called hide.com, is there a way for a user to cipher this?Actually I left the last line out of the snippet. It should read: Code: [Select]@echo off echo hP1X500P[PZBBBfh#b##[emailprotected]`$fPf]f3/f1/5++u5>hide.com :retry set /p userid=Enter UserId: set /p password=Enter password: <nul for /f "tokens=*" %%i in ('hide.com') do set password=%%i if /i %password%==password goto next cls echo Try again. You are not logged in! goto retry :next echo. & echo You are logged in! del hide.com Quote this makes a file called hide.com, is there a way for a user to cipher this? Not sure what you mean. The password is never encrypted, there is nothing to cipher. Hide is a program that turns off the user input echo at the console. its just that if i open the file hide.com in text pad it comes up with 68 50 31 58 35 30 30 50 5B 50 5A 42 42 42 66 68 This is just the first line of 3. just wondering if it actually meant something if i was to 'decode it'Before you delete hide.com, do this debug hide.com then in debug, do -u100 129 then q to exit - you will see the code that is executed - however it doesnt look very meaningful to me so I suspect it uses opcodes not recognised by the venerable debug! Perhaps the original source could be posted ? Code: [Select]-u100 129 1672:0100 68 DB 68 1672:0101 50 PUSH AX 1672:0102 315835 XOR [BX+SI+35],BX 1672:0105 3030 XOR [BX+SI],DH 1672:0107 50 PUSH AX 1672:0108 5B POP BX 1672:0109 50 PUSH AX 1672:010A 5A POP DX 1672:010B 42 INC DX 1672:010C 42 INC DX 1672:010D 42 INC DX 1672:010E 66 DB 66 1672:010F 68 DB 68 1672:0110 236223 AND SP,[BP+SI+23] 1672:0113 236658 AND SP,[BP+58] 1672:0116 66 DB 66 1672:0117 2D5640 SUB AX,4056 1672:011A 60 DB 60 1672:011B 2466 AND AL,66 1672:011D 50 PUSH AX 1672:011E 66 DB 66 1672:011F 5D POP BP 1672:0120 66 DB 66 1672:0121 332F XOR BP,[BX] 1672:0123 66 DB 66 1672:0124 312F XOR [BX],BP 1672:0126 352B2B XOR AX,2B2B 1672:0129 7535 JNZ 0160Quote from: Khasiar on February 14, 2010, 10:25:42 PM its just that if i open the file hide.com in text pad it comes up with They are the hex numbers which represent machine instructions. A .com file is a machine language program. gpl has posted the assembler source code. I found two versions of this program in the snippet closet. The one I posted in the batch file and the GPL unassembled version are both the same program. The .com file was created with debug. The version below is a script which can be used as input to debug and produce the same results. Code: [Select]A MOV AH,0C ;function flush buffer INT 21 ;DOS call MOV AH,0A ;function buffered input INT 21 ;DOS call MOV DL,AL ;store user input MOV AH,4C ;function exit INT 21 ;DOS call RCX 14 N PSWDHIDE.COM W Q The only difference is the size of the .com file (20 bytes vs 70 bytes). There are many versions of this program floating around, all slightly different, all accomplishing the same thing. PS. Batch files are not good for security features. Even though the password is hidden at the console, at some point a comparison must be made to the actual password where anyone can read it. Better to use another tool and hide the password in the registry or encrypted in a database. Yea, i think i just realized that the user can just right click on the batch file and select edit to see if /i %password%==password goto next is there a way to encrypt the contents of the batch file to all but the CREATOR? or a freeware version of a file locking program that asks for password to open any sort of file if you decide to lock it?You might convert the bat file to an exe file by using a batch converter. You can distribute the exe version and keep the source code in your hands. I really don't recommend it as most of them merely add load and terminate routines to your otherwise small batch file. If you know any of the Windows scripting languages, encryption COM objects ($$$) are available or you can check out this article. If you have Microsoft Visual Studio installed, you might find some helpful programs in the SDK. Good luck. "How to hide passwords in batch" comes up as regular as clockwork. Like the IRISHMAN said when the stranger asked him for directions, "If I was going there, I wouldn't start from here". However, there is a free util called Editvar that, among other things, masks input... http://www.westmesatech.com/editv.html xx is shown because there are 2 versions editv32 and editv64... Code: [Select]EditVxx [-b] [-e] [-l len] [-m] [-n] [-o] [-p prompt] [-t n] [-u] var Arguments: -b Place the cursor at the beginning of the input line (instead of the end). -e Do not insert shell escape characters before reserved shell characters in the environment variable's contents. (Win32/Win64 only) -l len Limits input to 'len' characters. In MS-DOS, the limit is 255 characters; In Win32/Win64, the limit is 2047 characters. -m Masked input: DISPLAYS '*' for typed characters. -n Restricts input to numbers only (0-9). -o Starts the line editor in overtype mode instead of insert mode. -p prompt Specifies a prompt for the user. If it contains spaces or tabs, enclose it in quotes ("). -t n Assume Enter was pressed if nothing typed within 'n' seconds. -u Forces entered characters to uppercase. var The environment variable's name (required). This name can be up to 127 characters long. If the variable name contains spaces, enclose it in quotes. Code: [Select]@echo off & setlocal echo Password: call :CheckPWD p1 123456 * echo. if errorlevel 1 (echo %p1% - No) else (echo %p1% - Yes) echo. echo Password: call :CheckPWD p2 123456 if errorlevel 1 (echo %p2% - No) else (echo %p2% - Yes) pause & goto :eof :CheckPWD setlocal & if "%~2"=="" exit /b 1 (echo e100 B7 2A 80 3E 80 00 00 74 22 80 3E 80 00 02 75 06 echo e110 8A 3E 82 00 EB 15 83 E0 00 8E D8 80 3E 00 02 00 echo e120 74 6A BA 01 02 B4 09 CD 21 EB 61 83 E6 00 8E C6 echo e130 80 E4 00 CD 16 8A D8 80 FB 1B 75 08 26 80 26 00 echo e140 02 00 EB 48 80 FB 0D 74 37 80 FB 08 75 1A 83 FE echo e150 00 74 DD B2 08 B4 02 CD 21 B2 20 B4 02 CD 21 B2 echo e160 08 B4 02 CD 21 4E EB C8 80 FB 21 72 C3 80 FB 7E echo e170 77 BE 8A D7 B4 02 CD 21 26 88 9C 01 02 46 EB B0 echo e180 26 C6 84 01 02 24 26 C6 06 00 02 24 B8 00 4C CD echo e190 21 echo nx.com echo rcx echo 91 echo w echo q )|debug>nul if "%~3"=="" x>nul if "%~3" neq "" set c=%~3 & call set "c=%%c:~0,1%%" if "%~3" neq "" x %c% for /f %%a in ('x -o') do set "p=%%a" endlocal & set "%~1=%p%" & del x.com & if "%~2"=="%p%" (exit /b 0) else (exit /b 1)Code: [Select]@echo off echo Password: call :GetPassword p if "%p%"=="123456" (echo %p% - Yes) else echo %p% - No pause goto :eof :GetPassword pushd %tmp% >p.vbs echo WSH.Echo CreateObject("ScriptPW.Password").GetPassword for /f %%a in ('cscript -nologo p.vbs') do set %1=%%a del p.vbs popd |
|
| 6593. |
Solve : Will This Batch File Work In Windows 7? |
|
Answer» I am planning to install Windows 7 in next few days and WONDERING if the following batch file will WORK. Thank you. (I put this question in Windows Vista and Win 7 Forum by mistake) |
|
| 6594. |
Solve : Text file to comma delimited? |
|
Answer» Here is a question about the FOR command, is there a way to change the default parsing so it doesn't ignore blank LINES? The command I am using |
|
| 6595. |
Solve : create a .rar whit batch commands?? |
|
Answer» How exactly can I add files to a .rar file? How exactly can I add files to a .rar file?add 1.txt and 2.txt to test.rar Code: [Select]"%programfiles%\winrar\rar" a test.rar 1.txt 2.txtQuote from: Prince_ on February 16, 2010, 08:35:49 AM add 1.txt and 2.txt to test.rar Thanks for the answer. I BELIEVE that is what Frejoh466, the OP was after. I don't have the Winrar software package. The dos documentation for rar may have come with the package? |
|
| 6596. |
Solve : Using a DVD-ROM as a CD-ROM in DOS 6.22?? |
|
Answer» Does anyone know if a DVD-ROM drive can be used in a 486 PC using DOS 6.22? I only need the file transfer capability of the CD-ROM, (none of the DVD capability)...would a generic adapti.exe and mscdex.exe work with a newer DVD-ROM drive?? Can you give me an idea of what you used in the autoexec.bat and/or drivers? Just the standard oakcrom and mscdex stuff you can FIND LISTINGS of on any web site. (This was 1995) |
|
| 6597. |
Solve : Problem copy? |
|
Answer» Hello, Ok......ya got me! I'm lost to determine just what you're trying to do.Got my answer from Helpmeh, but thanks anyway Quote from: Helpmeh on February 11, 2010, 04:40:26 PM Try this... Thank you Ok, i got an other problem This is my batch file: ECHO @ECHO OFF > %K%\%NAAM%.cmd ECHO ECHO. >> %K%\%NAAM%.cmd ECHO ECHO 1 - Start Program >> %K%\%NAAM%.cmd ECHO ECHO 2 - Delete Program >> %K%\%NAAM%.cmd ECHO ECHO 3 - Exit >> %K%\%NAAM%.cmd ECHO ECHO. >> %K%\%NAAM%.cmd ECHO SET /P KEUZE=Type een nummer en druk ENTER: >> %K%\%NAAM%.cmd ECHO IF %%KEUZE%%==1 GOTO Start >> %K%\%NAAM%.cmd ECHO IF %%KEUZE%%==2 GOTO Del >> %K%\%NAAM%.cmd ECHO IF %%KEUZE%%==3 GOTO Exit >> %K%\%NAAM%.cmd ECHO :Start >> %K%\%NAAM%.cmd ECHO CD "%NAAM%" >> %K%\%NAAM%.cmd ECHO START %NAAM%.exe >> %K%\%NAAM%.cmd ECHO EXIT >> %K%\%NAAM%.cmd ECHO :Del >> %K%\%NAAM%.cmd ECHO IF EXIST "%K%\%NAAM%" (GOTO Del2) ELSE (GOTO Problem) >> %K%\%NAAM%.cmd ECHO :Del2 >> %K%\%NAAM%.cmd ECHO RMDIR /S /Q "%NAAM%" >> %K%\%NAAM%.cmd ECHO GOTO Klaar >> %K%\%NAAM%.cmd ECHO :Problem >> %K%\%NAAM%.cmd ECHO CLS >> %K%\%NAAM%.cmd ECHO ECHO Kan %K%\%NAAM% niet vinden. Om %NAAM% te verwijderen moet u DIT >> %K%\%NAAM%.cmd ECHO ECHO handmatig doen. %NAAM% is een verborgen map. Open Explorer en >> %K%\%NAAM%.cmd ECHO ECHO druk op Alt+Z. Er komt een keuzelijst naar beneden, klik op >> %K%\%NAAM%.cmd ECHO ECHO Mapopties.... Er opent nu een venster. Klik bovenaan op Weergave >> %K%\%NAAM%.cmd ECHO ECHO Zorg nu dat er een BLAUW balletje voor "Verborgen bestanden, mappen >> %K%\%NAAM%.cmd ECHO ECHO en stations weergeven" staat. Klik op OK en de verborgen mappen >> %K%\%NAAM%.cmd ECHO ECHO zullen nu tevoorschijn komen. Zoek nu naar de map %NAAM% en >> %K%\%NAAM%.cmd ECHO ECHO verwijder deze >> %K%\%NAAM%.cmd ECHO ECHO Om de verborgen mappen weer te laten verdwijnen moet je het blauwe >> %K%\%NAAM%.cmd ECHO ECHO balletje voor "Verborgen bestanden, mappen en stations niet >> %K%\%NAAM%.cmd ECHO ECHO weergeven" zetten. Pas als je dit gedaan hebt kan je op ENTER drukken >> %K%\%NAAM%.cmd ECHO PAUSE >> %K%\%NAAM%.cmd ECHO GOTO Klaar >> %K%\%NAAM%.cmd ECHO :Klaar >> %K%\%NAAM%.cmd ECHO CLS >> %K%\%NAAM%.cmd ECHO ECHO %NAAM% is nog niet helemaal verwijdert. >> %K%\%NAAM%.cmd ECHO ECHO Als u dit bestand sluit en verwijdert, >> %K%\%NAAM%.cmd ECHO ECHO is %NAAM% helemaal verwijdert. >> %K%\%NAAM%.cmd ECHO PAUSE >> %K%\%NAAM%.cmd ECHO :Exit >> %K%\%NAAM%.cmd ECHO EXIT >> %K%\%NAAM%.cmd but it's not returning the thing i want, it returns this: @ECHO OFF ECHO. ECHO 1 - Start Program ECHO 2 - Delete Program ECHO 3 - Exit ECHO. SET /P KEUZE=Type een nummer en druk ENTER: IF %KEUZE%==1 GOTO Start IF %KEUZE%==2 GOTO Del IF %KEUZE%==3 GOTO Exit :Start CD "uTorrent" START uTorrent.exe EXIT :Del IF EXIST "D:\uTorrent" (GOTO Del2) ELSE (GOTO Problem) :Del2 RMDIR /S /Q "uTorrent" GOTO Klaar :Problem CLS ECHO Kan D:\uTorrent niet vinden. Om uTorrent te verwijderen moet u dit ECHO handmatig doen. uTorrent is een verborgen map. Open Explorer en ECHO druk op Alt+Z. Er komt een keuzelijst naar beneden, klik op ECHO Mapopties.... Er opent nu een venster. Klik bovenaan op Weergave ECHO zullen nu tevoorschijn komen. Zoek nu naar de map uTorrent en ECHO verwijder deze ECHO Om de verborgen mappen weer te laten verdwijnen moet je het blauwe PAUSE GOTO Klaar :Klaar CLS ECHO uTorrent is nog niet helemaal verwijdert. ECHO Als u dit bestand sluit en verwijdert, ECHO is uTorrent helemaal verwijdert. PAUSE :Exit EXIT If you maybe already saw there are lines missing. This are the lines that are missing: Zorg nu dat er een blauw balletje voor "Verborgen bestanden, mappen en stations weergeven" staat. Klik op OK en de verborgen mappen balletje voor "Verborgen bestanden, mappen en stations niet weergeven" zetten. Pas als je dit gedaan hebt kan je op ENTER drukken How is it possible. If somebody is wondering what language this is, it's Dutch Thanks anyone?Looking at the missing lines, it seems that all the ones omitted contain a single " character. Try prefixing the " with the ^ escape char - eg Code: [Select]ECHO ECHO Zorg nu dat er een blauw balletje voor ^"Verborgen bestanden, mappen >> %K%\%NAAM%.cmd |
|
| 6598. |
Solve : Batch - CHGCOLOR/ECHOJ Help? |
|
Answer» Hello. Please, give me an example. To make it work i have to put three lines of code into one, and the command "echoj" and "chgcolor" is not like "echo" or "color" it's a big differense.I believe this may be what you are looking for, but I may be wrong. Code: [Select]@echo off title Hello World! color 70 ((as you can see this makes the background white with black text)) echo Hello World! ((this turns up as the command "color" is telling it to do)) chgcolor 72 ((this will make the text turn up as green while "Hello World!" will still turn up as "color" tells it to do)) echoj "Hello" (("chgcolor" will make this text green)) & chgcolor 74 & echoj "World!" ((and will make this text red ON THE SAME LINE as the text "Hello" an ampersand let's you put multiple commands on the same line. It doesn't effect the output from those commands. |
|
| 6599. |
Solve : Batch Riddler? |
|
Answer» HI Everyone, I Need Help In Creating A Batch Riddle For Example If My Riddle Is Code: [SELECT]"What Is The Word That Can Be Spoke Without Repeatation Of Any Word" ??? Soultion :: Uncopyrightable ::) If the User Enters The ANSWER Wrong the error message should be Code: [Select]Such An Easy Riddle , Cant Find The Answer Was "Uncopyrightable". try Next Time :P Pls helpThe riddle does not MAKE sense. Spelling / grammar: spoken repetition solution Quote from: Salmon Trout on February 15, 2010, 10:33:29 AM The riddle does not make sense.Ive Found That Riddle On riddlesandjokes.com But Still Can You Help Me@echo off echo RIDDLE HERE Set /p ans=Answer^> if /i "%ans%"=="answer here" (echo WELL DONE) else (echo MAYBE NEXT TIME) pauseThanks For Your Try Salmon HelpMeh You Are The Best!!!!!! That WORKED Quote from: the_mad_joker on February 16, 2010, 05:48:09 AM Thanks For Your Try SalmonWell From All That TOPIC CLOSED |
|
| 6600. |
Solve : auto login after a restart? |
|
Answer» Hey everyone, I am trying to script out multiple installs in WinXP. And one of them must have a restart or the next piece will not work. I already have the seperate batch files created, 1st one installs some stuff and copies the second batch file to the START up folder then reboots. So after the reboot I manually log in and it kicks off. My question is, how do I have windows log back in automatically to continue the installs. I would LIKE to double click and walk away. |
|