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.
| 5351. |
Solve : No Feedback?? |
|
Answer» No feedback? |
|
| 5352. |
Solve : variables in FOR command? |
|
Answer» When using the for command in a batch, Look at the help for FOR Excellent answer. Technically, ~n gets the name, ~x gets the extension (which includes the dot). In the filename "Datalist.txt", Datalist is the name, and .txt is the extension. Hi Thanks very much for your quick reply. I now have this: for /r %%g in (*.*) do ( echo %pass%|gpg --batch -q --passphrase-fd 0 -o "D:\gpgD\%%~pnxg" --decrypt "%%g" ) I want to recreate the file structure (using %%~pnxg) but in an existing directory D:\gpgD This seems to work except for the fact it tries to write to the directory with double forward slashes e.g. D:\\gpgD\\dir1\\file.gpg Argh! Thank you for your patience Quote from: impaled on January 05, 2010, 08:25:22 AM
... and this is a problem? Sorry, you're right. \\ doesn't matter Misdiagnosed the problem --- GPG won't output to a directory that doesn't yet exist (it won't create them itself, for some reason.) I have solved it like this: output them in the current dir without the .gpg extensions, then robocopy out EXCLUDING .gpg extensions.... for /r %%g in (*.*) do ( echo %pass%|gpg --batch -q --passphrase-fd 0 -o "D:\gpgD\%%~dpng" --decrypt "%%g" ) Thanks all for your help.Quote "D:\gpgD\%%~dpng" That's going to give you a very strange looking path... More mistakes, on a roll today. -o "%%~dpng" Thanks! |
|
| 5353. |
Solve : How to get the control panel in the right click menu of the desktop...? |
|
Answer» I want to get the control panel in the right click menu of the DESKTOP and does not KNOW the same and hence wants the help with the same....You can create a shortcut to Control Panel (its called control.exe) but i'm not sure about the Right-Click Context menu.Quote from: Shersingh12 on November 17, 2008, 10:27:14 AM I want to get the control panel in the right click menu of the desktop and does not know the same and hence wants the help with the same....Quote from: Shersingh12 on JANUARY 05, 2010, 02:55:30 PM Carbon requested a re-explanation of your post, not a repeat of it. No he didn't. I'm FAIRLY certain CD understood the question but wasn't sure how to answer it. See if this helps: http://www.tech-recipes.com/rx/1176/how-to-add-menu-items-under-right-click-or-context-menu/ |
|
| 5354. |
Solve : Log into website?? |
|
Answer» Hello fellow nerds |
|
| 5355. |
Solve : super HEX Problem? |
|
Answer» Is ther any way 2 find a file's SIZE and Its OFFSET in Archive Through command line |
|
| 5356. |
Solve : wav injector = reopened? |
|
Answer» i m tryin 2 inject files in 1 data file i m tryin 2 inject files in 1 data file are you unable to change base yourself? Also, this program doesn't seem very "powerful" if it's unable to determine a files size on it's own.Hey BC can u Pls HELP me ?? i just want a software 2 show a file's offset and size in hexwhy don't you ask in a cdda game forum? |
|
| 5357. |
Solve : Bios Information and hard disk information batch file? |
|
Answer» Hi Guys And what commands would you use to retrieve BIOS data Bill ? ? http://en.kioskea.net/faq/sujet-330-bios-commands To select an option Press the ENTER key To change values Use the number keys Use the -/+ keys to modify numerical values Use the letter keys to enter the commands DEL/BACKSPACE keys to delete values Y for YES and N for NO to answer questions To QUIT BIOS ESC key to quit BIOS. CTRL+ALT+DEL to promptly restart the systemThose are the basic commands for moving around/making changes in the BIOS... Again i'll ask you what commands would you use to retrieve BIOS data Bill ? ?Quote from: patio on January 08, 2010, 11:31:55 PM Those are the basic commands for moving around/making changes in the BIOS... Patio, Please provide the information you seek or start a new thread. We have heard nothing from Madmidgy, the original poster. I'll not start a new thread...i asked you a question...@OP, you can retrieve BIOS information using vbscript, as usual Code: [Select]strComputer = "." set objwmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set BIOS = objwmi.ExecQuery("Select * from Win32_BIOS") For each objBIOS in BIOS Wscript.Echo "Build Number: " & objBIOS.BuildNumber Wscript.Echo "Current Language: " & objBIOS.CurrentLanguage Wscript.Echo "Installable Languages: " & objBIOS.InstallableLanguages Wscript.Echo "Manufacturer: " & objBIOS.Manufacturer Wscript.Echo "Name: " & objBIOS.Name Wscript.Echo "Primary BIOS: " & objBIOS.PrimaryBIOS Wscript.Echo "Release Date: " & objBIOS.ReleaseDate Wscript.Echo "Serial Number: " & objBIOS.SerialNumber Wscript.Echo "SMBIOS Version: " & objBIOS.SMBIOSBIOSVersion Wscript.Echo "SMBIOS Major Version: " & objBIOS.SMBIOSMajorVersion Wscript.Echo "SMBIOS Minor Version: " & objBIOS.SMBIOSMinorVersion Wscript.Echo "SMBIOS Present: " & objBIOS.SMBIOSPresent Wscript.Echo "Status: " & objBIOS.Status Wscript.Echo "Version: " & objBIOS.Version Next save as getbios.vbs and on command line Code: [Select]c:\test> cscript //nologo getbios.vbs to get operating system information, you can use Win32_OperatingSystem. That will not retrieve the BIOS settings...just the base info...but nice try GD.Quote from: patio on January 08, 2010, 11:08:48 PM And what commands would you use to retrieve BIOS data? I don't know the answer. I don't understand the question. I don't use or understand the BIOS. I have never used or adjusted the BIOS settings. I don't have a clue of the information that is needed. I will leave all discussions of BIOS setting to the experts. I will have the local computer shop retrieve the BIOS data if needed. I have used COMPUTERS since 1968 and have never had a need for the BIOS data. I'm sorry I cannot help. Tell me which posts are misleading and I will erase those posts. Thanks for your ACCURATE information. |
|
| 5358. |
Solve : Taskmager is disabled by your Administartor? |
|
Answer» Quote from: Helpmeh on January 09, 2010, 09:21:41 AM So how do they get it to show in Windows Media PLAYER? Make a fake one that is the exact same as my colourized version? It's almost always a little GIF or short animation, that links directly to the "codec" after showing an alert. If WMP actually loads a video and asks for a codec, then it's a legit video. Personally, I have yet to encounter any video that I don't have a codec for. K-Lite is PRETTY thorough.It asks for a special codec, then the installer runs. It was in WMP. WIERD. |
|
| 5359. |
Solve : How can I detect if a batch file is started as admin?? |
|
Answer» How can I detect if a batch file is started as administrator? You could check your event log. No I mean check admin from within the batch file. ..Code: [Select] if "%username%"=="Administrator" ( echo User is Administrator ) else ( echo User is not Administrator ) Quote from: SALMON Trout on January 09, 2010, 02:38:02 PM Code: [Select]Quote from: Helpmeh That ony applies to the Administrator account. I assume the OP wants to make sure the user has RUN the batch as an administrator. Although I have 0 experence in this, I use XP. In that case, Vista & 7 have the whoami command. Type whoami /? at the prompt for full information. Quote from: Salmon Trout on January 09, 2010, 05:54:54 PM In that case, Vista & 7 have the whoami command. Type whoami /? at the prompt for full information.Well isn't that neat. Can you post it? I don't have vista or 7 so I can't SEE for myself. Quote from: Helpmeh on January 09, 2010, 06:00:00 PM Well isn't that neat. Can you post it? I don't have vista or 7 so I can't see for myself.I don't know if this is what you are looking for, Google works great though Quote from: Quantos on January 09, 2010, 06:03:51 PM I don't know if this is what you are looking for, Google works great thoughSpot on quantos! |
|
| 5360. |
Solve : error message: Bad command or file name? |
|
Answer» The OP is definetely claiming that you are using more than one profile. The OP is definetely claiming that you are using more than one profile. Hmmm. I have been thinking about my reply just now; I think it would have been more accurate for me to STATE that I once was called "Dias de Verano" on here, then I went away, eventually I came back some months later and chose the name "Salmon Trout" (A British steam locomotive of the 1920s) but I have never had more than 1 account active at any one time. I cannot see the point of it; to use them both in the same thread would be like talking to yourself compared to a genuine conversation, or like *censored* compared to, er... (Well you get my drift) Only a crazy person would do such a thing. I believe I have made myself as clear as is necessary? On the other hand it COULD be fun... [newboid1999] How can I get a list of all folders that start with the letter A? [Salmon Trout] Why, newboid, just put this in your batch FILE! dir /s /ad B* [newboid1999] Gee, thanks, Salmon! It works like a dream! [Salmon Trout] Think nothing of it old fellow. [newboid1999] Salmon, you're a GENIUS! [Salmon Trout] Calm down! People will get suspicious. [newboid1999] Oh. Er, right. Quote from: Salmon Trout on January 10, 2010, 02:54:38 AM ... Only a crazy person would do such a thing.... On that note, maybe you would. *ducks*Quote from: Quantos on January 10, 2010, 08:32:32 AM On that note, maybe you would. What physicist was it who told a student, "Your theory is crazy, but not crazy enough to be true" ? Quote from: Salmon Trout on January 10, 2010, 08:38:53 AM What physicist was it who told a student, "Your theory is crazy, but not crazy enough to be true" ?That would be Niels Bohr.Ah, the AMBIGUITY. Can one be sure of anything? |
|
| 5361. |
Solve : Rename/replace? |
|
Answer» Quote from: Geek-9pm on January 10, 2010, 08:49:37 PM Doing DIR /? gives the list of options. The result is still the same. I get the same error message. Sorry that did not help. I am just shooting in the dark. That is why I am the Geek after dark. You need the /s to get all sub directories. -Right? Well, just move the DIR thing out of the for loop. I have been following this third, but get lost in the stuff. Do you really need recursion? Can you just use iteration? Maybe I missed something. Could you just do DIR *.JPG /B/S >big-list.txt Then have the for loop precess each line in big-list.txt That way the for loop does not have to do recursion. I guess. I am not keen on using the recursion at all. I am just looking for a way to rename my files in many directories over many backup disks. In the process of renaming I need to remove/replace some strung from the file name. I don't need a full blown rbust solution. Just a way to reduce the manula work. The script works for a single directory and it renames the files correctly. Here is an idea a threw EARLIER today. I am reposting for easy reference. ==================================================== Since the basic code works for a directory I think the following idea might work. but I don't have the knowledge base to do the programming in shell. 1. Parameterize the basic code, ie. pass the directory path to this script. 2. Make another script to scan through the subdirectories RECURSIVELY and when a it finds a directory call the first batch file (from POINT #1) with the directory as parameter. This code seems to rename files recursively. May be the gurus can tweak it to make it work with the above routine. For /r %%x in (*.jpg) do ren "%%x" *.jpeg Notice the /r switch in the FOR clause for scanning the directories recursively. =============================================================== Thanks, myshutterclicks Quote from: Geek-9pm on January 10, 2010, 09:13:08 PM Sorry that did not help.Nobody gets any points for astuteness, perspicacity or just plain gumption here! None of you noticed that the OP posted the same number of error messages as there were files. Therefore, the problem was occurring in the loop, not in the FOR line which set it up. Also, nobody bothered (come on guys!) to type rename /? at the prompt and read the help, whereupon it would have become clear where the problem lies. Namely in the incorrect syntax being used with the ren / rename command. The syntax is Code: [Select]RENAME [drive:][path]filename1 filename2 The code was doing this Code: [Select]RENAME [drive:][path]filename1 [drive:][path]filename2 To give a concrete example This is wrong Code: [Select]Rename "C:\My Documents\My Pictures\My Meals\Cheeseburger105.jpg" "C:\My Documents\My Pictures\My Meals\Hamburger105.jpg" This is right Code: [Select]Rename "C:\My Documents\My Pictures\My Meals\Cheeseburger105.jpg" "Hamburger105.jpg" When you have to specify the full path of a file to rename, e.g. because it is not in the current directory, supply it once, before the present (old) filename and then supply just the new name (no path). It actually says this in the rename /? help Code: [Select]Note that you cannot specify a new drive or path for your destination file. Dir /s /b always produces a full path for each file, so you need to get at the drive, path, name and extension information using the FOR variable modifiers which you can read about in the FOR /? documentation Here is some commented code which (I hope) will make all this clear... Code: [Select] @echo off REM You need this because you are setting variables (and reading them) REM inside a parenthetical structure (a loop in this case) setlocal enabledelayedexpansion REM The /f switch tells FOR to treat the output of the command REM as a series of text lines to be processed REM I have changed the variable to upper case to make REM the variable modification clearer for /f "delims=" %%A in ('dir /s /b *_MG_*.JPG') do ( REM If %%A is a file path and name (or just a filename) REM %%~dpA is its drive and path... set filepath=%%~dpA REM ... and %%~nxA is its name and extension REM Thus we have removed the drive and path... set filenameold=%%~nxA REM Modify just the name without path REM to get the new name set filenamenew=!filenameold:_MG_=! REM Give the Rename command the full path & old name REM for the file to be renamed, and just the new name rename "!filepath!!filenameold!" "!filenamenew!" ) Since we have now got up to 7 pages, I feel justified in having a moan about how standards are slipping here on CH. Somebody posts a question, somebody else (who shall be nameless) posts a partial solution, the OP tries it out, it doesn't work, and then a whole bunch of people just post guesses. Nobody read the command documentation; nobody tried specimen code. Quote from: Salmon Trout on January 11, 2010, 01:26:10 AM
Hi Salmon, I just tried your code and it works like a charm. I cannot thank you enough for this. It's definitely going to save a lot of time for me. Your attention to the details and understanding of the problem are great and I am sure you enjoy a healthy dose of success and satisfaction in your daily LIFE. I wish you great success as well. I am a photographer and I know a bit about it. Do not hesitate to get in touch with me if you need any tips about photography. Great forums. Keep up the good work. Lifespan of one's residue is mostly determined by what one does for common good throughout one's lifetime. Best regards, http://www.kankooz.com |
|
| 5362. |
Solve : using a batch file to read a directory to start/stop programs within that dir? |
|
Answer» how do I do this? |
|
| 5363. |
Solve : Start a batch file as a different user?? |
|
Answer» Now normally I am usually fine with this sort of thing...but I'm hitting wall here and I need help. I am trying to run one batch file from another batch file, but the batch file being ran from the other needs to be run from a different user on the network. So here is the pseudo-code. How many users?Same file needs to be accessed by ALL users. The content changes quite often. Quote Same file needs to be accessed by ALL users. Fine. Yes you can find a way to do that. Is this an academic CHALLENGE? Or is this a real-world issue that needs a PIRATICAL solution? These question are posed here because Academic challenges too often focus on a narrow area whee the students are pushed into an answer the teacher wants. But the Piratical answers are found by thinking "outside the box", metaphorically speaking.This is not an adademic challenge. It would be more "piratical" so-to-speak. What I am attempting to do is in a way, use the Z drive as a server. |
|
| 5364. |
Solve : Auto pass credentials in AT command? |
|
Answer» Dear Experts, |
|
| 5365. |
Solve : Renaming Specific Part Of File? |
|
Answer» Hi Every 1 |
|
| 5366. |
Solve : How I can make batch file that will save list of my folders to txt file? |
|
Answer» How I can make BATCH file that will save list of my folders to txt file wow, so fast!!! thanks a lot!After the /AD in the dir command, add your desired path. Bill's just goes through all the folders of the systemdrive. Quote from: alechko on January 08, 2010, 11:59:30 AM Now I need some explanation... you must cd to: C:\WINDOWS\system The following is not a batch but the information is directly from the command line rem wc -l counts the number of directories. I use XP pro and rem C:\WINDOWS\system has no sub directories on my machine C:\WINDOWS\system>dir /B /AD | wc -l 0 C:\WINDOWS\system>cd .. C:\WINDOWS>dir /B /AD | wc -l 120 C:\WINDOWS>dir /s /B /AD | wc -l 1879 C:\WINDOWS> p.s. You may run the above without : " | wc -l"please make batch file for me, I don't understand how this work... I need list of all folders in specific directory. please explain how I can change directory too. thanks!Quote from: alechko on January 11, 2010, 03:01:26 AM please make batch file for me, I don't understand how this work...Use the code in reply #1 and read what I said in reply #3. hi, I make batch file from first reply it's work only in root, i trying to run in in other directory but not successfully... I need batch file where I can set path to directory that I need... I dont' understand your second reply.Quote from: alechko on January 08, 2010, 07:42:44 AM How I can make batch file that will save list of my folders to txt filetry this syntax: short and simple and i'll also add my comments for help.. DIR ; creates a list of files in a folder c: ; identifies the files to be listed in this instance it will list all folders in your c:drive you can ammend it by drawing file as well ie. *.doc /s ; indicates that the search should include all subdirectories /b ; indicates the list should be bare , only including the filename and LOCATION > ; directs the output to a file c:\list.txt ; creates a file with this name and places the output of the dir command into it. **this is run from the dos prompt if you go to start run and type cmd in the text box you'll get there. Type the complete syntax on one line with the directory that you are wanting to create your list from. example: DIR c: /s /b > c:\list.txtQuote from: alechko on January 11, 2010, 04:50:39 AM hi, I make batch file from first reply it's work only in root, i trying to run in in other directory but not successfully...see my post below and you can change it to any directory that you want. for example p: C:\>type listdir.bat Code: [Select]@ echo off cd c:\windows\system dir /B /AD | wc -l echo no sub directories under "c:\windows\system" cd c:\windows\ dir /B /AD | wc -l dir /B /AD > direc_txt.txt rem dir /s /B /AD > direc_txt.txt type direc_txt.txt Output: C:\>listdir.bat 0 no sub directories under "c:\windows\system" $ $NtUninstallKB960803$ . . . addins AppPatch assembly CAVTemp Config Connection Wizard Corel Cursors Debug Downloaded Installations Downloaded Program Files Driver Cache ehome Fonts Help HPSETUP ie8 ie8updates ime inf Installer java L2Schemas Media Microsoft.NET msagent msapps msdownld.tmp mui Network Diagnostic Offline Web Pages pchealth PeerNet Performance PIF Prefetch Provisioning pss Registration repair Resources security setup.pss ShellNew SoftwareDistribution srchasst Sun system system32 Tasks Temp twain_32 WBEM Web WinSxS C:\WINDOWS>dir DIRECTORY_OF_FOLDER\*.* /b >list.txt for ex dir E:\Test\Test001\*.* /b >List.txt Text file will b saved FRM wer batch file was ranQuote from: the_mad_joker on January 12, 2010, 08:09:54 AM
"Text file will be saved from where batch file was run." With the exception: When there is a cd command to a new directory at the beginning of batch. |
|
| 5367. |
Solve : DOS 6.22 etc? |
|
Answer» Please, the code to enabling LPT1 printing device. AUTOEXEC.BAT? Please, the code for enabling LPT1 printing device. http://geekswithblogs.net/dtotzke/articles/26204.aspx ( All the following information from the above link. I have not used or tested the information.) Good luck "In order to print from DOS in an offline environment, you will need to do a couple of things." 1) Install the Microsoft Loopback Adapter a) In Control Panel, double click on Add Hardware. b) Click Next c) When the scan finishes, select "Yes, I have already connected the hardware" d) Click Next e) Scroll to the bottom of the list and select "Add a NEW hardware device" Click Next f) Select "Install the hardware that I manually select from a list (Advanced)" g) Click Next h) Select "Network Adapters" i) Click Next j) Select "Microsoft" under the Manufacturer list. k) Select "Microsoft Loopback Adapter" in the Network Adapter list. l) Click Next m) Click Next n) Click Finish 2) Configure the Adapter a) The loopback adapter is a virtual network adapter and can be configured the same as a regular network card. b) Set the adapter to have a static IP address such as 192.168.1.1/ 255.255.255.0 3) Share the printer. a) I recommend you use a share name that you will remember. I used “Printer” in the new machines that are already deployed. 4) Capture the printer port. a) NET USE LPT1: \\[Computer Name]\Printer /PERSISTENT:YES Now, not that I like to encourage this type of behaviour, but if you have done the above and still can't get it to print, you may find some help through one of the articles located here: http://support.microsoft.com/search/default.aspx?mode=a&query=kbhowto+kbprint+dos&spid=global&catalog=LCID%3D1033&1033comm=1&res=20 Get Help Now Contact a MS support professional by E-mail, Online, or Phone http://support.microsoft.com/common/international.aspx?RDPATH=dm;en-us;select&target=assistance |
|
| 5368. |
Solve : Can this be done?? |
|
Answer» I have to move a file (I'll call it file.txt) from one folder to another on approximately 500 PCs. I'm wondering if a batch file can be written that could be run on each PC by the user rather than me have to do each one manually. three folders on each PC contain a file.txt and each one is a different size Adjust the paths/filenames to suit - not tested, no allowance made for paths/filenames containing spaces. Hope it helps.It will just crash. One thing I noticed in the for loop, %%1? It needs to be a letter (uppercase and lowercase are different). And what's with @echo off>%temp%\dirfill.txt? It's unnessasary. That file gets created in the dir command anyway. Quote from: Helpmeh on January 11, 2010, 04:40:06 AM One thing I noticed in the for loop, %%1? It needs to be a letter It is an undocumented fact that you can use %%0 to %%9 and some other characters too; (? # $ _ for example) although the FOR documentation says a-z and A-Z and says you can only have 52 variables existing at once. Code: [Select]for /f "tokens=1-3 delims= " %%0 in ("cat DOG horse") do @echo %%0 %%1 %%2 Code: [Select]cat dog horse Quote from: T.C. on January 11, 2010, 04:01:11 AM Adjust the paths/filenames to suit - not tested, no allowance made for paths/filenames containing spaces. Hope it helps. That works just like i need it too but when i try to change the path from c:\profiles to the actual path where the file RESIDES I'm having trouble. the filename is actually user.aco (not file.txt as i said earlier) and it exists in these folders: C:\Documents and Settings\All Users\Application Data\myco\MQ1\Cache\User Profiles\92606\7354904 C:\Documents and Settings\All Users\Application Data\myco\MQ1\Cache\User Profiles\92689\8459875 C:\Documents and Settings\All Users\Application Data\myco\MQ1\Cache\User Profiles\123456\6546544 The last 2 numeric folders are going to be diferent on each PC and the largest user.aco needs to be copied to c:\program files\myco Thanks for the help so far. Could you help me get the rest of the way? Quote from: T.C. on January 11, 2010, 04:01:11 AM Adjust the paths/filenames to suit - not tested, no allowance made for paths/filenames containing spaces. Hope it helps.is there a way to make allowance for path containing spaces? Forgive me for being so dumb. DOS is definitely not my strong suit but it would be a huge help if I could get this worked out.Quote from: aschrier on January 11, 2010, 08:08:46 PM is there a way to make allowance for path containing spaces? Quote marks "C:\Path with\some spaces\" Quote from: helpmeh It will just crash. One thing I noticed in the for loop, %%1? It needs to be a letter (uppercase and lowercase are different). And what's with @echo off>%temp%\dirfill.txt? It's unnessasary. That file gets created in the dir command anyway. FYI Although it's undocumented, in a For loop the variable can be any printable ASCII/Extended ASCII code in the range dec 33 thru dec 254. In a testing environment it is wise to ensure that any file created using redirection >> is deleted, otherwise, if the script is run more than once, data will be appended rather than the file being created with new data. @echo off>%temp%\dirfill.txt is just one way of overwriting the existing file with a zero length file. One could also use If Exist Filename Del Filename, or simply Del Filename when that file is no longer required, or any other method of removing the file. According to the OP Quote from: aschrier That works just like i need it toothe script did not "just crash" but appears to have been helpful. aschrier - Salmon Trout has already advised on paths/filenames containing spaces. Again - Good Luck. Quote from: T.C. on January 12, 2010, 12:43:26 AM FYI Although it's undocumented, in a For loop the variable can be any printable ASCII/Extended ASCII code in the range dec 33 thru dec 254. These are the ONES you can't use 34 37 38 44 59 60 61 62 124 Method Code: [Select] Set fso = CreateObject("Scripting.FileSystemObject") Set Shell = CreateObject("Wscript.Shell") For c = 33 To 255 WriteFileName="test" & CStr(c) & ".BAT" Set TextFile = fso.OpenTextFile (WriteFileName, 8,True) Textfile.WriteLine("@for /f " & Chr(34) &"delims= " & chr(34) & " %%" & Chr(c) & " in (" & chr(34) & "cat Dog horse" & chr(34) & ")" & " Do @Echo %1 %%" & Chr(c) & ">> report.txt") Textfile.Close Shellstring="%comspec% /c " & WriteFileName & " " & CStr(c) Shell.run ShellString,2,1 Next Set fso = Nothing Set Shell = Nothing Quote from: S T These are the ones you can't use Did you try Escaping the chars? Code: [Select]@echo off setlocal cls echo character_used>%temp%\trial.txt for /f %%^" in (%temp%\trial.txt) do ( echo %%^" (double quote^) is chr dec 34) del %temp%\trial.txt Quote from: T.C. on January 12, 2010, 02:10:15 PM Did you try Escaping the chars? Escaping brings the ones that don't work down to these: 37 ( % ) 38 ( & ) 44 ( , ) 59 ( ; ) 61 ( = ) |
|
| 5369. |
Solve : Impressionable Variables and Game Making With Batch.? |
|
Answer» Hello. this is my first POST, and I came here to try to learn how to make impressionable variables (like a characters hp and MP, or stats), and any other batch game MAKING tips. Please help.Well, learn the SET command (set /?), and learn to use |
|
| 5370. |
Solve : Calling up another batch file? |
|
Answer» How do I created a batch file that calls up another batch file if I type a name in the first batch file?Quote from: henksey on January 12, 2010, 08:40:03 AM How do I create a batch file that calls up another batch file if I type a name in the first batch file? C:\batch>type twobatch.bat Code: [Select]@echo off call batch_1.bat echo return to main after batch one call batch_2.bat echo return to main after batch two pauseC:\batch>type batch_1.bat Code: [Select]echo DATABASE backup rem rman target user/pwd @<path_to_file_to_run> log <path_to_log_file> exit /b C:\batch>type batch_2.bat Code: [Select]echo CommVault backup REM qlogin -cs "server_name" -u "user" -p "pwd" exit /bOUTput: C:\batch> twobatch.bat Database backup return to main after batch one CommVault backup return to main after batch two Press any key to continue . . . C:\batch>I have a distinct feeling that's not what he meant by 'type', Bill... Thanks Bill. I really appreciate your reply. is there a more simple way of creating this type of batch. I am very very NEW at this, and i'm not understanding all your commandsI was talking about typing in the echo screen that comes up a name of another batch file to call it up. Something that says; " Type in name, then click on any key" once I do that then another specfic batch would open.You want set /p for that hello I mis-stated my 1st question. So i'll restate it; How do I created a batch file that calls up another batch file, by typing the name in the 2nd batch file and then clicking on a key to bring it up? Trout, could you give me an example? Thanks@echo off set /p batchname=Batch name: call "%batchname%" Quote from: henksey on January 12, 2010, 09:33:58 AM Could you give me an example? C:\batch>type st.bat Code: [Select]@echo off echo Enter name of batch file. set /p x= call %x% echo return to main after batch one echo Enter name of batch file. set /p y= call %y% echo return to main after batch two pause Output: C:\batch>st.bat Enter name of batch file. batch_1.bat Database backup return to main after batch one Enter name of batch file. batch_2.bat CommVault backup return to main after batch two Press any key to continue . . . C:\batch>Thanks S.T., I think this will workC:\batch>call /? Calls one batch program from another. CALL [drive:][path]filename [batch-parameters] batch-parameters Specifies any command-line information required by the batch program. _________________________________ Keep in mind that the subBatch must contain the exit /b command for control to return to the main Batch. For example: echo in CommVault backup REM qlogin -cs "server_name" -u "user" -p "pwd" exit /bQuote from: BillRichardson on January 12, 2010, 10:05:50 AM
Not exactly. When a CALLED batch terminates naturally (i.e. reaches the last line of code), control is passed back to the CALLING batch, which proceeds to the line FOLLOWING the call command. There is no need for the last line to be exit /b. However the exit command with the /b switch is useful for situations where you need to exit before the end of the batch is reached. The /b switch prevents a complete exit from cmd.exe. Quote from: Salmon Trout on January 12, 2010, 01:12:03 PM Not exactly. When a called batch terminates naturally (i.e. reaches the last line of code), control is passed back to the calling batch, which proceeds to the line following the call command. There is no need for the last line to be exit /b. However the exit command with the /b switch is useful for situations where you need to exit before the end of the batch is reached. The /b switch prevents a complete exit from cmd.exe.Yeah or use GOTO EOF commands :EOF |
|
| 5371. |
Solve : Determine Day of Week? |
|
Answer» Quote from: nothlit on January 07, 2010, 02:10:09 PM Such LOVE, thanks for all the information and the replies. Wait! There's more! Don't you want the list of links with batch files the go on and on?Calculating the day of the week Here's wikipedia's algorithm, seem to work and I think you can use it in any common language (C, C++, etc), you just need the right syntax corresponding to the language you want to get the program to do the math.Quote from: Geek-9pm on January 06, 2010, 09:48:54 PM I was just JOKING about the new moon you can't call DOS INTERRUPTS from NT's command line, and you can't parse strings in standard DOS batch files.Quote from: Geek-9pm on January 07, 2010, 04:06:39 PM
I enjoy free information and tools so if there is more by all means please share. |
|
| 5372. |
Solve : .? |
|
Answer» Quote from: pchelp on JANUARY 13, 2010, 06:48:00 PM so i want to KNOW how to PROGRAM but sometimes......when people say things can be used for malicious intent, and there is no LEGITIMATE REASON to learn how to make critical errors, maybe you should heed their advice and stop repeating the same thing over and over. Just because you "love to program" doesn't mean we're going to teach you how to prank your buddy. I suggest you read up on the forum rules (which by registering, you agreed to follow) before posting again.Ask BC programmer in a nice way and he will show you how to make a box come up on the screen from the command line. You CREATE the program musing another programming tool. The the batch file will invoke the new program you make. Hate to quote myself too: Quote From the few posts made by pchelp I get that nagging gut-feeling that we have another wouldbe writer of malicious scripts among us. Individually each post seems a genuine quest for info but put together... Just a feelingfrom here.. |
|
| 5373. |
Solve : Installing DOS on Sata drives? |
|
Answer» I have a Dos 7 install CD. |
|
| 5374. |
Solve : Mistaking In Batch? |
|
Answer» Hi Every 1 And Specially I wanna know After inserting Yes or no How 2 delete all Files in same folder If you're going to delete files whether the answer is yes or no, why bother asking? >:(Hey SideWinder You Dont Know Something about Ur-Self U R THE BEST!!!!! Thanks For The Help! I Wish You A Long Life Thanx For The Help Topic Closed Quote from: Sidewinder on January 29, 2010, 06:22:35 AM
Or in other threads "COMPUTER Experts" check to see if a certain file exists? If the file does not exist, the the OS will report that! Why check? If we try to create a file and it already exists, the OS will not allow it. So why go through the above procedure? A waste of time.Quote from: BillRichardson on January 29, 2010, 09:39:21 AM Or in other threads "Computer Experts" check to see if a certain file exists? If the file does not exist, the the OS will report that! Why check? If we try to create a file and it already exists, the OS will not allow it. So why go through the above procedure? A waste of time. checking to see if a file exists is a good idea if you plan to read from the file. If the file exists, you read the values from it; otherwise, you use the default values. If you don't check and INSTEAD blindly try and read, the values will not have the intended default values. Or, in the case of an actual windows program, you'll crash when you try to use a file handle that doesn't exist (createfile will return -1 and getlastError() will be 2) and unless you check the handle (which is basically checking if the file exists, which as you've said we shouldn't be doing) then you'll try to read or write to a file handle of -1, which is not valid.Quote from: BillRichardson on January 29, 2010, 09:39:21 AM Or in other threads "Computer Experts" check to see if a certain file exists? If the file does not exist, the the OS will report that! Why check? If we try to create a file and it already exists, the OS will not allow it. So why go through the above procedure? A waste of time. Please explain more. The OP is deleting files, not creating them and is using a wildcard. The OP simply WANTS to empty a directory. Quote from: the_mad_joker on January 29, 2010, 01:43:59 AM And Specially I wanna know After inserting Yes or no How 2 delete all Files in same folder Quote from: Sidewinder on January 29, 2010, 06:22:35 AM If you're going to delete files whether the answer is yes or no, why bother asking? The question remains. If the logic is to delete the files no matter what the response to the prompt is, why bother with the prompt at all? PS. This is how threads turn into 5 page marathons that have nothing to do with anything.. The OP never mentioned creating files or reading from files. I have a headache... |
|
| 5375. |
Solve : batch file to start then stop a program? |
|
Answer» Hi, I did look up tskill, i cant get that too close my program down though,Try this: Run tasklist (from the command prompt). Locate your program. That (minus the .exe) is what you add after the TSKILL in your batch file. If you don't have tasklist, check you've typed the proper process name. What is the exact error you get when you run Tasklist [processname]?No error, but program is not stopping after i run the batch file. the batch file starts both programs fine but tskill is not being recognized and doesnt stop the first program. Quote from: mrphil on January 28, 2010, 04:09:53 PM Then I would like to kill "file 1" after "file 2" has fully loaded but not sure how to. C:\batch>type mrphil.bat Rem Usage: mrphil.bat title ( program name ) Code: [Select]@echo off echo hello > c:\batch\file1.txt echo hello > c:\batch\file2.txt start %1 c:\batch\file1.txt > nul echo start file2 start %1 c:\batch\file2.txt tasklist | findstr "%1" > killpid.txt for /f "tokens=1,2 delims= " %%i in (killpid.txt) do ( echo pid=%%j taskkill /pid %%j exit /b ) Output: C:\batch>mrphil.bat notepad C:\batch>Rem Usage: mrphil.bat title ( program name ) start file2 pid=496 SUCCESS: Sent termination signal to the process with PID 496. C:\batch>Bill, nul =/= null. Quote from: Helpmeh on January 28, 2010, 05:46:58 PM Bill, nul =/= null. How does that change post#7 ? Yes, you are right I created a file called null. I meant to send to nul. It did not change the output. ____________________________________ It might be of interest that the "exit /b" is necessary INSIDE the for loop. There are two processes with the same name and we need to kill only the first process. QED p.s. Major assumption: When the same program is listed twice with Tasklist, we assume the first process is listed first. |
|
| 5376. |
Solve : Configuring ADSL modem from command prompt? |
|
Answer» Dear ipconfig masters , I want to configure my wire LAN connected ADSL modem from command prompt to access internet via wire connected broadband . I have to configure the IP address , gateway , DNS , enable DHCP . How can it be done from command prompt, please ? I have to configure the IP address , gateway , DNS , enable DHCP . C:\>ipconfig /? USAGE: ipconfig [/? | /all | /renew [adapter] | /release [adapter] | /flushdns | /displaydns | /registerdns | /showclassid adapter | /setclassid adapter [classid] ] where adapter Connection name (wildcard characters * and ? allowed, see examples) Options: /? Display this help message /all Display full configuration information. /release Release the IP address for the specified adapter. /renew Renew the IP address for the specified adapter. /flushdns Purges the DNS Resolver cache. /registerdns Refreshes all DHCP leases and re-registers DNS NAMES /displaydns Display the contents of the DNS Resolver Cache. /showclassid Displays all the dhcp class IDs allowed for adapter. /setclassid Modifies the dhcp class id. The default is to display only the IP address, subnet mask and default gateway for each adapter bound to TCP/IP. For Release and Renew, if no adapter name is specified, then the IP address leases for all adapters bound to TCP/IP will be released or renewed. For Setclassid, if no ClassId is specified, then the ClassId is removed. Examples: > ipconfig ... SHOW information. > ipconfig /all ... Show detailed information > ipconfig /renew ... renew all adapters > ipconfig /renew EL* ... renew any connection that has its name starting with EL > ipconfig /release *Con* ... release all matching connections, eg. "Local Area Connection 1" or "Local Area Connection 2" C:\>IPCONFIG only allows you to obtail the IP address information. It also allows some control over an active TCP/IP connection. To configure the IP settings mentioned in your post, you will need to use netsh. |
|
| 5377. |
Solve : Batch command to find the existance of a folder? |
|
Answer» Hi, IF Exist "%XMLFileDestination%" ( |
|
| 5378. |
Solve : Batch to Rename!? |
|
Answer» Helloo every1 So what have you done so far?Cant Understand ur Meaning ST Quote from: the_mad_joker on January 27, 2010, 09:04:17 AM Cant Understand ur Meaning ST If you want US to help you write a batch, show us what you have done so far. If you want us to write a batch for you, my rates start at $100 per hour. Quote from: Salmon Trout on January 27, 2010, 11:27:04 AM If you want us to help you write a batch, show us what you have done so far.U r Very Costly ST In 100$ I cud hire an Mercenary 2 kill sum1I Think i Wrote my Query Too Long I Just Want a Batch File Who Wud record the Names Of Files in two different folders For Ex . ".\TECHNiC.RoX_11ed4415_0000261e.tec" ".\TECHNiC.RoX_138d5c44_0000261e.tec" ".\TECHNiC.RoX_11ed4415_0000261e.tec" ".\TECHNiC.RoX_09513b0e_0000261e.tec" Quote from: the_mad_joker on January 28, 2010, 05:33:47 AM In 100$ I cud hire an Mercenary 2 kill sum1 Never trust a Merc that only charges $100. The really good ones charge way more then that and would probably take you out just for the insult of only offering them $100. Of course after they take you out they will probably take your $100 so actually you would be PAYING $100 to have some one taken out. It just wouldn't end very good for you.Quote from: mroilfield on January 28, 2010, 05:43:35 AM Never trust a Merc that only charges $100. The really good ones charge way more then that and would probably take you out just for the insult of only offering them $100.Really That Was a nice one |
|
| 5379. |
Solve : Copy DOS screen after it's Displayed? |
|
Answer» Quote from: timrob on January 24, 2010, 04:45:28 PM Is there a way to copy a DOS screen? They may be a limit of about 7 screens. When I scroll the screen it looks like about seven pages and the it truncates pages before that. So a screen capture would not get as much DATA as the redirection.Quote from: Geek-9pm on January 27, 2010, 01:18:09 PM They may be a limit of about 7 screens. When I scroll the screen it looks like about seven pages and the it truncates pages before that. So a screen capture would not get as much data as the redirection. You can edit the screen buffer size (H: chars V: lines) in the cmd window properties.Quote from: Salmon Trout on January 27, 2010, 01:24:33 PM You can edit the screen buffer size (H: chars V: lines) in the cmd window properties. Great! Now how do you find the pointer to the screen buffer? And is it a 32 bit absolute address? If so, you could compile a simple C# program to grab the whole thing and put it into a file. You would run it after the batch was all done. Theat way you would not have to modify the batch in any way. other that starting the screen buffer grabber at the end of the job. Is that what he wants? Quote from: Geek-9pm on January 27, 2010, 01:18:09 PM They may be a limit of about 7 screens. When I scroll the screen it looks like about seven pages and the it truncates pages before that. So a screen capture would not get as much data as the redirection. The setup for the screen shot and text capture are similar. Then, 1) Either PrintScreen key for a screen shot. or 2) click copy for text capture or 3) Redirection before the text is displayed Which method does TimRob need?Quote from: Geek-9pm on January 27, 2010, 01:32:51 PM Great! Now how do you find the pointer to the screen buffer? And is it a 32 bit absolute address? If so, you could compile a simple C# program to grab the whole thing and put it into a file. You would run it after the batch was all done. Theat way you would not have to modify the batch in any way. other that starting the screen buffer grabber at the end of the job. http://msdn.microsoft.com/en-us/library/ms682073%28VS.85%29.aspxQuote from: timrob on January 25, 2010, 04:06:16 PM Sorry, I misread your statement. I meant I wanted to capture what ever is on the DOS screen. whatever is on the DOS screen is whatever your DOS batch program spewed out via echo statements. Therefore, you can just redirect them to a file using > or >>. The rest of what's on your DOS screen are the cmd.exe prompt, plus whatever text you type in, which I don't really know why you want to capture them as well. There used to be, sometime in the dim past, a way to redirect all console output to a serial port. Would that be a hardware method? I think taht is still used when doing debugging on some kinds of system programs. Quote from: Geek-9pm on January 27, 2010, 01:32:51 PM Great! Now how do you find the pointer to the screen buffer? And is it a 32 bit absolute address? If so, you could compile a simple C# program to grab the whole thing and put it into a file. You would run it after the batch was all done. Theat way you would not have to modify the batch in any way. other that starting the screen buffer grabber at the end of the job.Quote from: Salmon Trout on January 27, 2010, 01:38:13 PM http://msdn.microsoft.com/en-us/library/ms682073%28VS.85%29.aspx Main issue being that you'd need to somehow acquire the console handle, and even then I don't think you'd have much luck, since HANDLES aren't accessible cross-process. Quote And is it a 32 bit absolute address? If so, you could compile a simple C# program to grab the whole thing and put it into a file. Have you ever used C#? or programmed for the NT environment? FIRST: it doesn't matter if you had a pointer. every memory pointer is only valid within the address space of a single process. you cannot, for example, take a handle to a string from one program and access that string in another program using that pointer; it simply doesn't work that way. Two programs can be running at the same time that have pointers that are the same but point to other items. Thus is the benefit of PROTECTED memory space and Virtualization. Additionally, even IF that was possible C# doesn't really give you any easy way of using direct pointers. C does, though it wouldn't be simple. How would you determine the size of the buffer? you don't, your pretty much forced to guess, and chances are you'll overrun that storage area and start emitting some other stuff from elsewhere. Quote from: Geek-9pm on January 27, 2010, 08:08:48 PM There used to be, sometime in the dim past, a way to redirect all console output to a serial port. Would that be a hardware method? Yes. that's still possible. If you have a checked build of windows (read: dev build). And it doesn't output "Console" data it outputs messages direct from the kernel.Thank you , BC_Programmer, No I have not down programming is a NT environment. NT was after my days. I did assembly language in the old DOS environment . We just had to know where the segment was. I used to do this like this: Code: [Select] ... push cs pop dx ... Well, that is all i can remember, am not sure if it means anything anymore. Quote from: Geek-9pm on January 27, 2010, 08:54:53 PM Thank you , BC_Programmer, yep, good ol' Segment:offset, IIRC; actually, although MS seems to claim otherwise in their literature, Win 9x never had a "protected memory model" you could inspect the memory of any process through ASM in a DEBUG session, I think. being based on a "protected memory pre-emptive tasking environment" was one of the requirements MS had to meet in order to get into the government market; It's more secure for the same reasons it's more difficult to work with in some scenario's. If you could inspect a command sessions memory for the command buffer you could just as easily inspect "super high profile banking application" for passwords stored directly in variables; or, if the program is designed properly, you'd be able to inspect the memory contents after the user typed in the super ultra secure password and copy it down. Of course they are contrived examples but it prevents spyware from being used against the government too much. On the other hand, it's still possible to inspect the memory of any process; the trick is to get a piece of code to run within that process, and then communicate (perhaps via named pipes) to the "main" process that collects the information. There are a few METHODS of injecting code into other processes, but it's rather involved. the "easy" way is to simply write a small DLL that get's loaded via the appInit_DLLs key in the registry; then there will be a DLL loaded into every single EXE process that starts, and that problem is solved; and Interprocess communication can be initiated between any process since that process will have "your" DLL loaded.To get back to the OP. You wold have to get the CMD.EXE to load another DLL that would "SPY" on the memory assignment. In the OP, he said in a batch file. Maybe he did not know that for a one-time thing anybody can do it manually by scrolling back into the screen buffer and then select EDIT MARK COPY and then open notepad and paste it into notepad. When he said batch. and screen capture i took him literally. We should have asked what he might earlier. |
|
| 5380. |
Solve : Get Drives.? |
|
Answer» Hi ! to all. I REQUEST TO MY ALL DEAR FRIEND. i want to get all my PC's drive latter in ARRAY in to display. like i GO in DISKPART in this list volume we show all volume of drive but i want that programming to how to do this ?? Batch code can only handle text, not arrays which are objects. You can use the for command to parse the OUTPUT from this little snippet. Code: [Select]@echo off fsutil fsinfo drives Good luck. Thanks for the Replay ... But it is possible to store in any variable ...... like in %%a or like that!! i try FOR command but i only enter in diskpart i can't get all dive so pls help me. Thanks. I'm still not certain what it is you want. This snippet will show only the drive letters and drive labels: Code: [Select]@echo off echo list volume > diskpart.txt echo exit >> diskpart.txt for /f "skip=8 tokens=3-4" %%i in ('diskpart /s diskpart.txt') do ( echo %%i: %%J ) del diskpart.txt This snippet will show all the fields: Code: [Select]@echo off echo list volume > diskpart.txt echo exit >> diskpart.txt for /f "skip=6 tokens=*" %%i in ('diskpart /s diskpart.txt') do ( echo %%i ) del diskpart.txt Good luck. I try this. Thanks for the replay. |
|
| 5381. |
Solve : your current security settings do not allow this action.? |
|
Answer» Do anyone know why, when i run "my documents" it SAYS that my current Do anyone know why, when i run "my documents" it says that my current My Documents is a directory not a executable program. You may cd to My Documents and the list the files in My Documents. Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Bill Richardson>cd My Documents C:\Documents and Settings\Bill Richardson\My Documents> C:\Documents and Settings\Bill Richardson\My Documents>dir *.exe Volume in drive C has no label. Volume Serial Number is F4A3-D6B3 Directory of C:\Documents and Settings\Bill Richardson\My Documents 01/09/2010 06:02 PM 741,376 530_1018.EXE 10/02/2009 04:32 PM 60,857,536 Ad-AwareAE.exe 05/12/2009 10:16 AM 851,968 lj1100cuwinnt42kxp-en.exe 01/13/2010 07:05 PM 5,230,592 proxyway.exe 4 File(s) 67,681,472 bytes 0 Dir(s) 302,517,923,840 bytes free C:\Documents and Settings\Bill Richardson\My Documents>dir *.gif Volume in drive C has no label. Volume Serial Number is F4A3-D6B3 Directory of C:\Documents and Settings\Bill Richardson\My Documents 12/21/2009 08:42 AM 113,645 Christmas.gif 06/02/2009 01:11 AM 193,818 raining.gif 2 File(s) 307,463 bytes 0 Dir(s) 302,517,923,840 bytes free C:\Documents and Settings\Bill Richardson\My Documents>Quote from: BillRichardson on January 27, 2010, 06:52:33 PM My Documents is a directory not a executable program. You may cd to My Documents and the list the files in My Documents. I mean that i double click on "my document" i am the administrator of the computer.Click start button, then RIGHT click for menu and choose open : ( There is a malfunction with "double click" ?) FIND a working mouse and try it. and/or http://en.kioskea.net/forum/affich-23157-drives-and-folders-not-open-by-double-click Quote from: BillRichardson on January 27, 2010, 07:02:20 PM Try right click for menu and choose open :You cannot right click it, it will say the same thing: your current security settings do not allow this action. [Saving space, attachment deleted by admin]Quote from: BillRichardson on January 27, 2010, 07:02:20 PM ( There is a malfunction with "double click" ?)My mouse work gook. Just the pop up: Your current security settings do not allow this action. Quote from: rem_bc on January 27, 2010, 07:04:44 PM You cannot right click it, it will say the same thing: your current security settings do not allow this action. Do a SYSTEM restore to a day when all was well: start, All Programs, accessories, System Tools and click System Restore.Quote from: rem_bc on January 27, 2010, 07:17:31 PM My mouse work good. Just the pop up: Your current security settings do not allow this action. Download, install and run Malwarebytes' Anti-Malware http://download.cnet.com/Malwarebytes-Anti-Malware/3000-8022_4-10804572.html |
|
| 5382. |
Solve : Explore unknown drive? |
|
Answer» HI! I'd like to have a batch for my MultiSlotCardReader. It's suppose to check drive K: L: M: and N: for directorys AND/OR files. If there are any files present then it should EXPLORE the drive. Can't get it working with wildcard-files and directorys, only specified filetypes. Any smart ideas? Thanks!It's for Windows XP btw Try this Code: [Select]@echo off dir K:\ *.* /s >> scan.txt dir L:\ *.* /s >> scan.txt dir M:\ *.* /s >> scan.txt dir N:\ *.* /s >> scan.txt echo Done! pause> nulUhm YEAH, that code prints the content of the drives to scan.txt. I want it to Explore the drives if any files exist. Code: [Select]@echo off IF NOT EXIST C:\test\1\*.txt GOTO two ( ) ELSE ( explorer C:\test\1. :two IF NOT EXIST C:\test\2\*.txt GOTO three ( ) ELSE ( explorer C:\test\2. :three IF NOT EXIST C:\test\3\*.txt GOTO four ( ) ELSE ( explorer C:\test\3. :four IF NOT EXIST C:\test\4\*.txt GOTO End ) ELSE ( explorer C:\test\4. :END That code almost does it, but I don't want to specify the filetype. If I SET .. Code: [Select]IF NOT EXIST C:\test\1\*.*, GOTO two ( ) ELSE ( explorer C:\test\1. ..all drives is opened.So you want to be able to explore them within the shell. OK you could cheak to see if the drive or path is there and if it is change directiory (cd)Hmm okay, any EXAMPLES on that? I think this will do what you want: Code: [Select]@echo off for %%a in (K L M N) do dir %%a: >NUL 2>&1&if not errorlevel 1 start explorer /root,%%a:\Thank you! I'll try that out tomorrow Ahh, that works GREAT! Thank you very much Gary!No problem. |
|
| 5383. |
Solve : 10 options? |
|
Answer» Hello, |
|
| 5384. |
Solve : Simulating Enter in Batch? |
|
Answer» Hey, |
|
| 5385. |
Solve : using ethernet card for internet connection? |
|
Answer» please excuse me if this sounds stupid, because i am a newbie. |
|
| 5386. |
Solve : Window display? |
|
Answer» I have a program that runs through DOS and while I can get the SCREEN to be a full screen, the data inside only takes up the top half of the screen. How do I get the program to use the full screen? When I set it up, I selected that option, but it's still not working.Try pressing [Alt]+[Enter] |
|
| 5387. |
Solve : New to this? |
|
Answer» Hello I'm new to batch FILES and would appreciate some help. I am wondering if while running an installer from the batch file, you are able to "hardcode" the cd-KEY SOMEWHERE so you wouldn't have to have any user interaction. Thanks in advance. That usually depends on the program and the installer. There is often a way to automate the CD key, but it probably wouldn't be in DOS or a batch file. For example, for Windows 98 I remember you could enter the CD-key into the "msbatch.inf" file to automate that part of the process. Other programs MAY have a smillar method, but it will be program specific. |
|
| 5388. |
Solve : file length? |
|
Answer» how would I get my batch file to return how many LINES a file is (test.txt)use find /C to COUNT the matching linesok THINKS |
|
| 5389. |
Solve : Boot? |
|
Answer» Hello, I thought my example was prettyclear but basicily I am trying to make a disk that boots then runs my batch file which is compiled in an exe by the way. So I get you could look at it as a DOS Operating System.although i don't know what exactly you are doing, but nonetheless, you can type something like "create windows boot disk" in google and there are sites that shows you how to make boot disk. After creating your boot disk, put your compiled exe in it and off you go.If you are running off a "DOS" boot disk, then you would call your program from a line in the AUTOEXEC.BAT file. Using an example of a boot floppy disk running DOS, and your program is called "MyBat.exe" in the root of the floppy, you would do: AUTOEXEC.BAT Code: [Select]MyBat.exe If you are running Windows, and want it to start automatically at the launch of Windows, put it in the STARTUP folder under Start Menu. Put it under "All Users" if you want it to run when any user logs in, or under the specific user(s) if you want it to run for just certain users. Example would be to copy your MyBat.exe to "C:\Documents and Settings\All Users\Start Menu\Programs\Startup" OK hello everyone my problem is a simple one i hope. Please help me. My friend gave me an old computer if his, DAID it was mine as long as i nuked the HARD drive, awsome so i did. unfortunately he doesn't have a restore disk for it and i dont either. So i need to install an operating system on it. i have a Windows Millenium edition CD, but no way to access it. I created a boot disk using our family XP machine, but i dont know how to use DOs and get past the screen the pops up when i turn on the downed machine. How to i either A) install windows ME using the cd or B)simply use DOS.wingsrule, it is better to start your own topic, rather than hijack someone else's thread, but you do need to download a WinME boot disk (free at www.bootdisk.com) and then boot with that and then type in format c:/u/s and press enter fdisk/mbr and press enter e:\setup and press enter that will start the install. If you can't go from here, please do start your own thread in the Windows forum.SOrry will do. |
|
| 5390. |
Solve : filtering results? |
|
Answer» TRY: dir /B /a-dthen its ALRIGHT to use dir | findstr /V "" > output_file.txt |
|
| 5391. |
Solve : MSDOS Boot Diskette Problem? |
|
Answer» I have recently created a MSDOS boot up disk, and on my computer I have two drives C: and D:, C: being the master and D: the slave. After BOOTING my computer into dos mode i have access to one DRIVE which is C: HOWEVER the drive C: is infact the computers D: so only the slave how do I access the the real C: drive? I am running Windows XP Professional. |
|
| 5392. |
Solve : Make directory using current date? |
|
Answer» Hi everyone, my FIRST post! Hi everyone, my first post! I don't know how hard it is what I have asked for, would it be easier if I just asked for the new folder named with just the "today's date" and not the time also? Thanks again and I look forward to any replyhi do a search first in this forum. enter "date time" as the search KEYS, show entries for the last 3 MONTHS , or last 1 year and you can find some posts that shows how to manipulate dates/times in batchDate and time manupilation is not easy under Windows 98 DOS. It is very easy to do under Windows 2000 and newer. Date only is easier. I think most (or all) of the posts you will find on doing this are for Windows NT/2000/XP/2003. Give me a few minutes, and I'll post some code that can do it in Windows 98 ... but it won't be pretty.This assumes that the directory "C:\My Documents\folder" already exists: Code: [Select]@echo off echo. |date >date.txt echo e 100 >debug.txt echo 73 65 74 20 64 61 74 65 73 74 72 3d >>debug.txt echo m 11a 11d 10c >>debug.txt echo m 114 115 110 >>debug.txt echo m 117 118 112 >>debug.txt echo rcx >>debug.txt echo 14 >>debug.txt echo n datestr.bat >>debug.txt echo w >>debug.txt echo q >>debug.txt debug date.txt <debug.txt del date.txt del debug.txt call datestr.bat echo Date is %datestr% del datestr.bat md "C:\My Documents\folder\%datestr%" move "C:\Test\TestFolder\*.*" "C:\My Documents\folder\%datestr%"GuruGary, Thanks very much for your help. I thought that it would be a difficult thing to do under win98. Yes, I have seen plenty of code for the newer OS’s. Thanks again No problem. Did it work the way you wanted? Or even work at all?If batch is not easy to manipulate dates and time, why not go for scripting langauges like VB, perl, python? date and time manipulation is easier. here's a simple one in python Code: [Select]import time,os,shutil thedate = time.strftime("%Y%m%d",time.localtime()) #only get the date, not time rootdir = os.path.join("C:\\", "My Documents" , "folder") newfolder = os.path.join(rootdir,thedate) testfolder = os.path.join("C:\\", "Test" ."TestFolder") os.makedirs(newfolder) os.chdir(testfolder) for files in os.listdir(testfolder): shutil.move(files,newfolder) its easier to understand ...Thanks to GuruGary, the Batch worked great! Thanks too to ghostdog74, for writing the Python script! It's nice to know that there are people out there that still like to help. All for free too! Have a good day Cheers |
|
| 5393. |
Solve : Sending string to multiple users...? |
|
Answer» I want to create a VARIABLE that is a string, like "Hello", and send to multiple users using net send. I can use net send, but cannot create a variable to be sent. I am just trying to avoid updating each net send statment when the message changes. variable = "Hello" I believe previous posts mentioned that you have to set the variable. Both the SET command and the NET SEND must be done in the same window. Code: [Select]set variable = "Hello" net send computername %variable% GuruGary's solution still applies. 8-)Sorry, I mistyped. I've been doing exactly that. I have these two lines in a file called send.bat: set variable "Hello" net send AA54546 %variable% Can anyone reproduce this using either network Id or computer name successfully?I was able to get your send.bat file to work without any problems. Used a different computername of course. What OS and type of network are you using? 8-) It's highly recommended to disable the Messenger Service as this can be the source of UNWANTED popups from the script kiddies.I'm actually using my Windows (2000) network login, not computer name. I will try it with the computer name instead. Not sure of the network type.Be sure there is an EQUALS sign (=) between the variable and Hello. The line should be exactly like this: Code: [Select]set variable="Good Morning" If that still does not work, then put an "echo" at the beginning of the first line so we can see the output, and then post the results. EXAMPLE, change your batch file from: Code: [Select]@echo off set variable="Good Morning" net send AA56697 %variable%to Code: [Select]@echo off set variable="Good Morning" echo net send AA56697 %variable% |
|
| 5394. |
Solve : Need batch file? |
|
Answer» I need a rather simple batch file!! |
|
| 5395. |
Solve : for? |
|
Answer» When I do a forloop this one |
|
| 5396. |
Solve : adding to a file? |
|
Answer» how do i add a variable to the start of every line in a fileYou would probably have to rewrite the file. To add a colon as the first character in each line of a TEXT file, you can set the variable to the colon and process the file like: how do i add a variable to the start of every line in a file You should already know how to loop over a file using for loop. so just set the variable, eg set var=somevariable then while you are looping over the file, do an echo %var%%%i this will add the variable in front of the line.OK THINK you i did not think a for loop would work i thought that it would just add to the first line |
|
| 5397. |
Solve : Next? |
|
Answer» Hello, Hello, seems like you want to hash your files with md5. you can use the fciv command. Download from here http://support.microsoft.com/?kbid=841290 There are examples on how to use it. Do you want to do this on all files, then recurse subdirectories and keep going? Or all files on the entire computer? Here is a command to run on all files in the current directory (all in one line): Code: [SELECT]for /f "delims=" %%a in ('dir /a-d /b') do md5 "%%a" Here is a command to run on all files in the current directory and recursing all subdirectories: Code: [Select]for /f "delims=" %%a in ('dir /a-d /b /s') do md5 "%%a" from what you seem to be doing, you are going to be writing ANOTHER batch to check these md5 with the ones you collected. fciv can save you the time to write the checking module.There is a free microsoft toy - http://www.logparser.com/ that would fit the BILL here, it works against logfiles, the registry and the filesystem. It has a nice clean SQL front end and can output to a myriad of formats. It is easily called by the command line Grahamactally I think that I mis-posted my thread, I was using md5 as an example. :-/ So can you give me the FORMAT,I would like to run a few lines to check whether the file has the string computer and key as well as name in it then echo it. Sorry I mis explained:-[ AlmnI took into consideration that you may have given an unrelated example and answered your question the way you asked it, so my code should still work. Do you want to do this on all files, then recurse subdirectories and keep going? Or all files on the entire computer? Here is a command to run on all files in the current directory (all in one line): Code: [Select]for /f "delims=" %%a in ('dir /a-d /b') do md5 "%%a" Here is a command to run on all files in the current directory and recursing all subdirectories: Code: [Select]for /f "delims=" %%a in ('dir /a-d /b /s') do md5 "%%a" |
|
| 5398. |
Solve : runthis.bat to fix virus; dos not staying on scr.? |
|
Answer» No problem. Glad you GOT it to run. |
|
| 5399. |
Solve : a .bat to enable a NIC in WinXP? |
|
Answer» I have an individual who has a problem with her NIC being DISABLED in Win XP. I need a batch file that will enable that if it is disabled when Win XP BOOTS. I have RESEARCHED and can't seem to find that or figure out how to accomplish it. |
|
| 5400. |
Solve : Tracert self? |
|
Answer» Is is POSSIBLE to do something like tracert local_server or something that would trace the current computer?Yes, you can ... but I don't KNOW what you would gain from doing that. Try: |
|