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.
| 1851. |
Solve : How does one begin to use DOS? |
|
Answer» Hi, I am in giving away my old DOS based computer SYSTEM, to a very nice friend of the family. It's an IBM Personal System/2 MODEL 50. It has been so long since i have used it that i am not sure if there is something seriously wrong with the system or not. When booted up the only thing that comes to screen are some numbers, which read: |
|
| 1852. |
Solve : how do i erase h/d & reinstall xp?? |
|
Answer» i want to get rid of the trojan ,and start over from scratch, but i dont know how i would run this first>http://vil.nai.com/vil/stinger/ but drastic to reload a sytem but here is the info>http://www.michaelstevenstech.com/cleanxpinstall.htmlJust boot the XP CD and format the DISK before you install, you'll get rid of anything on it. |
|
| 1853. |
Solve : d:\>cd c:\program files\etc....can I do this?? |
|
Answer» I am trying to go from: |
|
| 1854. |
Solve : windows does t setup? |
|
Answer» I have a 2000 IBM 600E Thinkpad. I got it from a friend and she tried to load Windows xp pro. Well she didn"t finish the setup and it will not load. I made a dos boot disk and tried to load basic windows 3.1 and the computer says that " Setup is unable to create the specified DIRECTORY on the specified drive" It says that I can CHOOSE a different path but I do not Know all that MUCH so I need some help.does it have a cdrom drive ....go in to the bios f1 and CHANGE the boot sequence to boot from cdrom..what is the previous o/s on it...if it has none and this laptop with the right ram etc can handle winxp pro...its best to download a win98 disk format the hard drive and fdisk it .. |
|
| 1855. |
Solve : Imbedding a username and password in a bat file? |
|
Answer» I am executign a bat file that will zip contents to of a local folder to a remote server. |
|
| 1856. |
Solve : Changing to Directories with long names - Win2K? |
|
Answer» Hi, |
|
| 1857. |
Solve : Set dir contence as seperate strings? |
|
Answer» So for my robotics team I am making a program that will record match data on each team. I am RUNNING into a problem when I want to desplay all the teams scores at once. I am writing the scores in their own text file in c:\...\teams\%team number%\scr.txt and c:\...\teams\%team number%\ascr.txt. Currently I am using a loop to run through all the possable team numbers (1-5000) and using It seems to me you need to sit down and really think about what needs to be done. Get the storage scheme right and worry about the code later. Do you really have 5000 teams? Or some smaller number? If you have more than a small number the scores are going to start scrolling off the screen, since showing each team's score uses 4 lines of screen space. Why can't you have just one text file to hold all the data? Using separate folders like this is a very inefficient method, and is bound to be slow. 1) There are about 40 teams in each competition with numbers ranging from 0-5000. 2) home.bat is a menu page 3) Thank you for the one line recommendation. 4) I have to use 2 diffrent files for scr and ascr for the set /p VAR=< FILENAME command Quote from: Salmon Trout on March 04, 2012, 05:24:32 AM Using your separate folders method can be speeded up a bit. Thanks for the respond, I like the set /a VAR+=1 that will HELP alot. 1) I like the one line suggestion a lot. 2) No there is not a team 0 thank you for point that out 3) I'm running it on my laptop (slow D:) I did end up getting it to work last night. Thank you for your help! I'm ganna go through and check if Salmon Trout's runs faster, but here is what I did: Code: [Select]echo off set /p color=< clr.ghx color %color% Title =GHX - View cls start v1.exe start v2.exe start V3.exe start v4.exe start v5.exe set a=0 set b=0 set c=0 set d=0 set e=0 cd .. cd teams cd %date:~10,4% :wait cls if exist vc1.ghx set a=1 if exist vc2.ghx set b=1 if exist vc3.ghx set c=1 if exist vc4.ghx set d=1 if exist vc5.ghx set e=1 set /a ttl=%a%+%b%+%c%+%d%+%e% if "%ttl%" =="0" echo 0% if "%ttl%" =="1" echo 20% if "%ttl%" =="2" echo 40% if "%ttl%" =="3" echo 60% if "%ttl%" =="4" echo 80% if "%ttl%" =="5" echo 100% if "%a%" =="1" if "%b%" =="1" if "%c%" =="1" if "%d%" =="1" if "%e%" =="1" goto show REM the ping is to stop the flashing numbers ping 127.0.0.1 >nul goto wait :show cls if exist v1.ghx type v1.ghx if exist v2.ghx type v2.ghx if exist v3.ghx type v3.ghx if exist v4.ghx type v4.ghx if exist v5.ghx type v5.ghx if exist v1.ghx set v1=< v1.ghx if exist v1.ghx set v2=< v2.ghx if exist v1.ghx set v3=< v3.ghx if exist v1.ghx set v4=< v4.ghx if exist v1.ghx set v5=< v5.ghx set vcom=%v1%%v2%%v3%%v4%%v5% if "%vcom%" =="" echo No teams indexed echo. if exist v1.ghx del v1.ghx if exist v2.ghx del v2.ghx if exist v3.ghx del v3.ghx if exist v4.ghx del v4.ghx if exist v5.ghx del v5.ghx if exist vc1.ghx del vc1.ghx if exist vc2.ghx del vc2.ghx if exist vc3.ghx del vc3.ghx if exist vc4.ghx del vc4.ghx if exist vc5.ghx del vc5.ghx set /p nouse=Press Enter cd .. cd .. cd system call home.bat I used a bat->exe compiler to make it run without opening a window (that's why i used a exe) here is v1.exe Code: [Select] echo off cd .. cd teams cd %date:~10,4% set a=1 :loop if not exist %a% goto loop.break cd %a% set /p scr=< scr.ghx set /p ascr=< scr.ghx cd .. echo %a% >>v1.ghx echo. >>v1.ghx echo Total %scr%>>v1 echo Average %ascr% >>v1 :loop.break set /a b=%a%+1 set a=%b% if "%a%" =="1001" goto exit goto loop :exit echo 1 >>vc1.ghx exit here is v2.exe Code: [Select] echo off cd .. cd teams cd %date:~10,4% set a=1001 :loop if not exist %a% goto loop.break cd %a% set /p scr=< scr.ghx set /p ascr=< scr.ghx cd .. echo %a% >>v2.ghx echo. >>v2.ghx echo Total %scr%>>v2.ghx echo Average %ascr% >>v2.ghx :loop.break set /a b=%a%+1 set a=%b% if "%a%" =="2001" goto exit goto loop :exit echo 1 >>vc2.ghx exit the rest (v3-v5.exe) follow the pattern until teams 0-5000 are covered Any comments\suggestions? BTW: can you open a 'SFX module' exe file without winRAR? Thanks again for the help! EDIT: ran Salmon Trout's code, and I think it's a problem with my computer because it took 4 min Code: [Select]5000 start Sun 03/04/2012 13:41:29.76 5000 end Sun 03/04/2012 13:44:41.86 delete? |
|
| 1858. |
Solve : network bat question? |
|
Answer» I've been writing a bat FILE that maps a network drive after I log into a VPN network. However, I've RUN into a snag and can't figure it out. I execute the file, but it then asks me for my credentials, which I type in. No luck. However, when I use the windows shortcut WINDOWS-R, then type in the path to the prompt, it works. The question why won't it work in DOS, but work in Windows?Please post the code you are using and if possible give us the errors that are coming up. The more information you give us, the better we can tailor the help to your specific problem.net use V: /delete |
|
| 1859. |
Solve : Batch file to convert unicode text file to ANSI text file? |
|
Answer» I want a batch CODE that would convert my list of text files already SAVED as unicode to ANSI Type.
I'm not SURPRISED. That isn't Windows batch/cmd code - it looks like some language you invented. Quote from: Salmon Trout on January 08, 2012, 03:34:13 PM I'm not surprised. That isn't Windows batch/cmd code - it looks like some language you invented. I think it's some kind of BASIC; I'm not sure which, though. |
|
| 1860. |
Solve : Fixed width? |
|
Answer» The place I'm starting from is the first stepping stone to a more complex batch file. What I want to have the batch file do at the moment is count from one input number to the second input number by 1. I have it working to get the two numbers and can get it to count up. the issue I run into is trying to zero pad the front of my numbers. This is what I have right now. Pad the number with a larger number of pad characters than you will need (can be any character, not just zero). Then select the rightmost N-1 characters using the syntaxYour code should run much QUICKER. And as I always say time is money. But I wasn't sure if the O/P wanted numbers greater than 99 to be padded with a zero. Too me it looks like they wanted 001 010 100 1000Lemming, I understood about why you used echo. I use the method I showed above in a variety of DIFFERENT batch scripts, including bulk renaming of files and it is just as effective as any other method. It is more efficient, unless you are specifically doing the tests for other reasons and there is other processing involved with each test. If not, and if you were wanting to set a variable for instance, you would just change it to Code: [Select]echo off setlocal enabledelayedexpansion for /l %%a in (%1,1,%2) do ( set num=00000000000000000000%%a set var=!num:~-4! ) But this is more about efficient programming than anything, and showing you another way to accomplish the task you initially wanted done. If your personal preference is to use my originally posted method, then by all means feel free to use it. This is what I'm doing and it makes it a little easier to do the brute force way vs variable. It is easier since I am very new to batch file writing. I have also expanded the batch file to take in two numbers when being called Code: [Select]TG_batch.bat 1 2 Code: [Select]echo off Title TG batch for /l %%A in (%1, 1, %2) do ( if /i %%A LLS 10 ( xcopy t:\!template t:\run\00%%A copy t:\!def\00%%A.atmo t:\00%%A\part1\00%%A.atmo run other program 1 copy output.testcase ..\part2\input.dat run other program 2 ) else ( if...... if...... ) This is for the most part what I am doing with the help initially from Raven. The file structure is only set to run no more than 100 iterations so getting to 1000 was never a concern. Since I am new I don't know how to correctly IMPLEMENT the smaller set of batch code with what I need it to do. I am extactic to see the number of responses to this. It is just that at the time I don't know how to correctly use the new supplied way. Thank you all for your help.another way if you want to see the powers of 10 Code: [Select]echo off setlocal enabledelayedexpansion REM pad with spaces set "padchar= " REM pad with zeroes set padchar=0 for /l %%a in (%1,1,%2) do ( set pad=& for %%b in (10000 1000 100 10) do if %%a lss %%b set pad=%padchar%!pad! echo !pad!%%a ) Quote from: lemming622 on December 29, 2011, 05:28:14 PM This is what I'm doing and it makes it a little easier to do the brute force way vs variable. It is easier since I am very new to batch file writing. I have also expanded the batch file to take in two numbers when being calledIf you do it that way you have to replicate all your commands inside each IF ELSE. Use the IF ELSE to SET a variable with the padded number then do all your commands. |
|
| 1861. |
Solve : How do you write a blank line to a file?? |
|
Answer» I want to ADD blank lines to a file, but not sure how. |
|
| 1862. |
Solve : Need to move files and folders up one level.? |
|
Answer» Hi. |
|
| 1863. |
Solve : batch file for reading and coping strings within lines? |
|
Answer» Hi All, |
|
| 1864. |
Solve : create a file inside number of folders.? |
|
Answer» Hello every one Script 1(we run this script and it calls second script)Code: [Select]FILES= ("c:\first", "c:\second", "c:\third"' "c:\four"); for $file(files) { system("C:/Perl/bin/perl C:/script_two.pl $file"); } Quote script_two(it creates a blank file inside folders)Code: [Select]use Fcntl; #The Module use File::Find; if($#ARGV != 0) { print "\nUsage: perl $0 <Root Directory>\n"; } else { $dir = ARGV[0]; #The root directory given by the user find(\&edits, $dir); print "Success\n"; } sub edits() { sysopen (FH, 'local.mk', O_CREAT, 0755); close (FH); }name each folder 1, 2, 3... and so on use this code and replace ^name^ with the name of the file your TRYING to make Code: [Select]echo off set dirnum=0 :loop if dirnum=116 echo done&pause&exit set /a dirnum=%dirnum%+1 echo.>C:\%dirnum%\^name^ goto loop |
|
| 1865. |
Solve : How do I log the output from a .bat job.? |
|
Answer» Hi, C:\>echo %time% As you can see, the time is expressed in hours, minutes, seconds and hundredths of a second Consider the following Code: [Select]echo off echo Starting process >> %time%.txt Process.exe echo Finished process >> %time%.txt Unless the process starts and finishes in less than 0.01 second, the two echo statements are going to output to 2 files with different names. call your batch file mybatch.bat Code: [Select]echo off IF %1==logged goto :code echo. >>logfile.log echo %DATE% >>logfile.log echo //START OUTPUT >>logfile.log call %comspec% /c mybatch.bat logged >>logfile.log echo //END OUTPUT >>logfile.log exit :code [your code goes here] try that |
|
| 1866. |
Solve : Creating a bootable CD with several boot options? |
|
Answer» I'm trying to create a bootable CD that BOOTS to a MENU. From that menu I would like to be able to BOOT from a choice of options. Is this possible? |
|
| 1867. |
Solve : Was wondering...? |
|
Answer» I was just wondering if there is any way a .bat file could kick a certain IP address that's connected to your wireless router off of it. If there is a way could some one post the code I would extremely appreciate it.Hi, what I'm trying to achieve is removing my neighbors from my router and hogging all of my bandwidth. Can you not put some security on your network? WPA or WPA2 recommended but even WEP is BETTER than none at all. Note: In many PLACES your neighbor can be charged with theft of services which is a felony. In the US, I'm sure it's against some provision or other of the Homeland Security Act. Good luck. I've tried time and time again to set up the wireless security but every time for some reason it messes up and ends up locking its self down and then I have to reset it.do you require the wireless features, or are you connecting to an available port on the router? If so you could simply disable the wireless portion of the router.The router is down stairs and I'm upstairs in my loft so that wouldn't work, if there was any working cable plug ins in my loft I would use those INSTEAD of wireless. Thanks for the suggestion though.Do you know which neighbors are stealing your connection? if so you could try to "block" your router from their wireless CARDS, with metal or something- It might not get rid of them entirely, but their signal will be drastically reduced.you could use MAC address filtering and then only the machines you've added will be able to connect to the router. (it's what I use) tbh, you do need some sort of sercurity other wise your open all sorts of nasty things!!!! |
|
| 1868. |
Solve : make a instalation log? |
|
Answer» i need to make a installation log file on my local computer i was hopeing to do it in batch script. i am running windows xp pro. i am the ADMIN. if anyone knows of ANOTHER way of doing this plz let me know. What do you mean by Installation Log file? Quote by installation log i mean when some one installs something that it will make a log of the user and what they installed and when.Quote from: Jacob on November 22, 2008, 06:51:15 AM Quote from: Carbon Dudeoxide on November 21, 2008, 10:17:36 PMWhat do you mean by Installation Log file? Quote « Last Edit: Today at 07:55:24 PM by chris hill »Jacob, you are very knowledgeable in this area.....Not POSSIBLE, right?i think it can be done using registry but you must search there for keys if i will find somethink ill POST it here |
|
| 1869. |
Solve : How can i check the return result of "reg query" command?? |
|
Answer» I can list all subkeys and values of an appointed registry key with "reg query" command?. for example: reg query hklm\SOFTWARE\CryptionDirectory /s |
|
| 1870. |
Solve : DosNewbie got problem with fc command! please help....? |
|
Answer» set count |
|
| 1871. |
Solve : zZoOoOmM effect? |
|
Answer» Is there a way in batch to make a zoom in or out effect? |
|
| 1872. |
Solve : Batch file with controlled user input? |
|
Answer» Hello, everybody. I'm new here, but I try to learn a few THINGS about creating batch files. What I'd like to do is for example when asked for the desired bitrate, to accept only numbers and have a default value for all the variables Without a third party program, you have to check the data entry after the fact: Code: [Select]echo off setlocal enabledelayedexpansion set numflag=y set /p bitrate=Enter bit rate: for /l %%i in (0,1,19) do ( call set bit=%%bitrate:~%%i,1%% if .%bitrate%==. set bitrate=192 & goto next if .!bit!==. goto next echo !bit! | findstr [0-9] > nul if errorlevel 1 set numflag=n ) :next if %numflag%==y echo %bitrate% is numeric if %numflag%==n echo %bitrate% not numeric The code does not restrict alpha characters; only checks if the input is numeric; the length of the input is determined by the first space character or 20 characters, whichever comes first. The default bit rate is 192. Setting defaults should be a little simpler: Code: [Select]echo off set bitrate= set /p bitrate=Enter bitrate: if .%bitrate%==. set bitrate=2400 echo %bitrate% The default value is used when the user enters no value to the prompt. The code snippets are designed to show method. Hope it gives you some ideas for your code. Good luck. Oh dear, chem4! Those long lines of code make this thread a scroll bar NIGHTMARE!!! |
|
| 1873. |
Solve : Split folders?? |
|
Answer» Hey there, |
|
| 1874. |
Solve : Batch file to run Telnet command that looks up a list? |
|
Answer» hi there. . I need some help automating a script. i want the batch file to look up that room number on a list and match it to an ip then telnet to it. im assuming comma delimited format exported from excel. so it would be like If Excel quotes each of the fields in the comma SEPARATED file, the code can modified to take that into account. The snippet below uses the above file labeled room.csv Code: [Select]echo off set /p rm=Enter Room Number: for /f "tokens=1-2 delims=," %%i in (room.csv) do ( if %rm%==%%i telnet %%j ) If needed the code can be modified to LOOP should the user enter an incorrect room number. Good luck. |
|
| 1875. |
Solve : Close the current program with a batch file? |
|
Answer» I'd like a way, if possible, to close the current running program through a batch file. By the way, this isn't homework, although it is starting to sound like it huh? Is everyone getting PARANOID? I doubt you can do this in batch. In fact even using the Windows Shell, you can only kill Explorer windows. One solution would be to use Word (don't ask) which can enumerate the open windows and more importantly close them. Code: [Select]Set wd = CreateObject("Word.Application") Set colJobs = wd.Tasks For Each job In colJobs If job.Visible = True And job.Name <> "Program Manager" Then colJobs(job.Name).Close End If Next wd.Quit Save with a vbs extension and run from the Windows run box as wscript scriptname.vbs. Use a path to the script if necessary. Good luck. Wow, that was more effective than I thought, I neglected to close what I had open because for some for some reason I expected it to fail, things like this usually don't work for me. That's great, just what I need. Thanks a lot Sidewinder! |
|
| 1876. |
Solve : DOS - copy most recent created folder? |
|
Answer» I am creating a BATCH file which should, among other, copy from a known path the most RECENT folder. |
|
| 1877. |
Solve : Enter in batch file? |
|
Answer» Hi! I got by with it by just leaving a heavy book on the Enter key while taking my break, ROFLMAO - that sure is a REAL good work around. Thanks for COMING back to report success. Good luck. |
|
| 1878. |
Solve : Have a batch file enter text for you? |
|
Answer» Hi GUYS, |
|
| 1879. |
Solve : Emilware....This is your post? |
|
Answer» I tried responding to this PM however Emilware's mailbox is full. <sigh> hey Sidewinder Emil, I prefer not to answer PM, but rather try and help out on the public boards. This gives even the casual user a chance to learn from the posting. Quote Please i spent 3 day on this i get nowhere It got you here and we're somewhere. Nowhere is to the left! Code: [Select]echo on echo in progress setlocal enabledelayedexpansion for /f "tokens=* delims=" %%x in ('dir /a:-d /s /b C:\temp\*.txt') do ( for /f "tokens=* delims=" %%i in (%%x) do ( set input=%%i set input=!input:bob=emil! set input=!input:smith=mark! set input=!input:peter=kevin! echo !input! >> "%%x.chg" ) ren "%%x" "%%~nxx.old" ren "%%x.chg" "%%~nxx" ) The snippet labels the original file with an old extension and labels the NEW file with the original name. Good luck. thank you for your help. this works great and sorry about sending u PM. i'm new to this. like i said this works but i have an other problem. when new file gets created and the lines are being copied for some reason it skips lines starting with ;FOLD and ;ENDFOLD .Is there a way to FIX that? this is example of the file that i'm tring to change. ;FOLD ; *** Timer Start SW ***;%{PE}%R 4.1.16,%MKUKATPBASIS,%CCOMMENT,%VNORMAL,%P 2:*** Timer Start SW *** ;ENDFOLD $TIMER[3]=0 $TIMER_STOP[3]=FALSE ;FOLD ; **********************;%{PE}%R 4.1.16,%MKUKATPBASIS,%CCOMMENT,%VNORMAL,%P 2:********************** ;ENDFOLD ;FOLD PTP lap110 CONT Vel= 100 % PDAT11 Tool[15]:Car-Zero Base[6]:car-0 extTCP;%{PE}%R 4.1.15,%MKUKATPBASIS,%CMOVE,%VPTP,%P 1:PTP, 2:lap110, 3:C_PTP, 5:100, 7:PDAT11 $BWDSTART = FALSE PDAT_ACT=PPDAT11 BAS(#PTP_DAT) FDAT_ACT=Flap110 BAS(#FRAMES) BAS(#VEL_PTP,100) PTP Xlap110 C_PTP ;ENDFOLD ;FOLD PTP sw164w11625013 PDAT26 SPOT Gun= 2 RETR CLS ACTIVE= 1 Tool[15]:Car-Zero Base[6]:car-0 extTCP;%{PE}%R 4.1.11,%MKUKATPSPOT,%CSPOT,%VPTP,%P 1:PTP, 2:sw164w11625013, 3:, 5:100, 7:PDAT26, 10:2, 12:#FIRST, 14:#CLO, 16:0, 18:1, 20:0, 22:0, 24:1, 25:NORMAL $BWDSTART = TRUE PDAT_ACT=PPDAT26 BAS(#PTP_DAT) FDAT_ACT=Fsw164w11625013 BAS(#FRAMES) BAS(#VEL_PTP,PPDAT26.VEL) S_ACT.GUN=2 S_ACT.PAIR=SDEFAULT.PAIR S_ACT.RETR=#CLO S_ACT.CLO_TM=1 S_ACT.PGNO1=11625013 S_ACT.PGNO2=SDEFAULT.PGNO2 S_ACT.PRESS1=SDEFAULT.PRESS1 S_ACT.PRESS2=SDEFAULT.PRESS2 S_READY=FALSE PTP Xsw164w11625013 USERSPOT(#SPOT, S_ACT) WAIT FOR S_READY ;ENDFOLD The sw164w11625013 must be change to sw164w1100625013. I must insert 00 after 11. If there is a way just to modify original file by inserting 00 after sw164w11 insted of creating a new file, then that would work too. I tried writing VBS but with out wildcard i cant get it to open and change all files with extension .SRC and .DAT in the folder. Code: [Select]Const ForReading = 1 Const ForWriting = 2 Const FileIn = "C:\transfer\test.txt" Const FileOut = "C:\transfer\test.txt" '<== Change to prevent overwrite of original file Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile(FileIn, ForReading) strText = objFile.ReadAll objFile.Close strNewText = Replace(strText, "bob", "emil") Set objFile = objFSO.OpenTextFile(FileOut, ForWriting) objFile.WriteLine strNewText objFile.Close PLease help me if u can. thanks By default FOR /f skips lines with a semicolon at the start. For them to be read, a different end of line (eol) character must be assigned in the delims block. Choose a suitable character that does not appear in the lines you wish to process. In this example I have used the character for /f "[email protected] tokens=* delims=" %%i in (%%x) do ( Quote I tried writing VBS but with out wildcard i cant get it to open and change all files with extension .SRC and .DAT in the folder. This should eliminate your need for a wildcard: Code: [Select]Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set f = objFSO.GetFolder("c:\transfer") Set fc = f.Files For Each fs In fc If objFSO.GetExtensionName(fs) = "SRC" Or objFSO.GetExtensionName(fs) = "DAT" Then Set objFile = objFSO.OpenTextFile(fs.Path, ForReading) strOldText = objFile.ReadAll objFile.Close strNewText = Replace(strOldText, "bob", "emil", 1, -1 ,1) 'First replace use strOldtext strNewText = Replace(strNewText, "smith", "mark", 1, -1, 1) 'Subsequent replace use strNewText strNewText = Replace(strNewText, "peter", "kevin", 1, -1, 1) Set objFile = objFSO.OpenTextFile(fs.Path, ForWriting) objFile.WriteLine strNewText objFile.Close Set objFile = objFSO.CreateTextFile(fs.Path & ".old") objFile.WriteLine strOldText objFile.Close End If Next The replace function is case insensitive. Same situation applies as with the batch code: original file gets labeled with an old extension; Changed file has same label as original file. Good luck. Thanks SIDEWINDER YOU REALY KNOW YOUR STUFF This works great Its lot faster than batch. This is the best search and replace. Thanks |
|
| 1880. |
Solve : FOR... IF variable-PC name is off-line get next name from text file - problem? |
|
Answer» I need help with the following problem: |
|
| 1881. |
Solve : Inserting EOF in a batch file? |
|
Answer» I want to make a batch file that erases all the contents in a .txt file. I want to make a batch file that erases all the contents in a .txt file. Could you explain why you can't just delete the text file? the "00>c:\folder\myfile.txt didn't work" ... "00 is not an internal or external command" The "echo. > myfile.txt" worked like a charm (although I can't say i perfectly understood what you said Dias ) Thanks very much. Y'all a great community: 1hour from post I get an answer. ThanksAbout the Quote Quote I only want to remove the contents not the file. I will be writing new information on the file. I tried to save the name and create a new file (temp), delete the older one, then change the name of temp.txt. But i needed to show that i wanted and empty temp.txt, i wanted to insert ^Z and couldn't find a way to do that. Hope you understood my long sentence. umm- just use > instead of >> when you want to delete it. > will overwrite the entire contents of the file, after which you can use >> to append more. |
|
| 1882. |
Solve : Beginner syntax question? |
|
Answer» I'm trying to copy all the files within a tree to another folder. I have the folder "main" and within the folder I have the folders "tree" (where the files are) and "new" where I want to move the files too Is this your directory structure: Main | |__tree |__new There are other variations of the for command that might help here: Code: [Select]echo off for /f "tokens=* delims=" %%p in ('dir tree /s /b') do ( copy "%%p" new ) It WORKED!!! Thank you so much!!! |
|
| 1883. |
Solve : Output Echoed Text to File?? |
|
Answer» Is it possible to output the echoed text (and any error MESSAGES) to a FILE? I have a batch file that runs a java PROGRAM on multiple, and this batch file takes several hours to execute. Some of my filenames are incorrect, and I get an error message (along the lines of 'Cannot find file'). Unfortunately, because I am RUNNING so many files, I can't tell which file that message is referring to (most of them work, it's just a few of them that do not work). |
|
| 1884. |
Solve : Want to get todays date - 1 day value? |
|
Answer» hi... |
|
| 1885. |
Solve : Batch file for Text File Read "surround" and Write? |
|
Answer» I have some simple text files that contain the file paths for folders and sub folders. My current batch file creates the folder with a list of the file paths. This is the command I am using to make the files: Try this: Dusty, Thank you, that works perfectly! I am only going to add a few things so as to create a temp file that can be deleted and to create a new file each time. This is to create a Search.pro file for ProEngineer so that it can find exactly where it needs to look for all of the parts of an assembly each time AUTOMATICALLY when a file is opened. It'll save a lot of time for people importing new assemblies to their computer so that they can keep their standard Config.pro file and simply create new search.pro files when they open an assembly. Long story with the ProEngineer side of things, but needless to say this will make my life a lot easier. Thanks again for your help! SEBNN Oh, and so someone can see what the code looks like, it is below. Code: [Select]echo !TrialFile >TrialFile.txt dir /ad /s /b >>TrialFile.tmp echo off cls for /f "Delims=" %%a in (TrialFile.tmp) do ( echo "%%a" >>TrialFile.txt ) del .\TrialFile.tmp Like I said, it works great and I have tested it multiple times. Also, as an explanation, the ! in the code is to indicate to ProEngineer that the CHARACTERS following it are a comment and to write SOMETHING other than a blank line when the file is cleared for the first run.Thanks for coming back to report your success and post your coding. D. |
|
| 1886. |
Solve : copy names & info from disk drives to a .txt file? |
|
Answer» would the fsutil command return excess information? gumbaz,Quote is there anyway at all to make this script work propperly in a guest account.. As far as I know, only local Administrators have permission to ACCESS WMI. You could try using the runas command or perhaps Group Policy. PS. Glad to hear the script is working for you. what is the runas command..?? what does it do..?? how to use it in my case..??Runas is a utility that allows you to run jobs under another user's credentials. Type runas /? at a commnad prompt for full details. Runas is a security breach in that passwords must be shared. Check out Group Policy which may offer a better solution. Question: why does the guest account need to run this script? WELL basically im making a batch app to log what kind of devices get plugged into my public PC and then dump the infos into a file for later viewing. but I want it to work on my guest account though.. Quote from: gumbaz on July 01, 2008, 08:42:44 PM well basically im making a batch app to log what kind of devices get plugged into my public PC and then dump the infos into a file for later viewing. but I want it to work on my guest account though..the problem is how are you going to log anything if the guy plugs in and out the device before you execute your script? And when running such "monitoring" mechanism, why would you want to run it as guest, if you are the administrator? makes no sense. USBs, CD and any kind of removable devices can be logged by utilities already created to do such stuff. If you want to do it from scratch, you may want to try configuring your PC to log such events (if possible) and write scripts to query the logs. Or you could write a script that MONITORS removable devices and run it as a service. |
|
| 1887. |
Solve : Rename file with old date? |
|
Answer» Hello, |
|
| 1888. |
Solve : THIS COULD BE THE FIRST LOGICAL QUESTION THUS FAR.? |
|
Answer» i have spent a good amount of time reading about variables and their commands okay everything is going great then all the sudden no go nota error comes up and says can't find "start" Your PATH variable must be wrong. What do you see if you type PATH at the prompt? okay i have the image in paint "screenshot" i can't get it to copy i thuoght maybe i could make a copy and paste it here no go could you explain how to get those shots to people in the forum? i wanted to show you when i type in the word path what is in the line wait its the same line in the variable be bk if you hang ten(toes) i was trying to get gnu c++ going and i couldn't because the DGJPP vvariable was wrong the rhide kept telling to shut down this is an exaple of what i did i realize that it is wrong now this is how much i have grown in this process %PATH% C:\DJGPP\rhid15ab\.ENV DJGPP C:\DJGPP\rhid15ab\BIN this is what is there also Path %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\DGJPP\rhid15ab\bin\rhide.exe hang this is MIRACLE that i even got the path command to work i am so excited i can type commands and they work.."some" thanks rubyYour last entry should read C:\DGJPP\rhid15ab\bin The PATH variable should ONLY contain folder names. the first time i typed the first example start\max\.....dadada the second time i type the longer version start\max\notepad.exe....dadad. neither worked now you said to press start\ then i assume press enter okay it didn't burp on me but it seem to change ...now when you say paremeter or start what exactly are you saying how many paremeters are their so are you saying in order to get this command to work you have to be in the "start paremeter" when i press just start i am in (cmd) system32 window another window pops up "a new window" then i type start\ (with the \ i get my programs folderpops up ready for me to look through the folders okay this is what is happening and has been my problem all along no i thought i did ===================================================== i have my cmd window open and i have my start run "general" open what does not work in one i try the other both know the just the single word notepad nothing else cmd KNOWS start and start\ if i INCLUDE max\ ...........no go nata nota i realized the max\ was to maximize the window unfortunatly this is the amazing thing i can just about tell you what all these commands functions are and i can tell you what the purpose of the folders are for i know you have commands that ASK the computer to preform tasks such as i know fdisk i have used it, that command workd just about anywhere accept the engine of my car. chkdsk i have used it it works at the cmd prompt i know other folders just contain settings or paremeters for programs i have learned way more than i can preform my problem has been like i said all these months i am using the examples to a tee this is another example that if i didn't know just notepad works i would have been here all week making dos disks, booting from a disk, you name it like i spent all day reading external internal commands naturally to me in the med field external is outside the body so i am assuming because the explaination does not take you where they are the system 32 folder and show you them. i assumed they were on a special disk, i made on from the site, i made one from 98 because this disk had no "dos commands" then i find out after two weeks i turn here and i find out xp is not a dos program "THAT WAS A SCREAM" SO ANYWAY YOU GUYS HAVE GOT ME THIS FAR DON'T PITCH IN THE COMPUTER YET. I AM MAKING PROGRESS I HAVE THE COMMANDS WORKING I JUST NEED TO FIGURE OUT HOW TO GET TO THEM FOR INSTANCE IS I TYPE DIR I GET TO LOOK AT THE DIR BUT I CAN'T GET TO THE FILES IN THE DIR. I CAN GET TO THE WINDOWS FOLDER BUT NOT TO ANY OF THE DIRECTORIES I NEED A PUSH WHY WHY NOT JUST TYPE NOTEPAD AND BOOM WHY ALL THE OTHER STUFF IF WOULDN'T HAVE KNOW THE ALTERNATIVE I WOULD BE A MESS RIGHT NOW RUBY Your English is not good enough for us to help you. I AM SORRY ABOUT THE ENGLISH. I AM USED TO WRITING REPORTS(MEDICAL). I AM NOT USED TO ASKING FOR ADVICE IN NOR AM I EQUIPED WITH THE LINGO OF THE COMPUTER WORLD. I WANT TO LEAVE MEDICAL AND START PROGRAMMING. I HAVE MADE A MESS HERE BECAUSE I THINK I AM A GENIUS.?) I COULD ASK FOR HELP IN MEDICAL ABRIEVIATIONS. IT'S HARD FOR ME SPELL. THE MEDICAL PROFESSION WAS TEXT MESSEGING ON PAPER WAY BEFORE COMPUTERS. I WILL GET IN THE GROOVE. I ASSUME YOU CAN UNDERSTAND BECAUSE YOU ARE IN THE COMPUTER WORLD. I HAVE BEEN GETTING AHEAD OF MYSELF AND TEND TO RUN ON. PEOPLE USUALLY DON'T GET BACK TO YOU. I WILL BE MORE BRIEF. AND ASK ONE QUESTION AT A TIME YOU GUYS ARE GOOD ABOUT GETTING BACK TO THOSE WHO ARE LOST. I WAS MERELY, MAKING A POINT ABOVE, FOR THE REASON I COULD NEVER USE MY COMPUTER PROMPT OR THE COMMANDS. I WAS ASKING WHY ALL THE COMMANDS WHEN NOTEPAD WOULD HAVE BEEN SUFFIENT. THANKS FOR TRYING RUBY |
|
| 1889. |
Solve : error message : C2471? |
|
Answer» I got the error message C2471 "cannot update program database" |
|
| 1890. |
Solve : rename files Incrementing by 1? |
|
Answer» i have 2000+ files that i have to rename starting with 001.tif. Can anyone help me please?If you start at 001.tif and you have 3 characters in the filename you will run out at 999.tif. from which position to which position are the hex numbers. The max for a hex number is F. There are G, J, U etc in your file name so they are not hex. Yes, I was wondering about that too. Quote from: Dias de verano on July 02, 2008, 12:04:13 AM Quote from: ghostdog74 on July 01, 2008, 09:19:45 PMwell,maybe you could start the ball rolling without considering whether they are hex numbers. Just a normal file listing will do for a start. I want to know what order he wants the source list to be. I'm not a batch file floozy, I need to be wooed.from which position to which position are the hex numbers. The max for a hex number is F. There are G, J, U etc in your file name so they are not hex. Quote from: Dias de verano on July 02, 2008, 05:48:33 AM I'm not a batch file floozy, I need to be wooed. Post of the year!!! |
|
| 1891. |
Solve : Batch file For loop File in Directory? |
|
Answer» Hi, you really don't like delayed expansion, do you, Sidewinder? !DUE to unforeseen circumstances, the RESPONSE to this post has been delayed! Thanks a lot for the help. It appears to work. I will try and work out what the *censored* all these slashes and such mean at a later date, thanks again. |
|
| 1892. |
Solve : Run bat as admin? |
|
Answer» i have made a bat file, but it requires admin rights. |
|
| 1893. |
Solve : Increment variabile? |
|
Answer» Hi, |
|
| 1894. |
Solve : i want make a simple game in dos? |
|
Answer» http://odn.t35.com/gamelatest REALMS OF *censored* VERSION E beyond roh , wont be done for a while.. but heres a demo, in a moded version of ROH a few new commands, lots more areas.. alot of changes - go back in time - game time - sleep - updated everything - load - 120+ areas - Game reliant on files generated during install. - Generates 120 files originally but in 1 year game time there will be an additional 16000+ per year (game time) - the loop goes to :XILE in every single area now, this made it easyer to add a single line of code for many areas - the if statements have been replaced by a single for statement and a generic file for commands room commands are HANDLED by another file v%rmid% the improvements in this game from the last version make it more playable, there is 3 continents and a castle/homes , i dident add enemys/items but that will be in BEYOND ROH http://odn.t35.com/gamelatest I've been working on simalar lines ~ Here = my atempt: Going Batty ~~~~~~~~~~~ You can write programs on your computer that end with .BAT (short for batch). The following program: cd windows win Would Change the current Directory to windows and then run Windows 3. Just enter both lines into the Edit text editor and save as win.bat. With the echo command you can print to the screen. Would you like an adventure? Here is how to start one: Make a directory called advent md advent Then make a directory called door in it. cd advent md door should do it! Now enter this into the text editor: echo off echo You cannot go this way. Save it as north.bat into the advent directory. For east.bat you could have: echo off echo You see a door and go through it. cd door look So you want pictures! They can be saved as self-extracting files with the Graphwork program but here we shall use a text file. A word processor such as WordPerfect 5.1 has a drawing mode. It is BETTER at making castles as these do not have slopes. Save as a text file called castle.txt. echo You see a beautiful castle! pause cls type castle.txt Will wait for a key press, clear the screen and show your castle. Save it as look.bat We are not stuck with one word commands. The line of a batch file: edit %1 would start edit and it would load the file with the name you gave as a second word. So if we make the file that contains: %1 and call it go.bat we can use go north or go east . Start your adventure in the advent directory and try and find the castle. We can use more than two words and open the door with a key. But that is for next time. Okay, this is a bump but this post fits in the topic. I know I haven't been doing much programming, and I certainly haven't worked on EDS as planned. Now I am finally ready to upload EDS V5. It is still in written with the DOS script, and I'm not sure how pleased anyone will be with this update. Don't expect many new FEATURES or any quests, but theres defanatley some new stuff thrown in it. Heres, a piece from the ReadMe.txt: Quote -IN THIS VERSION- And, well, to actually try stuff out, you will just have to download it I guess. Please tell me what you think. I disparately need ideas for it now. Oh and also, if you have an account already, then the die count thing wont work. Sorry. [recovering disk space -- attachment deleted by admin] |
|
| 1895. |
Solve : need help.? |
|
Answer» i have downloaded bash shell for windows from http://www.steve.org.uk/Software/bash/ "/c: /c: No such file or directory" can any one helps me how it works ?the slash direction in Windows is opposite to Linux Quote the slash direction in Windows is opposite to Linux I know i use the opposite one only , still it returns error. Code: [Select]SHELL = C:\bash\bash.exe test: echo "testing" makefile works well now thanks for the help |
|
| 1896. |
Solve : How To Share Folder in read ONLY in Batch file Support XP? |
|
Answer» How To Share FOLDER in read ONLY in Batch file Support XP |
|
| 1897. |
Solve : Extract strings from inside .txt files? |
|
Answer» Hi, Hi, if %variable% is a line of text, e.g. extracted using FOR, then a substring is defined as %variable:~a,B% where a and b are numbers: a is the offset from the start, [0 is the beginning], and b is the NUMBER of characters. So the first 10 characters would be %variable:~0,10% and the 12 characters starting at position 35 would be %variable:~34,12% |
|
| 1898. |
Solve : MS DOS batch file renaming folder using date? |
|
Answer» How can I get a batch file to rename a folder USING YESTERDAY's date as the new folder name? This must be a homework QUESTION! It seems to be popping up everywhere. |
|
| 1899. |
Solve : COPY,CREATE? |
|
Answer» I've got a big problem: |
|
| 1900. |
Solve : uninstalling.....? |
|
Answer» how to UNINSTALL a PROGRAMME using Ms DOS?echo off |
|