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.
| 4901. |
Solve : add reg data through a batch file instead of a .reg file? |
|
Answer» hi there to all my friends specially you ! REGEDIT4 i copid these data into a new batch file and replaced [ ] with " " then i added REG ADD at the beginning of each line so it looks like this Quote REG ADD "HKEY_CURRENT....it adds each line successfully into the registry but it's not working what's wrong? can you fix it for me? Hello, mioo_sara. You should use 'Reg Add', not 'Add reg' For additional help go here.sorry i mistyped it !! i changed it to REG ADD and it still is not working !! why? i believe problem is in lines (3 and 5) by the way i updated my first post thanks dear archer i am wating can someone solve the problem?reg add "HKCU\Software\My Own File Sorter" /v Regcode /d "DCFA1E43-4F572A3A-C6EC9F67-8A1C9C41-0607E9D7-BF1FDF3A-AE703C7E-B3666661" Code: [Select]REGEDIT4 ;@start regedit /s "%~f0"&goto :eof [HKEY_CURRENT_USER\Software\My Own File Sorter] [HKEY_CURRENT_USER\Software\My Own File Sorter\Regcode] @="DCFA1E43-4F572A3A-C6EC9F67-8A1C9C41-0607E9D7-BF1FDF3A-AE703C7E-B3666661" [HKEY_CURRENT_USER\Software\My Own File Sorter\User] @="new user"thank you both (Prince_ and Reno) well Prince_ solved the problem thank you very much but RENO although my problem is solved but just for learning purpose i ask this question= in your codes all values are EXPORTED into registry and i don't see any error but it's not working(with your code not Prince_) i changed "Regcode" line as you posted and "User" line as you see below Quote reg add "HKCU\Software\My Own File Sorter" but although it hasn't error but it's not working what's the CORRECT algorithm? well as i mentioned problem is solved with ( Prince_ ) codes and it's just for educational purpose so if you don't have time ignore iti have had trouble with an error that comes up , it says error when write data to registry. how does one correct that ?Quote from: worrywart2009 on AUGUST 31, 2009, 02:45:37 AM i have had trouble with an error that comes up , it says error when write data to registry. how does one correct that ? Worrywart2009, You need to start your own thread. |
|
| 4902. |
Solve : something is confuzzling me.? |
|
Answer» I need to write part of a BATCH file, that goes out to a folder, deletes all folders that have numbers in them (meaning they are strictly numbers) and nothing else. I have tried, and am probably not understanding rmdir, and also rd... but neither are working properly, for what I need to do. does anyone have any ideas?im sorry this may be off topic and i apologize in advanced but what kind of word is confuzzling?!?!?!.....lol im sorry this may be off topic and i apologize in advanced but what kind of word is confuzzling?!?!?!.....lol It is an American English jocular variant of "CONFUSING". (Surely you could have guessed that from the context in which it occurred?) You have to imagine a kind of white haired bearded Burl Ives type of Southern guy saying "These here new fangled Intarwebs sure are confuzzlin' me! Yee Har! I guess I'll just whip up a batch of corn pone!" Type rd /? or rmdir /? at the command prompt to see the params.mmagruder, POSSIBLY the folders you are trying to remove are not empty? Rmdir / RD will fail in that situation, unless you use certain switches. Or maybe you do not have sufficient admin rights. "Not working properly" is not ENOUGH INFORMATION. Perhaps you could show us (1) what code you are using and (2) what error messages you are getting? Incidentally Quote rmdir, and also rd... but neither are working properly They are the same command. Whether you use rmdir or rd, you get the same code running. To add to Salmon's reply. Please tell us the OS your using. |
|
| 4903. |
Solve : Copying to a remote computer? |
|
Answer» Ok, let's say I'm trying to copy a file from my computer, to another computer. Is this possible without being on a LAN? Can I send files if I have the computer's IP address? I'm trying to get another ALTERNATIVE to a FTP site that works via batch.If you are both on a peer to peer network you could share files.We're not... Google is your friendNot really for this. I tried getting a good host last year, one wouldn't accept my password, another had hidden costs, another would bring up random errors and crash my script, at least 3 wouldn't transfer files. The LIST goes on. oh, well 0catch.com works for me, really EASY stuff. and free, been using it for around a year nowWhat's the syntax for ftp with a file containing all the commands (including username and password)?it should look like this: Quote ftp> open 0catch.com its just your login info and btw, to login to the website, the username is user.0catch.comI know about that. But let's say I have a file called comm.txt and in it is this: User.0catch.com PASSWORD COMMANDS The ftp command can utilise that and run those commands automatically. I've done this before, I just can't remember how. ah yes, thanks to my vault of scripts i always keep you will have a file with the data Code: [Select]username password commands and in your ftp batch Code: [Select]ftp -i -s:data.txt ocatch.comQuote from: BatchFileBasics on August 30, 2009, 04:27:08 PM ah yes, thanks to my vault of scripts i always keepI remember the -s: part now, but what does -i do (I can't access my computer right now)?-i is for no prompting "would you like to send file xx (y/n)" its for automated use with lots of filesQuote from: Helpmeh on August 30, 2009, 04:29:47 PM what does -i do Turns off interactive prompting during multiple file transfers. List of FTP commands for the Microsoft command-line FTP client http://www.nsftools.com/tips/MSFTP.htm Thank you. |
|
| 4904. |
Solve : [solved] Create 100 files in a folder? |
Answer» QUOTE from: BC_Programmer on August 22, 2009, 12:18:56 PMI'm trying to understand why multiple batch files are even necessary. Is for my program Goldmine 5.5 from Frontrange. This program make macros with the structure user.800 .... user.899 When I launch from the exterior a user.800.bat ...... user.899.bat I'm launching the program with my parameters and a specified macro. In this way user.860.bat launch echo off taskkill.exe /im gmw5.exe /f Y:\GoldminePrg\gmw5.exe /i:esm /U:JOSE /p: /m:Y:\GoldminePrg\Macros\user.860 exit P.D. Each macro goes o search for a certain field in the database. So is equivalent to enter Goldmine and go to the field determined by the interior macro..... I hope is understood. Thanksxxxx Quote from: BC_Programmer on August 22, 2009, 12:18:56 PM I'm trying to understand why multiple batch files are even necessary. Well. I use excel 2002 and have a check list. I would like to link this list with certain contacts in the database. Each bat is used to link to a contact predetermined with a INTERNAL goldmine macro. In an excel cell I put the PATH to the bat : \pepe.800.bat Each bat EXECUTE the program goldmine and a internal macro , and goes to a predetermined contact in the database. And edit that contact. I hope this is understood. I have to make one internal macro for each contact to search. And one corresponding bat for each internal macro. The internal macro have the structure pepe.800 and the bats have the structure pepe.800.bat .... Quote from: BatchFileBasics on August 22, 2009, 12:25:01 PM Esgrimidor, what do you need 100 batch files for anyways? 1 file, about 10 lines, and a good for loop can probably do what all these files would do.. Please tell me if this modification is correct or not : Code: [Select]@echo off :begin set pth= echo. set /p pth=Path of folder: if not exist "%pth%" ( mkdir "%pth%" goto :PRE ) echo. echo ERROR: Folder exists goto :begin :PRE set /p pr=Prefix for files: echo. echo IF THE PREFIX CONTAINS INVALID CHARACTERS, FILES WOULD NOT BE CREATED. pause cd /d "%pth%" for /l %%a in (800,1,899) do ( echo @echo off>%pr%.%%a echo taskkill.exe /im gmw5.exe /f>>%pr%.%%a echo Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%pr%.%%a >>%pr%.%%a echo exit>>%pr%.%%a )sorry, i mean the extensions it is being output to is not in bat following your..."requests" this is it: Code: [Select]@echo off :begin set pth= echo. set /p pth=Path of folder: if not exist "%pth%" ( mkdir "%pth%" goto :PRE ) echo. echo ERROR: Folder exists goto :begin :PRE set /p pr=Prefix for files: echo. echo IF THE PREFIX CONTAINS INVALID CHARACTERS, FILES WOULD NOT BE CREATED. pause cd /d "%pth%" for /l %%a in (800,1,899) do ( echo @echo off>%pr%.%%a.bat echo taskkill.exe /im gmw5.exe /f>>%pr%.%%a.bat echo Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%pr%.%%a >>%pr%.%%a.bat echo exit>>%pr%.%%a.bat )Of course you are right Sure there are a lots of ways of doing this : DDE, API Goldmine, COM procedures, etc. But in the goldmine forum , at the present moment, they don't give support for via VB create an script for seek a record in the database without need to open goldmine. This way is one of many ways, and for me is enough. Thank very much. 100 is the number of macros you can create with a user. Each user can have 100 macros. And the user JOSE can use the macros of other users...... In this way I can have all the links I need from excel, word. To make "fussions" Goldmine have an utility : gmlinks I use to prepared personalyzed writes.... Quote from: BatchFileBasics on August 22, 2009, 12:41:24 PM sorry, i mean the extensions it is being output to is not in bat I see..... How can I do bat files pepe.800.bat and inside the bat : pepe.800 only ? thats what it is, they are all .bat files. but inside are just pre.800 no .bat insideOh yes. Perfect. Is enough for me. You have saved me a lot of work. With the bats is another thing.... Code: [Select]@echo off set /p prefix=Enter Prefix: for %%d in (0, 1, 100) do ( set /A i=%%d+800 taskkill.exe /im gmw5.exe /f Y:\GoldminePrg\gmw5.exe /i:esm /u:JOSE /p: /m:Y:\GoldminePrg\Macros\%%prefix.%%i.bat ) exit |
|
| 4905. |
Solve : Batch file for high contrast? |
|
Answer» I NEED help creating a batch FILE that will automaticall turn on high CONTRAST under display in ACCESSIBILITY options for a user that has problems seeing. I have Zenworks and have used a roaming profile, but the high contrast will work even better.What video display adapter is it ? ? |
|
| 4906. |
Solve : CD-ROM drivers for Compaq? |
|
Answer» Where could I find DRIVER cdc710.sys for download?http://www.driverfiles.net/No, I`m sorry but the driver I`m searching for is not found on the webadress you refer to, or is it me who is not able to search properly??Quote from: tor47 on August 29, 2009, 10:30:33 AM Where could I find driver cdc710.sys for download? You really need a SCSI cd-rom driver? Really? The CD-rom drive has so far got no drive letter and is not working. The drive is a Compaq CR-503BCQ. According to the manual "CD-ROM Drive Installation and Operations Guide" from Compaq the driver name is CDC710.sys. Quote "The CDC710.sys driver works with Microsoft CD_ROM extensions (MSCDEX.EXE) to allow DOS to view up to two CD_ROM drives as read-only hard drives and will atomatically assign a drive letter for the CD_ROM drive". That`s the reason for my search for this spesific driver. If ANYBODY has other solutions to get th CD_ROM working I would be grateful. I should also add that I`m not quite sure the autoexec.bat and config.sy files are correct.You would only need this driver if: (1) You are using MS-DOS or Windows version 3. (2) The CD-ROM is a SCSI drive. unless BOTH of these are true, that file is not going to help you. yes, this is used for dos and he probably understands that. so you can download the driver here and you MAY see the virus report here so put it on a floppy, insert, RUN, setup yeaOptical drives don't need any extra drivers under XP.Quote from: Broni on August 30, 2009, 12:52:48 PM Optical drives don't need any extra drivers under XP. Indeed. |
|
| 4907. |
Solve : Alternate Data Streams? |
|
Answer» Win XP Home - Cmd.exe The only Internal/External command which works with ADS appears to be More Not really sure of the context of this statement. More can display output on the console. It can TAKE input from the output of another command or as a passed command line parameter. Is this what you're referring to? If so, Sort, Find, and Findstr act in a similar manner. Sort Find and Findstr are not really what I had in mind. I'm creating ADS's but find that there's not really a lot can be done with them except by using More. Because they are totally hidden it seems none of the cmd.exe commands can access them individually. If I create an ADS using: Echo The quick BROWN fox jumps over the lazy dog > cookyfile.txt:brownfox the cookyfile.txt file is created as a 0 byte file and the ADS brownfox contains the echoed string. If I now want to display/print/edit/etc.. the contents of the ADS I cannot access it using Type, Print, Edit etc... I enter Type cookyfile.txt:brownfox and the error message returned is "The filename, directory name, or volume label syntax is incorrect." I wondered if anyone had gotten commands to work on an ADS, am not really interested in third party products. ThanksYou can use the mep command which is the Microsoft Editor available in the Platform SDK. I can't help but be a bit suspicious. ADS can be used to fork file data (read: inject malicious code/rootkits) into existing files without affecting their functionality, size, or display to traditional file browsing utilities like dir or Windows Explorer. I could only find one legitimate use of ADS for certain files in Windows that have a summary tab in their properties. This information is saved as ADS files attached to the document. This can just as easily be done through the Windows GUI or any of the Windows script languages. What are you trying to accomplish? good question, Sidewinder. Quote from: Sidewinder I can't help but be a bit suspicious...... I could only find one legitimate use of ADS for certain files in Windows that have a summary tab in their properties...... I can't help but be a bit suspicious...... What are you trying to accomplish? Quote from: Dias de verano good question, Sidewinder. Wow, my little innocuous project brought out the big GUNS. All I want is a better (faster) method of displaying the contents of ADS which I am capable of writing. Had I wanted to BOMBARD all and sundry with hidden malicious code/rootkits that would already be happening. My purpose is to add confidential comments to personal files. Sure there are other ways of doing this, such as encryption, but I just wanted to try ADS which, IMO, is simpler and secure enough for my purpose. Now I shall try hard LINKS using the script(s) supplied by MS. Thanks for your comments.Quote from: ValerieMay All I want is a better (faster) method of displaying the contents of ADS which I am capable of writing. Subsequently I found that Notepad can do everything I want so I'm upward & onward. Quote Wow, my little innocuous project brought out the big guns. Nonsense. We only scrambled a few jets with their Sidewinder payloads. For the big guns we would have gone to the silos for the Titans. Quote All I want is a better (faster) method of displaying the contents of ADS which I am capable of writing. A VBScript could do this faster and easier than Notepad. Less prone to error also. As long as you're doing it manually with Notepad, why not right click the document and enter built-in or custom properties? But hey!, as long as you're upward and onward, we're happy. Good luck. Quote from: Sidewinder on October 18, 2008, 07:37:36 AM
Those are missiles, or what Americans call "missles". This is a little gun. This is a big gun |
|
| 4908. |
Solve : Wildcards in a variable? |
|
Answer» Can I use wildcards when defining a variable name? Like this: you need a programming construct called an array. batch doesn't have that... (although in batch you could probably do a enable delayed expansion , use a for loop and set to create each individual variables with those names)So this should work? For /L %%a in (1,1,10) do set num%%a=abc Right?no it doesnt i just tried itQuote from: smeezekitty on August 29, 2009, 06:24:13 PM no it doesnt i just tried itDid you do that from the COMMAND prompt or a batch FILE? One % for command prompt, two % for batch file.oops i forgot that yes it does work |
|
| 4909. |
Solve : Rename Various files with a batch file? |
|
Answer» I have a lot of .jpg's in one folder with a lot of different names. I want to rename them all in sequence i.e. 10001.jpg, 10002.jpg and so on. Or even with names like a.jpg, B. jpg or even aa.jpg, ab.jpg ac.jpg... |
|
| 4910. |
Solve : Batch file for Windows XP? |
|
Answer» I posted this in the Windows forum and was told that I should have posted it here: |
|
| 4911. |
Solve : Change File Name?? |
|
Answer» Help: Assuming thati was looking for a batchfile to do that it works great and i am not the ORIG poster it makes no sense to me how does it work? how do you MAKE it take of 5 chars? Quote from: smeezekitty on August 20, 2009, 01:35:20 AM how do you make it take of 5 chars? Code: [Select]set newname=!oldname:~N! Replace N in that line with the number of characters to remove from the beginning of the filename. works perfectly |
|
| 4912. |
Solve : .bat file to end a process...? |
|
Answer» Can someone please help me? I'm trying to find a command line that will end a process like when you open task manager and go to the process TAB and end processes. The reasoning is when I run my virus removal software it tells me to end a few things and it would just be easier to click a .bat file then to bring up task-manager ..please help A similar question appeared earlier this week. I guess some code just never dies. |
|
| 4913. |
Solve : How to trace the order of the batch files which are running one after the other? |
|
Answer» Hello all, these batch files will be executed one after the other. Then you already know, don't you? use debug: C:\>debug /? Runs Debug, a program testing and editing tool. DEBUG [[drive:][path]FILENAME [testfile-parameters]] [drive:][path]filename Specifies the file you want to test. testfile-parameters Specifies command-line information required by the file you want to test. After Debug starts, type ? to display a list of debugging commands. C:\>debug -? assemble A [address] compare C range address dump D [range] enter E address
go G [=address] HEX H value1 value2 input I port load L [address] [drive] [firstsector] [number] move M range address name N [pathname] [arglist] output O port byte proceed P [=address] [number] quit Q register R [register] search S range list trace T [=address] [value] unassemble U [range] write W [address] [drive] [firstsector] [number] allocate expanded memory XA [#pages] deallocate expanded memory XD [handle] map expanded memory pages XM [Lpage] [Ppage] [handle] display expanded memory status XS -[/list]Billrich, can you talk me through how this will enable the OP to do what he wants? Quote from: Salmon Trout on August 29, 2009, 05:13:04 AM Billrich, can you talk me through how this will enable the OP to do what he wants? Oh, this is a production site and we are being paid? Contact my secretary at BR549 with a $2000.00 advance. My consulting FEES are $500.00 per hour. Do not use wait* or *wait*I asked because I don't believe debug will help the OP one little bit. I CHALLENGE you to say how it would, if you can. Quote from: Salmon Trout on August 29, 2009, 07:15:07 AM I asked because debug will not help the OP one little bit, and I don't believe you actually know an answer to the OP's question. My secretary has not received the $2000.00 advance. Would you list your company? We need to check your credentials. Is the name of your company "Computer Phishing?" Quote from: simhadri1985 on August 20, 2009, 05:50:04 AM Hello all, Mr. Trout: This thread is a Charade. The OP is Fake. His call for assistance is fake. Why would anyone try to a download programs to a user's computer silently? The OP has a warped sense of humor. No one believes the OP is serious. |
|
| 4914. |
Solve : drag and drop problem? |
|
Answer» i WANT to have so if i click on it it will SAY "what do you want to do" and when i drag a torrent file it will open utorrent Drag and Drop is a technique with windows. There is no drag and drop command for the command prompt ( Dos commands? ). If you drag a file into a command window, something HAPPENS. Try it. yes i know that but i want it to open utorrent when i put a torrent file on top of the batch fileQuote from: rubiks231 on August 20, 2009, 10:53:56 AM yes i know that but i want it to open utorrent when i put a torrent file on top of the batch file Well, make a shortcut to the batch file and whatever is dropped on it is "%*" and then you can start utorrent with the parameter, if utorrent supports it. thanks it worked |
|
| 4915. |
Solve : set /a and variable names? |
|
Answer» An example of the code I'm using that works properly. This allows a user to input a numerical value, then the process will loop that many times, letting the user specify a new VARIABLE each time. Your second thought is correct, variable names cannot include spaces They can, but it should be avoided as a rule because sometimes problems can happen, like now when the combination of set /a and delayed expansion is a bit toxic. Really!!! Just shows how far BACK I go, we never had spaces in anything when I were a lad GThanks for the help. I played around with the code above and removed the delayed expansion. Seems set /a just won't play with multi-word variable names. Guess I need to break this bad habit in naming my variables. Just seems so much more logical and easy to ready with spaces. Maybe it's just me. Anywho, thanks again.Quote from: gregory on October 17, 2008, 08:23:29 AM Just seems so much more logical and easy to ready with spaces. Maybe it's just me. Not many programming or scripting languages ALLOW spaces in variable names. With Windows command prompt at least you can use them sometimes, although many serious programmers strongly deplore their use. Underscores hyphens and dots are popular as substitutes. The reason why set /a does not like variable names with spaces is, I think quite simply because unlike simple set, set /a does not require % signs around a variable to the right of the = for operations with literal numbers such as set /a number=number+1 alternative, more compact format: set /a number+=1 and therefore would have trouble DECIDING where variable names end. although of course you would need to use !number! on the right of the = when using delayed expansion. |
|
| 4916. |
Solve : DOS Batch To Run When Logging Out? |
|
Answer» Hello, |
|
| 4917. |
Solve : Question about the rename command? |
|
Answer» Hi everyone cd E:\Documents and Settings\handsome\Desktop\ is panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} in the file E:\Documents and Settings\handsome\Desktop ? you need to change directory to where the panel.{21EC2020-3AEA-1069-A2DD-08002B30309D} is and the rename it. FBthx yes thats where I pointed to its on my desktop like I said if I paste this into the command prop and hit enter it works like I expect but not from the different path/directory any clue why this isnt right ?if you the current directory is on a different drive letter, CD is not enough, you need to do CD /D otherwise you remain on the first drive letter. You nailed it summer where I had moved the file was on a shortcut folder which was linked to a different drive.. when I placed the files back on the same drive as the folder it works great TYVM also can you give me an example of the syntax on cd/d ? Again thanksQuote from: chas_3rd on October 16, 2008, 06:42:51 AM also can you give me an example of the syntax on cd/d ? You are in drive C, in folder \apples The prompt looks like this C:\apples> If you do a DIR you will SEE the files and folders in C:\apples But now you want to be in folder C:\oranges You type CD C:\oranges The prompt changes to this C:\oranges> If you do a DIR now you will see the files and folders in C:\oranges You want to change to a folder on drive D, called \pears. You type CD D:\pears but the prompt does not change. It still shows C:\oranges> If you type DIR you still see the files in C:\oranges. This is because the new folder is on a different drive. You have to type CD /D D:\pears The prompt changes to D:\pears> You do a DIR and you see the files and folders in D:\pears. Awesome ty sir/maam im one step closer to being a dos genius Have a good one and thx again chas |
|
| 4918. |
Solve : prefix each line in a txt file with a value? |
|
Answer» I have searched QUITE a few topics and haven't seen ANYTHING which seems to meet my REQUIREMENTS...... |
|
| 4919. |
Solve : MS-Win CLI network configuration? |
|
Answer» Hi folks, |
|
| 4920. |
Solve : How to pass a return value from a jar file to a batch file? |
Answer» QUOTE from: BatchFileBasics on AUGUST 19, 2009, 11:34:03 AMjust remove the delims If the OUTPUT is just (e.g.) 33 then the TOKENS= part needs to go as well and the variable is the same (e.g.) %%A in the FOR and in the DO parts. |
|
| 4921. |
Solve : print ot file from DOS? |
|
Answer» Hello cd\ and this one i whant to save into the file Quote D:\>cd\Quote D:\>cd\ What's the purpose in creating a file containing command errors Code: [Select]test.bat >>outfile.txt i have 2 bat files, in first i check my NETWORK connection: Quote echo offIf not ok with connection it calls another bat file which restart my connection(i NEED two files, i can't make it in one) And i need to log everything what happens in second file(secu.bat) i try to call it like this c:\secu.bat >> test.txt, it's make file called test.txt but this file is empty.try using call command Code: [Select]call c:\path\of\file.bat |
|
| 4922. |
Solve : Win/Batch: If then else related questionHi there,? |
|
Answer» Hi there, I suspect it does not like nested IFs I wrote the evaluate.vbs script some months AGO, under a different screen name. Anyhow, you are partly right. Use of this parenthetical structure: IF EXIST "collect_*.TXT" ( blah blah blah ) else ( blah blah blah ) means that 1. the parentheses in this statement... echo Wscript.echo eval(WScript.Arguments(0))>"%cd%\evaluate.vbs" and these... cscript //nologo "%cd%\evaluate.vbs" "day(date)" cscript //nologo "%cd%\evaluate.vbs" "month(date)" cscript //nologo "%cd%\evaluate.vbs" "year(date)" ...need escaping, ^(with carets^) and... 2. without delayed expansion the variables d, m and yyyy will be set to blanks and thus result in "not expected at this time" messages when you do LSS GTR EQU etc comparisons So the idea of using gotos is a good one. Here is my version Code: [Select]@echo off IF not EXIST "collect_*.TXT" goto noinfo echo Wscript.echo eval(WScript.Arguments(0))>"%cd%\evaluate.vbs" For /f %%D in ( ' cscript //nologo "%cd%\evaluate.vbs" "day(date)" ' ) do set /a d=%%D For /f %%M in ( ' cscript //nologo "%cd%\evaluate.vbs" "month(date)" ' ) do set /a m=%%M For /f %%Y in ( ' cscript //nologo "%cd%\evaluate.vbs" "year(date)" ' ) do set /a yyyy=%%Y del/q "%cd%\evaluate.vbs" if %d% LSS 10 (set dd=0%d%) else (set dd=%d%) if %m% LSS 10 (set mm=0%m%) else (set mm=%m%) set TimeStamp=%yyyy%-%mm%-%dd :noinfo echo. echo no information collected! echo. pause exit |
|
| 4923. |
Solve : Copying files from hard drive to USB? |
|
Answer» but i assume the computer is XP+ anybody else getting a headache from the brick wall? I'm fine...wait what was the question ? ? Is that you ToTo ? ?QUOTE from: stanko1610 on August 18, 2009, 06:05:54 PM Ok. How it can be done to copy files to CD in background without promting?I don't think you can copy files straight to a cd without burning. Quote from: Helpmeh on August 18, 2009, 06:08:50 PM I don't think you can copy files straight to a cd without burning. packet writing Quote from: Salmon Trout on August 19, 2009, 12:17:40 AM packet writing good, so all that the OP needs to do is to invisibly check wether packet writing software is installed, if not, invisibly install it, then invisibly invoke it, then invisibly copy the files to it,after invisibly ENSURING a disc is present and if not invisibly asking the user to insert one, all while remaining invisible to the user for some unknown reason that I'm sure we can all fathom on our own. Quote from: BC_Programmer on August 19, 2009, 12:33:29 AM good, so all that the OP needs to do is to invisibly check wether packet writing software is installed, if not, invisibly install it, then invisibly invoke it, then invisibly copy the files to it,after invisibly ensuring a disc is present and if not invisibly asking the user to insert one, all while remaining invisible to the user for some unknown reason that I'm sure we can all fathom on our own.dont forget all in batch all in a batch file that somehow also runs invisibly, yes Of COURSE you can do it all in one line with awk. whats awk? i think the original poster should not ask for rediculus requestsQuote from: smeezekitty on August 19, 2009, 12:51:10 AM whats awk? Are you serious?! PS it's "ridiculous". |
|
| 4924. |
Solve : Rename files with specific extension pattern? |
|
Answer» I’ve searched the forums on this site & couldn’t find ANYTHING conclusive. I need a DOS batch command similar to the one below to add a '.tif' extension to multiple files that have a specific pattern in their extension. |
|
| 4925. |
Solve : Telnet using batch script? |
|
Answer» Hi, telnet and windows command prompt are two different things.MAYBE so, but the OP asked if possible to automate the login of a telnet session, which sounds REASONABLY possible. Is there no way we can acheive this??Please help me out..try using putty. much easier....interface. |
|
| 4926. |
Solve : Help...? |
|
Answer» I have a CODE... And what about if they just press Enter?If its not 1, 2 or 3 then it loops.Quote from: Helpmeh on August 17, 2009, 05:58:24 AM If its not 1, 2 or 3 then it loops. In the IF test, since %T% is (hopefully) a string, if you don't have any "quotes" or .dots. or {spider brackets} etc around the input variable %T% and the comparison value then it will crash if just Enter is PRESSED. Enter is an empty string. So, if just Enter is pressed - If %T%==1 GOTO softwaremenu expands to If ==1 GOTO softwaremenu This will cause an error. So do it like this If "%T%"=="1" GOTO softwaremenu Then if enter is pressed it expands to this If ""=="1" GOTO softwaremenu Ahh. Makes sense. |
|
| 4927. |
Solve : export registry? |
|
Answer» Hi there, I suggest using ERUNT... I forgot to mention that I cannot use third-party programs, sry. But as seen as the option is built-in in windows, why shouldn't it work |
|
| 4928. |
Solve : Move file out of unknown subfolder(s)? |
|
Answer» Hi there, chobbes wrote:[/color] I have never used a wildcard as part of the destination folder or destination path. There might be more restrictions with xcopy than copy? Play with both copy and xcopy until they do what you need. I'd just use MozBack to backup a Firefox/TBird profile myself... Directory of C:\Documents and Settings\Bill Richardson\Local Settings\Application Data\Mozilla\Firefox\Profiles 05/09/2009 07:11 AM . 05/09/2009 07:11 AM .. 08/15/2009 10:18 PM wphrcj55.default 0 File(s) 0 bytes 3 Dir(s) 307,320,496,128 bytes free C:\Documents and Settings\Bill Richardson\Local Settings\Application Data\Mozill a\Firefox\Profiles>cd wphrcj55.default C:\Documents and Settings\Bill Richardson\Local Settings\Application Data\Mozilla\Firefox\Profiles\wphrcj55.default>dir Volume in drive C is OS Volume Serial Number is F4A3-D6B3 Directory of C:\Documents and Settings\Bill Richardson\Local Settings\Application Data\Mozilla\Firefox\Profiles\wphrcj55.default 08/15/2009 10:18 PM . 08/15/2009 10:18 PM .. 08/15/2009 10:18 PM CACHE 05/23/2009 12:59 PM Cache(2) 08/11/2009 09:01 PM OfflineCache 08/15/2009 10:18 PM 38,076,416 urlclassifier3.sqlite 08/11/2009 09:53 AM 2,260,858 XPC.mfl 08/15/2009 11:11 AM 1,018,170 XUL.mfl 3 File(s) 41,355,444 bytes 5 Dir(s) 307,320,471,552 bytes free C:\Documents and Settings\Bill Richardson\Local Settings\Application Data\Mozill a\Firefox\Profiles\wphrcj55.default>copy * C:\wphrcj55.default\ urlclassifier3.sqlite XPC.mfl XUL.mfl 3 file(s) copied. C:\Documents and Settings\Bill Richardson\Local Settings\Application Data\Mozilla\Firefox\Profiles\wphrcj55.default> |
|
| 4929. |
Solve : Copying/Buring files into DOS? |
|
Answer» Ok, I'll open up with I'm VERY new to the computer experience, outside from game's, internet, and simple matinence. The man guiding me in this excellent experience GAVE me a test. Now, I can make a partition once window's is already installed using the DOS correct? No. You misunderstood....the partition containing the i386 files would have to be created before the fact in order to install Windows...How WOUL I go about getting said i386 files onto the partition without having the OS installed?Quote from: NathanC on August 15, 2009, 10:45:42 AM How woul I go about getting said i386 files onto the partition without having the OS installed? Custom bootable CD or pen drive maybe...Quote Custom bootable CD or pen drive maybe... I have neither.. |
|
| 4930. |
Solve : Determine which Multi-line missing Corresponding line? |
|
Answer» I have a text file which contains some type of LOG, I want to parse the file for a corresponding line, EG., |
|
| 4931. |
Solve : NC? |
|
Answer» hi |
|
| 4932. |
Solve : Win/Batch: Date/Time question? |
|
Answer» Hi, |
|
| 4933. |
Solve : dos task number? |
|
Answer» im taking a class right now that has alot to do with using dos command prompt and in my homework it says to do a few commands then to "type in the task number and the commands i used to create directories"...what is the task number and how do i know what it is? ive looked around google and cant seem to find anything on it...can SOMEBODY please help me? im taking a class right now that has alot to do with using dos command prompt and in my homework it says to do a few commands then to "type in the task number and the commands i used to create directories"...what is the task number and how do i know what it is? ive looked around google and cant seem to find anything on it...can somebody please help me? Do your own homework. We don't provide homework assistance here.Quote from: Quantos on August 15, 2009, 07:43:03 PM Do your own homework. We don't provide homework assistance here. errr. yes we do... In either case- I think the "task number" might be akin to a "question number" or something, since I don't see a PID or process handle being applicable to something as simple as creating folders.Not according to Nathan.Quote from: Flame on April 03, 2006, 05:46:46 PM Just for any other people out there who need homework help, one or two questions is ok usually, but please, for the love of God, Google it first, READ your textbooks, do your PART! All I gotta say they googled. Besides, they aren't asking for help DOING the homework, they're asking what a "task number" is.Okay, just checking, remember I'm new here too and still getting accustomed... |
|
| 4934. |
Solve : Calling Batch file not shows echo message? |
|
Answer» Hi, code for DEL_FOLDER.BAT You are calling Del_archive and redirecting output to %LOG-FIL% so the Set /p command in Del_archive writes the question to %LOG_FIL% instead of the screen where you expect to view it. What kind of file is %LOG_FIL%. If it's text I could GIVE you some code to show the contents of %LOG_FIL% on the screen.Quote from: BatchFileCommand on August 15, 2009, 12:35:06 PM What kind of file is %LOG_FIL%. If it's text I think that is pretty certain, given that it is the output of a batch file. |
|
| 4935. |
Solve : batch file to run on last day of the month...? |
|
Answer» good day, @ECHO off Code: [Select]if exist ME del ME Mshta VBScript:Execute("If Month(Now)<>Month(DateAdd(""d"",1,Now)) Then CreateObject(""Scripting.FileSystemObject"").CreateTextFile(""ME""):END If:Close") if not exist ME goto Docs del ME {backup commands for C:\TOSHIBA here} :Docs {backup commands for C:\DOCS here}And another which uses the Doff.exe utility from this site.. Code: [Select]@echo off cls for /f %%a in ('doff dd +1') do ( if %%a neq 1 goto docs ) {Toshiba backup commands here} :docs {Docs backup commands here} Good luckhave used the following for exactly what your doing, used it for 2 different small businesses I supported...worth a look at: http://www.karenware.com/powertools/ptreplicator.asp fully automated alsoThis really useful tool. Thanks a lot for the postQuote from: Prince_ on November 27, 2008, 01:22:42 AM Code: [Select]if exist ME del ME i have this in my code as follows: @echo off set folder=%date:~0,3% ECHO %date%, %time% Checking connections, please wait... > C:\BackUpHistory\Report.txt ECHO %date%, %time% Checking to see if www.google.ca can be reached... >> C:\BackUpHistory\Report.txt PING -n 3 www.google.ca >> C:\BackUpHistory\Report.txt|find "Reply from " >NUL :if exist ME del ME Mshta VBScript:Execute("If Month(Now)<>Month(DateAdd(""d"",1,Now)) Then CreateObject(""Scripting.FileSystemObject"").CreateTextFile(""C:\BackUpHistory\ME""):End If:Close") if not exist "C:\BackUpHistory\ME" goto Finish del "C:\BackUpHistory\ME" ECHO ------------------------------------------------------- >> C:\BackUpHistory\Report.txt ECHO %time% Initiating monthly cleanup >> C:\BackUpHistory\Report.txt FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Cookies\*.*" FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Local Settings\Temp\*.*" FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Local Settings\History\*.*" FOR /D %%G IN ("C:\Documents and Settings\*.*") DO DEL/S/Q/F "%%G\Local Settings\Temporary Internet Files\*.*" ECHO %time% Finished cleaning up internet explorer >> C:\BackUpHistory\Report.txt :Finish for /f "tokens=1-6 delims=/: " %%d in ("%date%" "%time%") do rename "C:\BackUpHistory\Report.txt" %%g-%%e-%%f(%%d)@%%h%%i.txt :END it was tested and does work in a batch file format (this is only part of the entire code). i convert the file to an exe file using a batch file to exe converter. when the exe file is run, the code does not run COMPLETELY. the reporting stops at the following line: Initiating Monthly cleanup there is nothing after this line. any suggestions? thank you, jat Quote from: kalasha on August 13, 2009, 11:12:03 PM
Yes. Do not use or rely upon batch-to-exe converters. They generally only work with a limited subset of batch language. They are a kludge. Get tomorrow's day number Employ one-line vbs to determine date of tomorrow, yesterday, 999 days time/ago (whatever) Code: [Select]@echo off echo Wscript.echo eval(WScript.Arguments(0))>"%temp%\evaluate.vbs" REM put date difference in a variable REM tomorrow is +1 REM today is +0 REM yesterday is -1 set diff=+1 REM set trigger number in a variable set trigger=1 For /f %%D in ( ' cscript //nologo "%temp%\evaluate.vbs" "day(date%diff%)" ' ) do set daynum=%%D del "%temp%\evaluate.vbs" if "%daynum%"=="%trigger%" ( do stuff ) |
|
| 4936. |
Solve : boot disk? |
|
Answer» yes I have a windows 98 . I just tried to install and after 22 minutes 77% file copy it gives me suewin an ERROR occured . I choose to ingnore and show application error caused in general protection fault in module verx.dll so i CLOSE and it ended SETUP. |
|
| 4937. |
Solve : temporary file in DOS? |
|
Answer» HELLO all, I want to create a dummy file that have faster read/write access in batch SCRIPT. Could temporary file help me in this situation? If so i want to know about the details Thank you Please explain more clearly what you want to know.Decrease read/write TIMES? Unless the file is WITHIN hundreds of folders in another drive, you probably won't notice the SPEED. |
|
| 4938. |
Solve : shutdown issue? |
|
Answer» I am working on a shut down bat that will shutdown a list of computers remotely. I am having issues getting it to work correctly. I have narrowed the issue down to the shut down command. Any IDEAS on what the cause of the issue might be? It will hit the shutdown command and then loop back to the :SHUT portion of the bat. This behavior can occur if the Unlock Computer dialog box appears on the desktop, or if the computer is locked. this is not the behavior of the issue I am seeing. If you WISH you can copy and RUN the bat. You just need to change the system names. when the batch gets to the shutdown command it will loop back to the top of the :SHUT portion and continue to loop. it will not process past the shutdown command. any ideas?If you enable echo, what messages do you see? it will hit the shutdown command then go back to the :SHUT portion and continue from there. there are no error messages. If I rem out the shutdown command the batch will continue to process correctly. If I copy the command from the batch file and paste it into a cmd window the command will work correctly. That is how I know there is an issue with the batch file and this command.Is the %A% variable being expanded correctly? what happens if you put echo %errorlevel% straight after the shutdown LINE? Quote from: Salmon Trout on July 21, 2009, 02:14:11 PM Is the %A% variable being expanded correctly? yes it is because I see it when it runs the following line: Code: [Select]ECHO TESTING %A% Quote from: Salmon Trout on July 21, 2009, 02:14:11 PM
nothing because the lines after the shutdown command do not process. It is strange because if I enter each command in to a cmd window they work correctly. But, if I run the batch the shutdown command creates a loop. |
|
| 4939. |
Solve : How can I retrieve partition information like free space with MS-DOS Command? |
|
Answer» HELLO! I'm a beginer using MS-DOS Commands, I Need to retrieve information about Disks, PARTITIONS or Volumes with MS-DOS Commands to integrate the output with an aplication. Can you help me????Welcome to the CH forums. You don't indicate which OS you are using, in XP Fsutil is available to return lots of info. TRY FSUTIL VOLUME DISKFREE C: to return the partition size and freespace of C: in bytes. Fsutil and Command-line reference info is available here.. Good LUCK. |
|
| 4940. |
Solve : Replace integrity of many files with one? |
|
Answer» Good morning, I have a very daunting task before me that I really could use some help with. I have 652 files named in an increasing sequence “startofthefilename000_000” the 000_000 change. My problem is I need to take one file and replace the integrity of the 652; while keeping their naming convention of course. (Query: unique to that folder, or the same for all 652 files?) Unique to that folder.So you might have a folder called small and a file called small_new (in that folder?) and you WISH to MAKE all the other files identical to that? That would be perfect!You did not answer whether you wish to destroy or preserve the previously existing files. I apologize, I would wish that they are destroyed. Suppose you call this file MakeAllSameAs.bat and place it in a folder containing the files to be altered and the file to be copied to each open a command window in that folder and type its name followed by the name of the file to be copied e.g. MakeAllSameAs "small_new" Code: [Select]@echo off set repfile=%~1 echo Replacement file: %repfile% for /f "delims=" %%F in (' dir /b ^| find /v "%repfile%" ^| find /v "MakeAllSameAs.bat" ' ) do ( Echo Replacing %%F del "%%F" copy "%repfile%" "%%F" ) It works, thank you very much. This is very exciting!!!Quote from: Salmon Trout on July 21, 2009, 11:48:59 AM Suppose you call this file MakeAllSameAs.bat and you can use findstr, then you don't need to pipe to find 2 times Code: [Select]for .... ( dir /b .. | findstr /v /c:string1 /c:string2 ) do (... ) |
|
| 4941. |
Solve : Batches file window flashes on and off quickly when run? |
|
Answer» Can anyone tell me why this BATCH file's window flashes on and off quickly when it is run, it is supposed to write a password to the desktop but for some reason it has stopped doing so. |
|
| 4942. |
Solve : Batch file to check the contents in a file? |
|
Answer» I would like to find a particular word in a text file and check if the word is available in the other text file |
|
| 4943. |
Solve : A problem that's too long to explain in this title? |
|
Answer» As the title states, my BATCH problem is too long to simply write in the title. I have tried everything and I can't figure out how to do this. So, here's my problem: As the title states, my batch problem is too long to simply write in the title. I have tried everything and I can't figure out how to do this. So, here's my problem: EH, this is quite complicated, Batch files need specific dirrections and information to perform opperations, Just out of pure currosity and to help with this investigation, what exactly is your batch file destined to do? As in its purpose.after reading your essay, i still don't understand what you are trying to do. Give examples and show your final output.Quote from: BatchFileCommand on August 13, 2009, 10:12:55 PM here's what I would like to do: take a random string like 1_3_5_7_9 and see how many matching numbers the two strings contain. You want to examine each filename and see if it contains one or more of (for example) 1, 3, 5, 7 or 9? something like this need delayed expansion for blah blah blah %%F in ('dir /b') do set filename=%%F for /f "tokens=1-5 delims=_" %%A in ("!filename!") do ( echo !filename! | find "%%A" && echo found %%A echo !filename! | find "%%B" && echo found %%B etc ) ) IF YOU WANT A BETTER DESCRIPTIONG OF WHAT I WANT TO DO SKIP THE FIRST SECTION! I figured out how to do it! 1, set both strings to variables like %1% and %2%. and do the following: %1:~0,2% I would set that to a variable like %n1% which stands for number 1. do the same thing again : set n2=%1:~2,4% then repeat the process for the other 3 numbers and the second string! Then using lots of if commands (MAYBE for loops) I would simply see how many numbers match! _______________________________________ ___________________________________ Okay, so this is what I wanted to do take 2 strings like 1_4_9_2_5 and 5_9_7_5_4 and see how many numbers matched between the two of them. in this case it would be 3. |
|
| 4944. |
Solve : XCOPY question`? |
|
Answer» I've searched for an answer to this but haven't come across it. I apologize in advance if I just missed it. |
|
| 4945. |
Solve : key word search? |
|
Answer» Background information: |
|
| 4946. |
Solve : batch help filename? |
|
Answer» How WOULD I find out the name of the batch file that's running the current command? %1-9 are the parameters paseed to a batch file. More exactly, it is the command line that called it. If this is myname.bat: Code: [Select]@echo off echo %0 If you are in the same folder and you type myname.bat, you will see "myname.bat" echoed to the screen. If you type "myname" it will echo "myname". This behaviour also occurs if you save it to a folder on your PATH and call it by either of these two methods. If you type the WHOLE path e.g. "C:\batch\myname.bat", then that is what %0 will be. If you open the folder in Windows Explorer, and double click on the batch file's ICON, %0 contains the full drive, path, name and extension, surrounded by quotes. To avoid this ambiguity, you can get the name, extension, path and drive by using the %~d0, %~dp0, %~nx0 etc variable modifers DESCRIBED in the FOR documentation. For example the drive LETTER, path, name and extension is %~dpnx0 |
|
| 4947. |
Solve : How to realize the dos raw input? |
|
Answer» In fact, I have a .EXE file which want to be executed by dos COMMAND, and I need to input the directory which "" should be included , just like Path = "C:\test\simple.dll", but after the .exe file executed, the result is only Path = C:\test\simple.dll, so do you know how to realize the raw input which won't filter my """. Dir D:\TestOHHH! Now it makes sense. Put the command in quotes (and the command's path) and put the path to SOMETHING else in different quotes. For example: "C:\folder name\prog.exe" "D:\other folder\" Understand?Hi, thanks for help!! I am not quite understand what you mean...here are more details: first I input :the "Selected DLL="D:\testsimu0158.dll"" is the input PARAMETER of line_replace.py D:> python line_replace.py "Selected DLL="D:\testsimu0158.dll"" The output is: Selected DLL=D:\testsimu0158.dll but I need : Selected DLL="D:\testsimu0158.dll" Any ideas ? Thank you very much! Quote from: Helpmeh on August 13, 2009, 05:28:46 AM OHHH! Now it makes sense. Put the command in quotes (and the command's path) and put the path to something else in different quotes. For example:Hi, I get it! If I input : D:> python line_replace.py "Selected DLL=""D:\testsimu0158.dll""" then it WORKS: I will get : Selected DLL="D:\testsimu0158.dll" Also thank you for you help!! Quote from: Helpmeh on August 13, 2009, 05:28:46 AM OHHH! Now it makes sense. Put the command in quotes (and the command's path) and put the path to something else in different quotes. For example: |
|
| 4948. |
Solve : Directory Listing? |
|
Answer» Hi Im looking to create a txt file which contains a list of all FILES located in a folder directory. |
|
| 4949. |
Solve : I'm back! With a huge project....? |
|
Answer» Sorry for the double POST, but I have a project update. Okay, I have the base of the program. There's one problem, I can't seem to find a way to cycle through the files. I've tried USING a for /l loop. But even with setlocal enabledelayedexpansion and all the VARIABLES SET in the foor loop are surrouned with !'s and all that other crap. But it just seems like the for /f loop won't function in the for /l loop. |
|
| 4950. |
Solve : error code? |
|
Answer» what is ERROR CODE ?error code 5??List of MS-DOS & COMMAND Prompt Error Codes |
|