

InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your Microsoft knowledge and support exam preparation. Choose a topic below to get started.
8651. |
Solve : %~dp0? |
Answer» <html><body><p>Hi,<br/><br/>I'm a novice at this at DOS...I'm required about once a year to look at it...so please explain in very simple terms...<br/><br/>I have some code in front of me :<br/>set CONVERT=%~dp0<br/><br/>I've read something about it finding a <a href="https://interviewquestions.tuteehub.com/tag/path-11833" style="font-weight:bold;" target="_blank" title="Click to know more about PATH">PATH</a>...but don't quit follow it...<br/>The .cmd it is part of is in the following folder:<br/>D:\prog\pdms\v10.0\plot\convert<br/><br/>So my first question is what does this do set "CONVERT=%~dp0" ?<br/><br/>- -----------------------------------------------------------------------------<br/><br/>I also have this :<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/call-412416" style="font-weight:bold;" target="_blank" title="Click to know more about CALL">CALL</a> "%TEMP%\%~nx1.pdf.cmd"<br/><br/>I understand the call part and %TEMP% is a stored variable (expanding to a folder)...<br/>It's this part that I don't understand :<br/>\%~nx1.pdf.cmd<br/>There are other .cmd in the folder and I think this is refering to one..<br/>So I think it's only this part that is of interest:<br/>\%~nx1.<br/><br/>- -----------------------------------------------------------------------------<br/><br/>And finally this :<br/>-sOutputFile="%~dpn1.pdf"<br/><br/>Particulaly :<br/>%~dpn1<br/><br/>Hope someone can help<br/><br/>Regards<br/>neil<br/><br/>%0, %1 to %9 are "replaceable parameters". %0 is a special one - it expands to the name of the batch file itself. <br/><br/>%1 is the first parameter passed to the batch file from the command line or from another batch, %2 is the second one, and so on up to %9 (the highest possible).<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/thus-2307358" style="font-weight:bold;" target="_blank" title="Click to know more about THUS">THUS</a> if you type <br/><br/>mybatch.bat cat dog "<a href="https://interviewquestions.tuteehub.com/tag/horse-247371" style="font-weight:bold;" target="_blank" title="Click to know more about HORSE">HORSE</a> and cart" then in mybatch.bat, when it runs, %1 will expand to cat, %2 will expand to dog, and %3 will expand to "horse and cart"<br/><br/>The parameters can be modified using the same variable modifiers as FOR variables, for full documentation see the FOR help which you get by typing FOR /? at the prompt<br/><br/>They relate to files so that if %1 is a filename then %~d1 is a <a href="https://interviewquestions.tuteehub.com/tag/drive-959713" style="font-weight:bold;" target="_blank" title="Click to know more about DRIVE">DRIVE</a> e.g. C: and %~p1 is the path, %~n1 the name, %~x the extension. They can be combined e.g. %~dpnx1<br/><br/>for example %~dp0 contains the drive and path of the batch file itself<br/><br/><br/><br/><br/><br/></p></body></html> | |
8652. |
Solve : Issue with Replacable Parameters? |
Answer» <html><body><p>The batch below is one for a school assignment. <br/><br/>@echo off<br/><br/>echo On %DATE% at %TIME% the %1% drive on the %computername% computer has:<br/>dir |find "bytes free"<br/><br/>Upon execution, everything runs fine.<br/><br/>The only issue I have is with first line at %1%. After that none of my other text <a href="https://interviewquestions.tuteehub.com/tag/appears-881937" style="font-weight:bold;" target="_blank" title="Click to know more about APPEARS">APPEARS</a>, except the %COMPUTERNAME% which executes as "COMPUTERNAME".<br/><br/>I'm guessing there is an issue with the %1%, I'd appreciate the help. @echo off<br/>rem Author: Meagan Parsons<br/>rem Date: 2/10/2011<br/>rem Name: freespace.bat<br/>rem Purpose: <br/><br/>echo On %DATE% at %TIME% the %1% drive on echo the <br/>echo %COMPUTERNAME% computer has<br/><br/>dir |find "bytes free"<br/><br/>I changed it up a bit and <a href="https://interviewquestions.tuteehub.com/tag/got-23540" style="font-weight:bold;" target="_blank" title="Click to know more about GOT">GOT</a> all my <a href="https://interviewquestions.tuteehub.com/tag/information-238790" style="font-weight:bold;" target="_blank" title="Click to know more about INFORMATION">INFORMATION</a> to display. But I'd <a href="https://interviewquestions.tuteehub.com/tag/really-1178981" style="font-weight:bold;" target="_blank" title="Click to know more about REALLY">REALLY</a> like to have the first two lines on 1 line. Is there a limit to the # of parameters/variables I can have on 1 line?<br/>This may help:<br/><br/>Code: <a>[Select]</a>@echo off<br/>for /f "tokens=3" %%i in ('dir %1 ^| find /i "bytes free"') do (<br/> echo On %DATE% at %TIME% the %1 drive on %COMPUTERNAME% computer has %%i bytes free<br/>) <br/><br/>Pass the drive <a href="https://interviewquestions.tuteehub.com/tag/letter-11355" style="font-weight:bold;" target="_blank" title="Click to know more about LETTER">LETTER</a> on the command line. ( Ex. scriptname c: )<br/><br/>Good luck. <br/>Quote from: mparsons12 on February 10, 2011, 07:24:36 AM</p><blockquote>I'm guessing there is an issue with the %1%, I'd appreciate the help.</blockquote><br/>Replaceable parameters only have ONE percent sign, preceding the digit, e.g. %1<br/></body></html> | |
8653. |
Solve : BATCH job failing to start? |
Answer» <html><body><p>I have dozens of batch jobs that <a href="https://interviewquestions.tuteehub.com/tag/run-1192138" style="font-weight:bold;" target="_blank" title="Click to know more about RUN">RUN</a> during the weekend. A lot of them run at the same time.<br/>At the end of each batch job I have the following line:<br/><br/>CALL %BATCH%\SETLEVEL.BAT %ERRLEVEL%<br/><br/>Basically, all jobs call SETLEVEL.BAT which does some cleaning up and stores the error level of the running job in its appropriate log file.<br/><br/>I'm not an expert in <a href="https://interviewquestions.tuteehub.com/tag/operating-1136761" style="font-weight:bold;" target="_blank" title="Click to know more about OPERATING">OPERATING</a> systems but my question is this:<br/><br/>Is it possible that mutliple jobs call SETLEVEL.BAT at the same time but the call fails on one of them? I'm noticing in my log files that the log <a href="https://interviewquestions.tuteehub.com/tag/entries-972860" style="font-weight:bold;" target="_blank" title="Click to know more about ENTRIES">ENTRIES</a> entered by SETLEVEL.BAT are <a href="https://interviewquestions.tuteehub.com/tag/missing-1098377" style="font-weight:bold;" target="_blank" title="Click to know more about MISSING">MISSING</a>. It's as if some jobs don't make the call above. Yet, the operating system shows no error message anywhere.<br/><br/>Thanks !<br/><br/><br/>add a pause command at the end and tell me if there are any errors and tell me if any close post the code for all the ones that <a href="https://interviewquestions.tuteehub.com/tag/fall-772292" style="font-weight:bold;" target="_blank" title="Click to know more about FALL">FALL</a> under that category and post the code for SETLEVEL.BAT</p></body></html> | |
8654. |
Solve : Using AND condition in DOS script causes trouble.? |
Answer» <html><body><p>In a batch file I have <br/><br/>findstr SWITCHIDENTITY rf_monitor.out >nul 2>&<a href="https://interviewquestions.tuteehub.com/tag/amp-363144" style="font-weight:bold;" target="_blank" title="Click to know more about AMP">AMP</a>;<a href="https://interviewquestions.tuteehub.com/tag/1-236780" style="font-weight:bold;" target="_blank" title="Click to know more about 1">1</a> && <a href="https://interviewquestions.tuteehub.com/tag/set-11758" style="font-weight:bold;" target="_blank" title="Click to know more about SET">SET</a> IDENTITY_FOUND=true<br/>findstr SWITCHUTILITY rf_monitor.out >nul 2>&1 && set UTILITY_FOUND=true<br/>findstr "GP Manager connection successful" rf_monitor.out >nul 2>&1 && set GPMANAGER_FOUND=true<br/><br/>With echo on, below is what I see<br/><br/>D:\cvstags\trunk\regfortcms\install\win\scripts>findstr SWITCHIDENTITY rf_monito<br/>r.out 1>nul 2>&1 && set IDENTITY_FOUND=true<br/><br/>D:\cvstags\trunk\regfortcms\install\win\scripts>findstr SWITCHUTILITY rf_monitor<br/>.out 1>nul 2>&1 && set UTILITY_FOUND=true<br/><br/>D:\cvstags\trunk\regfortcms\install\win\scripts>findstr "GP Manager connection s<br/>uccessful" rf_monitor.out 1>nul 2>&1 && set GPMANAGER_FOUND=true<br/>**&& was unexpected at this time.**<br/><br/>Why do I get that && was unexpected at this time? If I type the three commands myself on the DOS prompt I don't get any such message. Please advice.<br/>--------, the error message had been not about the lines I posted but about my usage of && in an IF condition. It seems that I have to use like IF condition1 IF condition2 .<br/><br/><br/><em>Keep it clean...we have Members of all <a href="https://interviewquestions.tuteehub.com/tag/ages-851586" style="font-weight:bold;" target="_blank" title="Click to know more about AGES">AGES</a> here.</em>you could always use the <a href="https://interviewquestions.tuteehub.com/tag/xif-2340642" style="font-weight:bold;" target="_blank" title="Click to know more about XIF">XIF</a> utillity i created but and is just IF A IF B</p></body></html> | |
8655. |
Solve : Search for multiple strings using batch? |
Answer» <html><body><p>I have the following code<br/>Code: <a>[Select]</a>@echo off<br/><br/>if not exist <a href="https://interviewquestions.tuteehub.com/tag/f-236701" style="font-weight:bold;" target="_blank" title="Click to know more about F">F</a>:\acad\%2\nul goto error2<br/>if "%1"=="" goto error<br/>if "%2"=="" goto error<br/>echo. Search results for all <a href="https://interviewquestions.tuteehub.com/tag/raw-613057" style="font-weight:bold;" target="_blank" title="Click to know more about RAW">RAW</a> data files: &<a href="https://interviewquestions.tuteehub.com/tag/gt-249387" style="font-weight:bold;" target="_blank" title="Click to know more about GT">GT</a>;c:\survey\null.<br/>FOR %%F IN (f:\acad\%2\*.%2) DO FIND "5=%1" %%F >>C:\SURVEY\NULL.<br/>FOR %%F IN (f:\acad\%2\*.%2) DO FIND "PT%1" %%F >>C:\SURVEY\NULL.<br/>FOR %%F IN (f:\acad\%2\*T.%2) DO FIND "%1," %%F >>C:\SURVEY\NULL.<br/>echo. >>c:\survey\null.<br/>echo. GPS file search results: >>c:\survey\null.<br/>FOR %%F IN (f:\acad\%2\GPS*.%2) DO FIND "%1," %%F >>C:\SURVEY\NULL.<br/>echo. >>c:\survey\null.<br/>echo. TFR file search results: >>c:\survey\null.<br/>FOR %%F IN (f:\acad\%2\T*.%2) DO FIND "--%1" %%F >>C:\SURVEY\NULL.<br/>echo.<br/>CALL LN<br/>REM echo. Type "LN" to view results.<br/>echo.<br/>goto end<br/><br/>:error<br/>echo.<br/>echo. **********************************************************************<br/>echo. ***** USAGE: FINDPT [point number] [job] ******<br/>echo. ***** EXAMPLE: To find point number 1254 in job number 511, ******<br/>echo. ***** type "FINDPT 1254 511" followed by [RETURN]. ******<br/>echo. **********************************************************************<br/>echo.<br/>goto end<br/><br/>:error2<br/>echo.<br/>echo. Invalid syntax, or directory "%2" does not exist.<br/>goto error<br/><br/>:end<br/><br/>It works, but, it repeats the files it searches in for strings "5=%1", "PT%1", and "%1," so it makes my results list three <a href="https://interviewquestions.tuteehub.com/tag/time-19467" style="font-weight:bold;" target="_blank" title="Click to know more about TIME">TIME</a> longer than it needs to be. How can I search for multiple strings with out it <a href="https://interviewquestions.tuteehub.com/tag/displaying-2059353" style="font-weight:bold;" target="_blank" title="Click to know more about DISPLAYING">DISPLAYING</a> the files searched three times?so what do you want show the output and show the supposed output<br/></p></body></html> | |
8656. |
Solve : .bat that translates custom code to words? |
Answer» <html><body><p>This sounds like <a href="https://interviewquestions.tuteehub.com/tag/one-241053" style="font-weight:bold;" target="_blank" title="Click to know more about ONE">ONE</a> of the earliest "secret codes" ever used, the substitution code. The Roman emperor Julius Caesar who died in the year 44 BC used such a code, which is named after him. The problem you are going to have is that you seem to want to make letters of the alphabet into numbers, and there are 26 letters in the alphabet but only 10 digits (0 to 9), so you cannot have a simple one-to-one translation. You <a href="https://interviewquestions.tuteehub.com/tag/could-410026" style="font-weight:bold;" target="_blank" title="Click to know more about COULD">COULD</a> encode each letter of the alphabet into a two digit number, but you are going to run into all kinds of problems if you have some one and some two-digit numbers, as some people have already pointed out. Also batch scripting is about the worst language I can think of for doing this. A "scrambled alphabet" type of code is quite simple to implement in batch, but the code is not <a href="https://interviewquestions.tuteehub.com/tag/beginner-389979" style="font-weight:bold;" target="_blank" title="Click to know more about BEGINNER">BEGINNER</a>'s level.<br/><br/><a href="https://en.wikipedia.org/wiki/Substitution_cipher">http://en.wikipedia.org/wiki/Substitution_cipher</a><br/><br/>Code: <a>[Select]</a>@echo off<br/>setlocal ENABLEDELAYEDEXPANSION<br/>set /p c=enter number sequence: <br/>set c1=%c:~0,1%<br/>if not %c1%==, set c=,%c%<br/>set d=%c:,26=z%<br/>set d=%d:,25=y%<br/>set d=%d:,24=x%<br/>set d=%d:,23=w%<br/>set d=%d:,22=v%<br/>set d=%d:,21=u%<br/>set d=%d:,20=t%<br/>set d=%d:,19=s%<br/>set d=%d:,18=r%<br/>set d=%d:,17=q%<br/>set d=%d:,16=p%<br/>set d=%d:,15=o%<br/>set d=%d:,14=n%<br/>set d=%d:,13=m%<br/>set d=%d:,12=l%<br/>set d=%d:,11=k%<br/>set d=%d:,10=j%<br/>set d=%d:,9=i%<br/>set d=%d:,8=h%<br/>set d=%d:,7=g%<br/>set d=%d:,6=f%<br/>set d=%d:,5=e%<br/>set d=%d:,4=d%<br/>set d=%d:,3=c%<br/>set d=%d:,2=b%<br/>set d=%d:,1=a%<br/>echo %d%<br/>pause<br/>Quote</p><blockquote>setlocal ENABLEDELAYEDEXPANSION</blockquote><br/>What does this line do?<br/><br/>also...<br/><br/>Code: <a>[Select]</a>C:\Batch>test1.bat<br/>enter number sequence:12<br/>'c' is not recognized as an internal or external command,<br/>operable program or batch file.<br/>12the set local was copied/pasted from my template forgot to remove it anyways the fixed code is<br/>Code: <a>[Select]</a>@echo off<br/>set /p c=enter number sequence: <br/>set /a c1=%c:~0,1%<br/>if not %c1%==- set c=-%c%<br/>rem debug line echo %c% %c1%<br/>set d=%c:-26=z%<br/>set d=%d:-25=y%<br/>set d=%d:-24=x%<br/>set d=%d:-23=w%<br/>set d=%d:-22=v%<br/>set d=%d:-21=u%<br/>set d=%d:-20=t%<br/>set d=%d:-19=s%<br/>set d=%d:-18=r%<br/>set d=%d:-17=q%<br/>set d=%d:-16=p%<br/>set d=%d:-15=o%<br/>set d=%d:-14=n%<br/>set d=%d:-13=m%<br/>set d=%d:-12=l%<br/>set d=%d:-11=k%<br/>set d=%d:-10=j%<br/>set d=%d:-9=i%<br/>set d=%d:-8=h%<br/>set d=%d:-7=g%<br/>set d=%d:-6=f%<br/>set d=%d:-5=e%<br/>set d=%d:-4=d%<br/>set d=%d:-3=c%<br/>set d=%d:-2=b%<br/>set d=%d:-1=a%<br/>echo %d%<br/>pauseQuote from: Salmon Trout on February 12, 2011, 04:17:24 AM<blockquote>You could encode each letter of the alphabet into a two digit number</blockquote><br/>Code: <a>[Select]</a>@echo off<br/><br/>set input=MARY HAD A LITTLE LAMB<br/><br/>REM Encode<br/>set output=<br/>rem loop through the string<br/>set j=0<br/>:Loop1<br/> call set inchar=%%input:~%j%,1%%<br/> if "%inchar%"=="" goto ExitLoop1<br/> IF "%inchar%"=="A" set outchar=01<br/> IF "%inchar%"=="B" set outchar=02<br/> IF "%inchar%"=="C" set outchar=03<br/> IF "%inchar%"=="D" set outchar=04<br/> IF "%inchar%"=="E" set outchar=05<br/> IF "%inchar%"=="F" set outchar=06<br/> IF "%inchar%"=="G" set outchar=07<br/> IF "%inchar%"=="H" set outchar=08<br/> IF "%inchar%"=="I" set outchar=<a href="https://interviewquestions.tuteehub.com/tag/09-256415" style="font-weight:bold;" target="_blank" title="Click to know more about 09">09</a><br/> IF "%inchar%"=="J" set outchar=10<br/> IF "%inchar%"=="K" set outchar=11<br/> IF "%inchar%"=="L" set outchar=12<br/> IF "%inchar%"=="M" set outchar=13<br/> IF "%inchar%"=="N" set outchar=14<br/> IF "%inchar%"=="O" set outchar=15<br/> IF "%inchar%"=="P" set outchar=16<br/> IF "%inchar%"=="Q" set outchar=17<br/> IF "%inchar%"=="R" set outchar=18<br/> IF "%inchar%"=="S" set outchar=19<br/> IF "%inchar%"=="T" set outchar=20<br/> IF "%inchar%"=="U" set outchar=21<br/> IF "%inchar%"=="V" set outchar=22<br/> IF "%inchar%"=="W" set outchar=23<br/> IF "%inchar%"=="X" set outchar=24<br/> IF "%inchar%"=="Y" set outchar=25<br/> IF "%inchar%"=="Z" set outchar=26<br/> IF "%inchar%"==" " set outchar=27<br/> set output=%output%%outchar%<br/> set /a j=%j%+1<br/> goto Loop1<br/>:ExitLoop1<br/>echo (1) Encode a message<br/>echo Plain text input %input%<br/>echo Encoded output %output%<br/><br/>Rem decode<br/>set input=%output%<br/>set output=<br/>rem loop through the string<br/>set j=0<br/>:Loop2<br/> call set inchar=%%input:~%j%,2%%<br/> if "%inchar%"=="" goto ExitLoop2<br/> IF "%inchar%"=="01" set outchar=A<br/> IF "%inchar%"=="02" set outchar=B<br/> IF "%inchar%"=="03" set outchar=C<br/> IF "%inchar%"=="04" set outchar=D<br/> IF "%inchar%"=="05" set outchar=E<br/> IF "%inchar%"=="06" set outchar=F<br/> IF "%inchar%"=="07" set outchar=G<br/> IF "%inchar%"=="08" set outchar=H<br/> IF "%inchar%"=="09" set outchar=I<br/> IF "%inchar%"=="10" set outchar=J<br/> IF "%inchar%"=="11" set outchar=K<br/> IF "%inchar%"=="12" set outchar=L<br/> IF "%inchar%"=="13" set outchar=M<br/> IF "%inchar%"=="14" set outchar=N<br/> IF "%inchar%"=="15" set outchar=O<br/> IF "%inchar%"=="16" set outchar=P<br/> IF "%inchar%"=="17" set outchar=Q<br/> IF "%inchar%"=="18" set outchar=R<br/> IF "%inchar%"=="19" set outchar=S<br/> IF "%inchar%"=="20" set outchar=T<br/> IF "%inchar%"=="21" set outchar=U<br/> IF "%inchar%"=="22" set outchar=V<br/> IF "%inchar%"=="23" set outchar=W<br/> IF "%inchar%"=="24" set outchar=X<br/> IF "%inchar%"=="25" set outchar=Y<br/> IF "%inchar%"=="26" set outchar=Z<br/> IF "%inchar%"=="27" set "outchar= "<br/> set output=%output%%outchar%<br/> set /a j=%j%+2<br/> goto Loop2<br/>:ExitLoop2<br/>echo.<br/>echo (2) Decode a message<br/>echo Encoded input %input%<br/>echo Plain text output %output% <br/><br/><br/>Code: <a>[Select]</a>(1) Encode a message<br/>Plain text input MARY HAD A LITTLE LAMB<br/>Encoded output 13011825270801042701271209202012052712011302<br/><br/>(2) Decode a message<br/>Encoded input 13011825270801042701271209202012052712011302<br/>Plain text output MARY HAD A LITTLE LAMB</body></html> | |
8657. |
Solve : batch processes...? |
Answer» <html><body><p>Hello, I am a semi-newbie to DOS command prompt. <br/><br/>I have a <a href="https://interviewquestions.tuteehub.com/tag/program-246414" style="font-weight:bold;" target="_blank" title="Click to know more about PROGRAM">PROGRAM</a> "A.exe" that reads commands and data from a pre-existing text file called "input_1.txt". <br/>This produces an output file, called "out_1.txt"<br/><br/>This is what I manually type at the command prompt if I just want to do one step<br/>(for example, provide "input_1.txt" to "A.exe", which results in "out_1.txt" as output: <br/><br/><strong>C:\> A.exe input_1.txt > out_1.txt</strong><br/><br/>I want to run a bunch of these, one at a time (up to, say, "<strong>A.exe input_99 > out_99.txt</strong>") <br/>Note: each process takes about 1 hour of computing time. <br/><br/>How can I automate this process, so that I don't have to manually type commands at the prompt for each of the 99 steps?<br/>Please help this 'newbie' !!!<br/><br/><br/> Ok, This batch file presumes all your files are named input_something, where something is a number going from 1-99<br/><br/>Code: <a>[Select]</a>@echo off<br/>set num=1<br/>:A<br/>A.exe input_%num%.txt > out_%num%.txt<br/>set /a num=%num%+1<br/>if %num% EQU 100 goto B<br/>goto A<br/>:B<br/>exit<br/><br/>there are more elegant ways to do this, using the for command, but this is easy to <a href="https://interviewquestions.tuteehub.com/tag/understand-720010" style="font-weight:bold;" target="_blank" title="Click to know more about UNDERSTAND">UNDERSTAND</a> for you, and easy modifiable Code: <a>[Select]</a>@echo off<br/>setlocal enabledelayedexpansion<br/>set /p start="<a href="https://interviewquestions.tuteehub.com/tag/first-461760" style="font-weight:bold;" target="_blank" title="Click to know more about FIRST">FIRST</a> number ? "<br/>set /p finish="last number ? "<br/>set step=1<br/>for /l %%<a href="https://interviewquestions.tuteehub.com/tag/n-236724" style="font-weight:bold;" target="_blank" title="Click to know more about N">N</a> in (%start%,%step%,%finish%) do (<br/> echo !date! !time! start processing input_%%N.txt<br/> A.exe input_%%N.txt > out_%%N.txt<br/> )<br/>echo Finished processing<br/>echo.<br/>pause<br/> <br/><br/><a href="https://interviewquestions.tuteehub.com/tag/like-537196" style="font-weight:bold;" target="_blank" title="Click to know more about LIKE">LIKE</a> i said, more elegant ways, tnx salmon</p></body></html> | |
8658. |
Solve : commanline argument to extract an excel sheet into another file? |
Answer» <html><body><p>I want to create a batch file that extracts an excel <a href="https://interviewquestions.tuteehub.com/tag/sheet-630706" style="font-weight:bold;" target="_blank" title="Click to know more about SHEET">SHEET</a> and put it into another new file. Please HELP Thank youThere is no BAT command that does that.Per se.<br/>Are you <a href="https://interviewquestions.tuteehub.com/tag/already-1974237" style="font-weight:bold;" target="_blank" title="Click to know more about ALREADY">ALREADY</a> familiar with this?<br/><a href="https://office.microsoft.com/en-us/excel-help/command-line-switches-for-excel-HA010158030.aspx">http://office.microsoft.com/en-us/excel-help/command-line-switches-for-excel-HA010158030.aspx</a><br/>Do you <a href="https://interviewquestions.tuteehub.com/tag/know-534065" style="font-weight:bold;" target="_blank" title="Click to know more about KNOW">KNOW</a> how to create a start-up command that will <a href="https://interviewquestions.tuteehub.com/tag/make-249948" style="font-weight:bold;" target="_blank" title="Click to know more about MAKE">MAKE</a> Excel load a file and export the content?</p></body></html> | |
8659. |
Solve : Userprofile desktop folder contents? |
Answer» <html><body><p>Hello CH members<br/><br/>Im currently writing a <a href="https://interviewquestions.tuteehub.com/tag/simple-1208262" style="font-weight:bold;" target="_blank" title="Click to know more about SIMPLE">SIMPLE</a> batch file with the below two lines for now:<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a>: <a>[Select]</a>@echo off<br/>DIR C:\temp1%1 /s > output.txt<br/><br/>Yes very simple indeed. My purpose though is getting the folder contents of a user profile folder under c:\documents and settings\%USERPROFILE%\Desktop folder. <br/><br/>The 20 machines I am trying to output from have different usernames, is there a global string which can be used to suit the purpose of this batch file.<br/><br/>Could anyone please help with the above?This may help:<br/><br/>Code: <a>[Select]</a>dir "%userprofile%\desktop" /s > output.txt<br/><br/>%userprofile% should expand to C:\Documents and Settings\<em>UserName</em><br/>The quotes are for the embedded spaces<br/><br/>Good luck. Thanks SW worked a treat. Heres the full batch script for, somenoe might find it useful<br/><br/>Code: <a>[Select]</a><br/> for /f "tokens=1" %%a in (myList.txt) do (<br/> ECHO -----------------------------------------<br/> ECHO %%a<br/> ECHO ----------------------------------------- <br/> ECHO Searching for files... %%a <br/> start rclient %%a /R dir "%userprofile%\desktop" /s > c:\output.txt<br/> REM <br/> <br/> )<br/><br/>Modify the myList.txt with the list of machines your to <a href="https://interviewquestions.tuteehub.com/tag/connect-11879" style="font-weight:bold;" target="_blank" title="Click to know more about CONNECT">CONNECT</a> to.A little more to my question, I have successfully used the batch to search userprofiles on user PC's, I need now to figure out how to check the servers. <br/><br/>I cannot simply user the %USERPROFILE%\Desktop variable because these folders are located under c:\documents and settings\username\desktop.<br/><br/>Using c:\documents and settings\%USERPROFILE%\Desktop returns a blank output.<br/><br/>Any suggestions on how I could do this?I should really clarify my response... <br/><br/>Using the %userprofile%\desktop variable return contents of C:\documents and settings\Username\desktop on a PC but does not output the folder contents when running the batch file on a server.how about? Code: <a>[Select]</a>"c:\documents and settings\%username%\Desktop"Quote from: mat123 on February 11, <a href="https://interviewquestions.tuteehub.com/tag/2011-290379" style="font-weight:bold;" target="_blank" title="Click to know more about 2011">2011</a>, 12:35:32 PM</p><blockquote>how about? Code: <a>[Select]</a>"c:\documents and settings\%username%\Desktop"</blockquote><br/>Thanks mat123, this was the second variable I tried after %userprofile% and the output file is blank. So Im not sure why this wouldnt work on the server but works on the PC.<br/>Cd "c:\documents and settings\%username%\Desktop"<br/>Dir<br/>Pause<br/>I have tried the below and only gives the output of the folder the batch file executes in. e.g. c:\test<br/><br/>Code: <a>[Select]</a>start rclient %%a /R DIR Pause cd "c:\documents and settings\%username%\Desktop" /s > c:\test\output.txtRemove pause and cd from that and try againThe output file is the same... blank. I can do this for folders outside of documents and settings, Im beginning to think this could have a security restiction even though I have <a href="https://interviewquestions.tuteehub.com/tag/administrative-850216" style="font-weight:bold;" target="_blank" title="Click to know more about ADMINISTRATIVE">ADMINISTRATIVE</a> rights from the account Im using.</body></html> | |
8660. |
Solve : Fat 32 partition not visible in DOS? |
Answer» <html><body><br/>Quote from: Geek-9pm on February 13, 2011, 12:44:51 AM<blockquote>No mention of 'drive overlay' in this KB.<a href="https://support.microsoft.com/kb/126855">http://support.microsoft.com/kb/126855</a><br/></blockquote>look for: "Real-Mode Driver Support for Translation" That's a drive overlay.<br/><br/><br/>Quote<blockquote>The IDE interface allows 65,536 cylinders, 16 heads, and 255 sectors</blockquote><br/>Yes, it does- using the CHS access method. Thus the reason CHS was dumped for LBA around 1993.<br/>Quote<blockquote>32-bit disk access</blockquote>This is not the least bit relevant. Windows 95 and 98 will be using "32-bit disk access" by default anyway, so that only applies to windows for workgroups anyway. And wether the driver that interfaces with the IDE controller is running in real mode or protected mode is redundant.<br/>Quote<blockquote>28-bit logical block address</blockquote>WHy would I search for that? That pretty much PROVES that it doesn't have 48-bit LBA, which is going to be needed for very large drives on any operating system, regardless of your whimsical <a href="https://interviewquestions.tuteehub.com/tag/fantasies-984544" style="font-weight:bold;" target="_blank" title="Click to know more about FANTASIES">FANTASIES</a> regarding how SATA has these superpowers to circumvent software limitations.<br/><br/>SATA is compatible with PATA at the software level. Windows98 Doesn't support SATA normally, so you have to set it to compatible, so now the software sees it as a IDE controller. And get this-<br/><br/>IT ACTS LIKE AN IDE CONTROLLER.<br/><br/>it doesn't magically provide access to more of the drive then an equivalent PATA drive, And a normal PATA drive is no more restricted in size then a SATA drive. they both use the same ATA protocol, one just happens to transmit the data serially rather then via a parallel cable. If you choose to believe that transferring data serially as opposed to in parallel instills the device with which it is used with the magical power to manipulate software that is using it so that it supports 48-bit LBA, then go ahead, but please don't spread such nonsense if you can <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a> it.<br/><br/>Quote<blockquote>Using MS-DOS with a very large drive is NOT recommended. </blockquote>Of course it isn't. older software is simply not going to be compatible with newer hardware, without additional drivers. I'm curious, though, weren't you <em>just saying</em> that using the new hardware (SATA) would give the drive magical powers to circumvent the limitations of the software? So am I correct to believe that using MS-DOS with a very large drive is NOT recommended, except in those cases where they have a SATA drive because SATA has whimsical powers beyond comprehension?<br/><br/><br/>Quote<blockquote><em>Please don't ask why, I am getting tired of this. </em><br/></blockquote>That's what you said, but I heard this:<br/>Quote<blockquote>I am right and you are wrong, I am singing the I am right song<br/>ad infinitum...<br/></blockquote>Asserting you know what you are talking about doesn't make it so. Asserting that 32-bit disk access makes a difference is contrary to the fact that it doesn't. Saying that SATA has whimsical abilities beyond standard PATA is utter and complete nonsense that you most likely just made up on the spot.<br/><br/>Quote<blockquote>But if you can provide a real-world case were ... <br/></blockquote>SATA and PATA and CHS and LBA all work the same. I don't need to quote a real world case for you to know that if you drop a apple, it will fall. People saying that I, or anybody else, needs to provide a real world case to prove their assertions wrong have gotten the ball mixed up; especially in cases of Occam's Razor like claiming that SATA has superpowers.<br/><br/><br/>Anyway, in conclusion, it's also rather silly to think any of that matters since their first drive, which is also far larger then the 504MB, works fine and can be accessed fine, so congratulations on managing to somehow find a completely irrelevant article and asserting it has something to do with the problem when it doesn't)I am right and you are wrong. Please don't take it personally.<br/><br/>Using a SATA interface will allow Windows 98 SE to read a drive larger than 128 GB (137GB). However, the utilities written for MS-DOS will or will not work right. <br/><br/>The problem is that you have not idea of what you are talking about and you write a bunch of nonsense and insist that it is so because you say it is.<br/><br/>The reference to 32 bit was not to memory. It was to the four byte entries that the OS has for the hard drive. Those four bytes are given to a driver that talks to the hardware and translates drive address to a data stream that conforms to some IDE protocol.<br/><br/>The older IDE protocol was not expendable in a simple manner. The new protocol had to be backward compatible, yet allow addressing above 28 bits. They choose 48 bit so they will never have to do it again. But 40 bit would have been enough.<br/><br/>The hardware protocol for PATA was set before the SATA was made. The 28 bit structure was not made to be extended. So a the designers hard to do a workaround. Windows 98 used a 32 bit reference for the location of sectors on the hard drive. But the driver, which was not in the kernel, could only use the 28 bits to interface with the IDE. If it had been a 32 bit protocol instead of 28 bit, Windows 98 <strong>atapi driver</strong> would have been able to use drives beyond 2 terabytes.<br/><br/>The old atapi driver can only use 28 bits because that was the standard protocol at the time. Do some reading on the 28 bit stuff please. <a href="https://en.wikipedia.org/wiki/Parallel_ATA">http://en.wikipedia.org/wiki/Parallel_ATA</a><br/><br/>Do the math. it is 2^32 x 512 which is way beyond 128 GB. When they did the first IDE protocol, somebody reasoned that was absurd, and cut it down to 28 bits. <em>I could not find who that guy was. Maybe he lives on an island now.</em><br/><br/>I am not trying to hard on you. It is understandable that some people can not do arithmetic unless they have a calculator at hand.<br/><br/>It is now Sunday morning and I am awake now, so watch out. I am onto you!<br/>Wow, BC_P and Geek-9PM duking it out! This is better than Torchwood! I thought that although SATA electronics and connectors differ from Parallel ATA, the technology is software compatible and OS transparent. I await developments...<br/><br/>There are millions, if not thousands of posts where many have used SATA with Windows 98SE. It is very clear there are doing it. Many BC has trouble understand plain language without a lot of computer federalism.<br/><br/>Here are just two:<br/>Quote<blockquote>PostPosted: Sun Nov 05, 2006 10:11 pm Post subject: Re: 98SE with SATA? [Login to view extended thread Info.] <br/>I just set up a new computer with a SATA HD and Windows 98/SE.<br/>SE didn't care a bit. I had absolutely NO problem with it till I tried to upgrade to XP pro. To load XP-Pro, I had to use the SATA driver disk that came with the mobo. XP can be such a pain in the Bxxx!<br/>But, yes, 98/SE ran just great on the SATA drive.<br/>Shadow Cool<br/></blockquote>Quote<blockquote>graveur sata<br/>DAN posted on Monday, April 19, 2010 3:52 AM<br/>Bonjour a tous.<br/>je viens d'installer sur ma machine un graveur dvd Sata.<br/>malheureusement win 98 lui ne semble pas reconaitre mon lecteir dvd!<br/>qu'en pensez vous et auriez vous une solution a me proposer?<br/>D'avance merci de votre aide.i<br/>=========<br/>Bonsoir<br/>Peut-?tre avec un convertisseur SATA / IDE :<br/><a href="http://www.ldlc.com/fiche/PB00071913.html">http://www.ldlc.com/fiche/PB00071913.html</a><br/><a href="http://www.ldlc.com/articles/AL00000018-1/ide-2-sata-kit.html">http://www.ldlc.com/articles/AL00000018-1/ide-2-sata-kit.html</a><br/>Mais pas test? sur W98<br/>Herser<br/></blockquote>How this helps.<br/>The finer details of this 'discussion' are not within my grasp but I do believe the moral of the story is. Old stuff has trouble with new stuff and when playing in such waters one is bound to run into limitations. With the hodge podge of technology we have inherited there will be many unique circumstances where limitations arise. Since hardware is set in stone(unless you are rich) the mobo and BIOS limitations are highly inflexible our main source of possible solutions is in advanced software. Thus, out with Win98 DOS and in with whatever I can find that works. In my case the way I can to do my HD maintenance outside of the XP environment is with the software provided by Terabyte. I am sure there are other options but at this point my needs are filled. <br/><br/>As time permits I may experiment with things like freeDOS, linux and proper multibooting. If any of you want to see the nitty gritty of the investigation that went on to help me get up and running imaging partitions outside of XP on large HDs have a read at:<br/><br/><a href="http://radified.com/cgi-bin/yabb2/YaBB.pl?num=1297230229/0">http://radified.com/cgi-bin/yabb2/YaBB.pl?num=1297230229/0</a><br/><br/>Cheers all and thanks for your inputs.Quote from: Geek-9pm on February 13, 2011, 11:06:50 AM<blockquote>I am right and you are wrong. Please don't take it personally.<br/></blockquote>Extraordinary claims require extraordinary evidence. Stating "SATA has whimsical pixie powers to overcome Software limitations" is extraordinary. Saying that "despite what microsoft says, 32-bit disk access uses a secret method of drive communication that enables larger hard drives to be accessed" is an extraordinary claim. You provide no evidence at all, let alone extraordinary evidence. In fact, you go so far as to assert that anybody else would have to prove <em>you </em> wrong by citing real world cases, something which you yourself did not do.<br/>Quote<blockquote>Using a SATA interface will allow Windows 98 SE to read a drive larger than 128 GB (137GB). However, the utilities written for MS-DOS will or will not work right. </blockquote>No. It will not. SATA is ATA is IDE and windows98 accesses a SATA drive in the exact same way and that SATA drive reacts to windows the exact same way an IDE drive would.<br/><br/>Quote<blockquote>The problem is that you have not idea of what you are talking about and you write a bunch of nonsense and insist that it is so because you say it is.<br/></blockquote>That's what you're doing, actually. What you are doing is providing links to wholly irrelevant articles (like that one saying how to get large hard drive support in older versions of windows, that means, support for drives larger then 504MB, a barrier which the OP has clearly had no problem getting around since their primary drive is accessed fine.<br/>Quote<blockquote>The reference to 32 bit was not to memory. It was to the four byte entries that the OS has for the hard drive. Those four bytes are given to a driver that talks to the hardware and translates drive address to a data stream that conforms to some IDE protocol.<br/></blockquote>again, 32-bit disk access <a href="https://interviewquestions.tuteehub.com/tag/refers-248941" style="font-weight:bold;" target="_blank" title="Click to know more about REFERS">REFERS</a> to the fact that the driver runs in protected mode. it doesn't use some magical 32-bit LBA access method nor would storing "sector counts" (regardless of the size of the field) allow access to exterior portions of the drive.<br/><br/>Quote<blockquote>The hardware protocol for PATA was set before the SATA was made. The 28 bit structure was not made to be extended. </blockquote><br/>ATA-1 didn't even have LBA. You can't explain that. <br/><br/>Quote<blockquote>So a the designers hard to do a workaround. Windows 98 used a 32 bit reference for the location of sectors on the hard drive. </blockquote>No. It doesn't. there wasn't an LBA beyond 28-bit when windows98 was created, so you are talking out your *censored*.<br/><br/>Quote<blockquote>Do the math. it is 2^32 x 512 which is way beyond 128 GB. When they did the first IDE protocol, somebody reasoned that was absurd, and cut it down to 28 bits. <em>I could not find who that guy was. Maybe he lives on an island now.</em><br/></blockquote>repeat after me- 32-bit disk access refers to the CPU operating mode that the driver runs in. THAT IS IT. in fact, that is EXACTLY what microsoft says in regard to 32-bit disk access:<br/><br/>Quote<blockquote>32-bit disk access (32BDA), also known as FastDisk, is a set of protected-mode drivers that direct int13 calls to the hard disk controller through a protected mode interface. For the latter the hard disk controller has to supply an appropriate virtual device driver (VxD).<br/><br/>Windows ships with one such driver <a href="https://interviewquestions.tuteehub.com/tag/built-245060" style="font-weight:bold;" target="_blank" title="Click to know more about BUILT">BUILT</a> in: *wdctrl. Unfortunately, this device only supports controllers that are strictly compatible with the WD1003 standard; this excludes SCSI, ATA-2, LBA or CHS translation, disks with more than 1024 cylinders and even some commonplace features of ATA such as block mode. If it detects one of these during the initialization phase it will refuse to load. In today's computers, this means that *wdctrl will rarely do the job and an external VxD must be used.<br/><br/>32BDA has two advantages over disk access through the BIOS. First, since the FastDisk VxD is re-entrant, it enables Windows to use virtual memory for DOS sessions. Using virtual memory without 32BDA could create a deadlock situation if a page fault is generated during the execution of BIOS routines. Since the BIOS is not re-entrant, it is not possible to use a BIOS call to read the page from disk until the first BIOS call has terminated; on the other hand, this BIOS thread must remain suspended until the swapped out page has been read.<br/><br/>So 32BDA enables Windows to manage memory much more efficiently with one or more DOS sessions open.<br/><br/>The second advantage of 32-bit disk access is that it saves two (relatively slow) switches between virtual and protected mode per disk I/O call. Take, for instance, a disk read performed by a DOS application. In the absence of 32BDA, each such call causes the following sequence of events:<br/><br/>1 Application calls INT21 to read from disk<br/>2 Windows traps the call, switches to protected mode<br/>3 Windows switches to real mode, returns to DOS<br/>4 DOS makes int13 call to BIOS disk routines<br/>5 Windows traps the call, switches to protected mode<br/>6 Windows switches to real mode, returns to BIOS<br/>7 BIOS acts upon int13 call and does the read<br/>8 Windows traps the return from int13, switches to PM<br/>9 Windows switches to RM, returns the result to DOS<br/>10 DOS receives the result, passes on to application<br/>11 Windows traps the return from DOS, switches to PM<br/>12 Windows switches to RM, returns result to application<br/>13 Application receives the result from the INT21 call<br/><br/>Using 32-bit disk access replaces steps 6 to 8 by a single call to the FastDisk VxD. This removes two mode switches, resulting in a usually small disk performance improvement. (Steps 3-11 also apply to native Windows applications).<br/></blockquote>Right, they just "forgot" the third point "oh yeah and even though we just said it didn't support LBA addressing at all, it totally does and it uses sector counts to do it and other stuff, so you just have to go all 2 to the power of 32 and you gots your max cluster addressing.<br/><br/>You can't just go around adding a few bit widths here and assuming that if something is 32-bit it enables some other unrelated 32-bit access mode. By the same token I may as well say that running a 32-bit application and a 16-bit application enabled 48-bit LBA- right, since 32-bit +16-bit is 48. or that running two 32-bit applications at once gives your CPU 64-bit instructions, and then if you run a 16-bit program you get 48-bit LBA (64-16). but don't try to access a drive using fat32, because then you will be back to to normal 16-bit access (48-32=16)<br/><br/>I know how to do math, I also know that providing 2 to the power of arbitrary numeric designations, particularly when those designations refer explicitly to the CPU operating mode, is completely redundant and hardly constitutes a claim of any sort.<br/><br/>Quote<blockquote>I am not trying to hard on you. It is understandable that some people can not do arithmetic unless they have a calculator at hand.</blockquote>32-bit disk access runs in 32-bit protected mode.<br/><br/>That is why it's called 32-bit disk access. That is the only reason. I mean, I could take arbitrary powers of two from any number I see, but I wouldn't want to take that task from you.<br/>Quote<blockquote>It is now Sunday morning and I am awake now, so watch out. I am onto you!<br/></blockquote>This is you awake? I would have assumed you were asleep, what with the dreamy nonsense you are spouting (and then you claim I'm the one spouting nonsense without proof, haha)<br/><br/>Quote from: Geek-9pm on February 13, 2011, 01:36:06 PM<blockquote>There are millions, if not thousands of posts where many have used SATA with Windows 98SE. It is very clear there are doing it. Many BC has trouble understand plain language without a lot of computer federalism.<br/></blockquote><br/>I never said that a SATA drive couldn't be used with windows98. those quotes only have people who managed to find out that you could indeed use the IDE compatible mode. that's it. they say nothing of "oh yeah and now I can access more of the drive because of SATA's magical pixie powers".<br/><br/>Quote from: Salmon Trout on February 13, 2011, 01:12:47 PM<blockquote>Wow, BC_P and Geek-9PM duking it out! This is better than Torchwood! I thought that although SATA electronics and connectors differ from Parallel ATA, the technology is software compatible and OS transparent. I await developments...<br/></blockquote>SATA has two modes- compatible/IDE, where it can be accessed and is seen as if it were a standard IDE/ATA device; or AHCI, which requires a AHCI driver that windows98 doesn't have and is thus redundant.<br/><br/>This debate is particularly funny in that he keeps saying that I have no real-world evidence, then says he has none either. What he doesn't know is that I have several windows98 PCs and I have already done a LOT of experimentation with SATA and IDE and I KNOW that a good portion of everything he has stated so far is complete and utter tosh. Perhaps he should start providing evidence for his extraordinary claims rather then making extraordinary claims and saying "you can't prove me wrong" even though I already did so several times.When you use a SATA device there is no issue. SATA has 48 LBA. Alwasy did. Never havd 28 bit LBA. The problem is only with drivers that were written explicitly for an early ersion of the ATA standard that preceded SATA.<br/>The 48-bit Logical Block Addressing is a method which extends the capacity of IDE ATA/ATAPI devices beyond a previous limit of 137.4 GB. This limit applies to IDE ATA/ATAPI devices only. The older design specification for the ATA interface only provided 28-bits with which to address the devices. This meant that a hard disk could only have a maximum of 268,435,456 sectors of 512 bytes , the ATA interface to a maximum of 137.4 gigabytes. With 48-bit addressing the limit is 144 petabytes (144,000,000 gigabytes). Unlikely they will ever do a 64 bit LBA.<br/>Quote from: Geek-9pm on February 13, 2011, 09:42:09 PM<blockquote>When you use a SATA device there is no issue. SATA has 48 LBA. Always did. <br/></blockquote><a href="http://www.48bitlba.com/sataharddrives.htm">http://www.48bitlba.com/sataharddrives.htm</a><br/><br/>Quote<blockquote>48-bit LBA requirements for SATA hard drives are the same as those for IDE hard drives. You will need to make sure you have the correct Windows Service Packs installed and EnableBigLba registry value set for Windows 2000. If not, your SATA hard drive will not be recognized at full capacity.<br/><br/>Regarding 48-bit LBA BIOS compatibility, in theory that is also required. In reality, since SATA technology is basically newer relative to 48-bit LBA we expect all motherboards which support SATA will also have 48-bit LBA compatibility in the BIOS. Most likely, you will not need to check for this if you are having problems installing your SATA hard drive. You should make sure you have the latest Windows Service Packs and drivers installed first. <br/></blockquote>Not that it matters since <strong>Windows 98 does not support 48-bit LBA</strong>.<br/><br/>Quote<blockquote>Never havd 28 bit LBA. </blockquote>That's irrelevant. What you are saying is that since SATA "only supports " 48-bit LBA (which is wrong. since SATA is ATA and all ATA standards are backwards compatible in that you can use a ATA-4 drive in a computer capable of using ATA-6 and you can use an ATA-6 drive in a older computer capable of only ATA-4; in "compatible/IDE" mode, (which is required for any OS that doesn't have native SATA drivers) SATA drives act just like a standard ATA drive, including backwards compatibility with software expecting to be able to interface with it using older drivers, this includes 28-bit LBA.<br/>Quote<blockquote>The problem is only with drivers that were written explicitly for an early ersion of the ATA standard that preceded SATA.</blockquote>Drivers which are used by older operating systems that don't have SATA drivers, so I'm not sure what the relevance is. That's pretty much what I've been saying all along. SATA doesn't magically make these drivers work in a new mode.<br/><br/>Quote<blockquote>The 48-bit Logical Block Addressing is a method which extends the capacity of IDE ATA/ATAPI devices beyond a previous limit of 137.4 GB. This limit applies to IDE ATA/ATAPI devices only.</blockquote>SATA drives are IDE/ATA drives too. Those same limits apply if the software in question is interfacing with the drive as if it was an older ATA revision, which it can do because in order for it to see it at all it needs to be set to "compatible" in the BIOS in which case the SATA drive is seen as a standard ATA-6 (or 7) drive to the system, and any ATA-6 (or 7) drive can be interacted with using even ATA-4 drivers, which coincidentally are the ones Windows98 uses by default, most likely this is because ATA-4 was the newest revision when windows98 was released. <br/><br/>Quote<blockquote>The older design specification for the ATA interface only provided 28-bits with which to address the devices.</blockquote><br/>no. 28-bit LBA was in ATA-1 through ATA-4. ATA-4 hasn't been used in new PCs since <a href="https://interviewquestions.tuteehub.com/tag/1998-a-282449" style="font-weight:bold;" target="_blank" title="Click to know more about 1998">1998</a>. Windows 98 interacts with IDE drives (and SATA drives are IDE drives, FYI) using a driver that uses ATA-4 commands. that ATA subset includes 28-bit LBA, SATA drives are ATA drives, thus they are backward compatible with the ATA command languages of previous revisions of ATA- that includes 28-bit addressing. Without third-party hacks Windows 98 will not support 48-bit LBA. <br/><br/>Quote<blockquote>the ATA interface to a maximum of 137.4 gigabytes</blockquote>ATA-6 uses 48-bit LBA. It isn't limited to 137.4GB. You keep saying "ATA" instead of "PATA", since a SATA drive is a ATA drive. I assume that since you are trying to for some reason say that since SATA is newer it only supports 48-bit LBA (something easily disprovable with a little research, or simply the basic knowledge that all versions of ATA are generally backward compatible, and that SATA is/was in fact part of the ATA-7 specification.<br/><br/><br/>You say Toh mah toe<br/>I say Tu may tu<br/>It is still <strong>Tomato</strong> and tastes the same.<br/><br/>Only early drivers for the PATA were written with the 28 bit LBA.<br/><br/>All drivers written for the SATA always have 48 LBA.<br/><br/>There is no generic binary low-level driver that can do both PATA and SATA.<br/>Quote from: Geek-9pm on February 13, 2011, 10:51:28 PM<blockquote>Only early drivers for the PATA were written with the 28 bit LBA.<br/></blockquote>ATA-4. I just told you. which was in use ~1998. Earlier then that there was no 28-bit LBA that drivers could use.<br/><br/>Quote<blockquote>All drivers written for the SATA always have 48 LBA.</blockquote>Windows 98 doesn't have SATA Drivers. DOS doesn't have SATA drivers.<br/><br/>Quote<blockquote>There is no generic binary low-level driver that can do both PATA and SATA.<br/></blockquote>ATA drivers (such as those used in operating systems before SATA) can use SATA drives. Set SATA mode in BIOS to "compatible" and you can install XP without additional SATA drivers just fine. I know because I've actually done it. XP doesn't see SATA drives, it sees them just as it would a PATA drive- two IDE Controllers with a master and a slave each. Same with windows 98, difference is Windows XP SP1a supports 48-bit LBA (ATA-6) and Windows98 does not.</body></html> | |
8661. |
Solve : How to read a file with delimitted name value pairs using DOS batch script?? |
Answer» <html><body><p>0<br/>down vote favorite I have a file with each line of the format name=value. I need to read it using a DOS script and store all the name value pairs in memory. The names are from a predefined list of names, so I can have a list of DOS <a href="https://interviewquestions.tuteehub.com/tag/variables-11302" style="font-weight:bold;" target="_blank" title="Click to know more about VARIABLES">VARIABLES</a>, and assign values to them as and when a line is read from the file. Please provide the script for doing this. I'm not able to even do as much as read a file using the below code which I got on the internet, it printes nothing: <br/>FOR /<a href="https://interviewquestions.tuteehub.com/tag/f-236701" style="font-weight:bold;" target="_blank" title="Click to know more about F">F</a> %i IN (regfort.properties) DO @echo %i<br/>Quote from: criminal on February 13, 2011, 07:27:13 AM</p><blockquote>0<br/>down vote favorite I have a file with each line of the format name=value. I need to read it using a DOS script and store all the name value pairs in memory. The names are from a predefined list of names, so I can have a list of DOS variables, and assign values to them as and when a line is read from the file. Please provide the script for doing this. I'm not able to even do as much as read a file using the below code which I got on the internet, it printes nothing: <br/>FOR /F %i IN (regfort.properties) DO @echo %i<br/></blockquote><br/>Please provide a sample of the file you want to read, a few lines will do.<br/>The file <a href="https://interviewquestions.tuteehub.com/tag/tobe-1421437" style="font-weight:bold;" target="_blank" title="Click to know more about TOBE">TOBE</a> read is like this:<br/>name1=value1<br/>name2=value2<br/><br/>As the names are pre-defined, when the batch file reads the first line it will set the variable %name1% to value1 and while reading the 2nd line it will set the variable %name2%.for /f "delims=" %%i in (regfort.properties) do @set %%iVow, that works. Thanks a ton! <br/>One more small help I need. If the line starts with # I want to <a href="https://interviewquestions.tuteehub.com/tag/omit-585643" style="font-weight:bold;" target="_blank" title="Click to know more about OMIT">OMIT</a> processing it as it is a comment. How to make this additional change?If you only want to exclude lines where # is the first character then this should work...<br/><br/>@echo off<br/>setlocal enabledelayedexpansion<br/>for /f "delims=" %%i in (regfort.properties) do (<br/> set line=%%i<br/> if not "!line:~0,1!"=="#" set %%i<br/> )<br/><br/>...or, if you are content to exclude lines which have a # character anywhere (not just the beginning) you can have it on just one line<br/><br/>for /f "delims=" %%i in (Test.txt) do @echo %%i | find "#">nul || @set %%i<br/><br/>Quote from: Salmon Trout on February 13, 2011, 09:32:28 AM<blockquote>...or, if you are content to exclude lines which have a # character anywhere (not just the beginning) you can have it on just one line<br/><br/>for /f "delims=" %%i in (Test.txt) do @echo %%i | find "#">nul || @set %%i<br/></blockquote><br/>why not <br/>Code: <a>[Select]</a>for /f ..... (findstr /v "#" test.txt) do (<br/> .......<br/>) <br/>then you only call findstr (or find) once.That works, thanks.<br/>Now I want to enhance the script so that the file path is not hardcoded in the file:<br/>set RF_PROPERTIES=%HOME%\conf\properties\regfort-monitor.properties<br/><br/>%HOME% points to <a href="https://interviewquestions.tuteehub.com/tag/c-3540" style="font-weight:bold;" target="_blank" title="Click to know more about C">C</a>:\program files\Hugh systems<br/><br/>When I run <br/>for /f "delims=" %%i in (%RF_PROPERTIES%) do (<br/> set line=%%i<br/> echo line=%line%<br/> if not "!line:~0,1!"=="#" set %%i<br/> )<br/><br/>It complains<br/>The system cannot find the file C:\Program.<br/><br/>Then when I tried "%RF_PROPERTIES%" in the for loop it complains<br/>Environment variable C:\Program Files\Hugh not defined.<br/><br/>How to get it working?Surround the varible in quotesI already tried "%RF_PROPERTIES%" (in quotes) like I already said.<br/>One more thing I just noticed, it still tries to use the lines starting with # and prints <br/> Environment variable # Uncomment and change these properties is not definedSetlocal enabledeyledexpansion<br/>Set a=%RF_PROPERTIES:~0,1%<br/>if %a%==" (set b=%RF_PROPERTIES%) else (set b=""%RF_PROPERTIES"")<br/>for /f "tokens=1,2 delims==" %%a in (%b%) do (<br/> set line=%%a<br/> echo line=!line!<br/> if not "!line:~0,1!"=="#" set %%a=%%b)<br/><br/>note this may not work for two reasons<br/> A) it's late <br/> B) I wrote it on a mobile phone so it's not testedQuote from: mat123 on February 14, 2011, 05:17:52 AM<blockquote>enabledeyledexpansion</blockquote><br/>Well, that's not spelled right</body></html> | |
8662. |
Solve : Scheduled Tasks - question on changing scripts? |
Answer» <html><body><p>If there is a scheduled task that is scheduled to <a href="https://interviewquestions.tuteehub.com/tag/start-239994" style="font-weight:bold;" target="_blank" title="Click to know more about START">START</a> and stop every day, is it possible to change the <a href="https://interviewquestions.tuteehub.com/tag/script-345000" style="font-weight:bold;" target="_blank" title="Click to know more about SCRIPT">SCRIPT</a> that it runs while it is not running and have those changes take effect on the next start? My suspicion is that the script is in <a href="https://interviewquestions.tuteehub.com/tag/memory-11894" style="font-weight:bold;" target="_blank" title="Click to know more about MEMORY">MEMORY</a> and does not change <a href="https://interviewquestions.tuteehub.com/tag/even-976335" style="font-weight:bold;" target="_blank" title="Click to know more about EVEN">EVEN</a> if you edit the script while the task is idle. Am I correct? Thanks.More info. The scheduled task runs a script that calls a number of other scripts. The problem I am seeing is that the calling script cannot find one of the <a href="https://interviewquestions.tuteehub.com/tag/called-907796" style="font-weight:bold;" target="_blank" title="Click to know more about CALLED">CALLED</a> scripts even though this called script is in the correct folder. When I create a new scheduled task that executes the exact same script, this new scheduled task finds the 'called' script okay and runs it.<br/><br/>Does this make any sense?</p></body></html> | |
8663. |
Solve : Batch Problem? |
Answer» <html><body><p>Hi,<br/><br/>Can anyone get the below to work. As far as I can tell, there's no reason why it wouldn't (Sorry, I'm new to batch files, but comfortable with programming languages, so I *should* be able to understand all jargon thrown back at me )<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/code-25512" style="font-weight:bold;" target="_blank" title="Click to know more about CODE">CODE</a>: <a>[Select]</a>@ECHO OFF<br/><br/>SET DefaultPath="C:\Program Files\WiredRed\EPop\EPopB.exe"<br/><br/>IF [%1]==[/?] GOTO HelpDisplay<br/><br/>IF [%1]==[] GOTO MissingArgs<br/><br/>IF NOT [%4]==[] (<br/> IF [%5]==[] GOTO MissingArgs<br/>)<br/><br/>IF [%2]==[] (<br/> IF EXIST %DefaultPath% (<br/> SET ExePath=%DefaultPath%<br/> ) ELSE (<br/> SET ExePath=""<br/> )<br/>) ELSE (<br/> IF EXIST %2 (<br/> SET ExePath=%DefaultPath%<br/> ) ELSE (<br/> IF EXIST %DefaultPath% (<br/> SET ExePath=%DefaultPath%<br/> ) ELSE (<br/> SET ExePath=""<br/> )<br/> )<br/>)<br/><br/>The problem occurs at the <strong>IF [%2]==[] (</strong> line. I keep getting "<em>The syntax of the command is incorrect.</em>" when I don't supply a 2nd argument. It executes the else statement perfectly if I do supply a second argument.<br/><br/>What surprises me is that the syntax matches the above <strong>IF NOT [%4]==[] (</strong> with the exception of the not command. Does anyone have any idea?<br/><br/>Thanks in advance.Try changing this line from <strong>IF EXIST %2 (</strong> to <strong>IF NOT [%2]==[] (</strong>Hi oldun,<br/><br/>Thanks for the reply, but the problem doesn't occur at any stage in the <strong>ELSE</strong> segment. I would try that, but the <strong>EXIST</strong> segment is to test if the file exists, not whether or not the argument is null.If I correctly understand what you are attempting to achieve, the following should work:<br/><br/>Code: <a>[Select]</a>Set ExePath=""<br/>If Exist %DefaultPath% Set ExePath=%DefaultPath%<br/>IF Not [%2]==[] (<br/> If Exist %2 ( Set ExePath=%DefaultPath% )<br/>)<br/>Quote from: oldun on February 06, 2011, 02:03:31 PM</p><blockquote>If I correctly understand what you are attempting to achieve, the following should work:<br/><br/>Code: <a>[Select]</a>Set ExePath=""<br/>If Exist %DefaultPath% Set ExePath=%DefaultPath%<br/>IF Not [%2]==[] (<br/> If Exist %2 ( Set ExePath=%DefaultPath% )<br/>)<br/></blockquote><br/>Thanks again for your post Oldun. Your close to what I'm trying to achieve, but to do it, your 4th line down would be <strong>... ExePath=%2</strong>.<br/><br/>Basically, the idea of ExePath is to store the executable file's location. The user can send the filelocation as an argument (<strong>%2</strong>). There is a DefaultPath in case the file location sent as <strong>%2</strong> doesn't exist (or if the user doesn't enter a location argument).<br/><br/>I've tried putting in your <a href="https://interviewquestions.tuteehub.com/tag/example-239971" style="font-weight:bold;" target="_blank" title="Click to know more about EXAMPLE">EXAMPLE</a> (with the modification listed above) and it was still giving problems ("<em>) was unexpected at this time.</em>"). I thought it might be that you cannot set variables to argument values in this way, so I tried your example as typed... same error. I threw in a couple of <strong>ECHO</strong>s to find out thich closing bracket was the problem, and it was the final bracket. I thought it might have a problem with the nesting of brackets (for whatever reason), so I even tried it without brackets on the 4th line. Still the same error.<br/><br/>I can't see anything wrong with the code I first put up (or yours for that matter, because it is much easier to see that your code doesn't appear to have any problems visually). At this point I have to ask, what are the chances that it's a problem with the environment itself? (As worrying as that would be).Here is the <a href="https://interviewquestions.tuteehub.com/tag/complete-423576" style="font-weight:bold;" target="_blank" title="Click to know more about COMPLETE">COMPLETE</a> script. This executes without errors when I run it.<br/><br/>Code: <a>[Select]</a>@ECHO OFF<br/>SetLocal<br/>SET DefaultPath="C:\Program Files\WiredRed\EPop\EPopB.exe"<br/><br/>IF [%1]==[/?] GOTO HelpDisplay<br/><br/>IF [%1]==[] GOTO MissingArgs<br/><br/>IF NOT [%4]==[] (<br/> IF [%5]==[] GOTO MissingArgs<br/>)<br/><br/>Set ExePath=""<br/>If Exist %DefaultPath% Set ExePath=%DefaultPath%<br/>IF Not [%2]==[] (<br/> If Exist %2 ( Set ExePath=%2 )<br/>)<br/>I <a href="https://interviewquestions.tuteehub.com/tag/built-245060" style="font-weight:bold;" target="_blank" title="Click to know more about BUILT">BUILT</a> it from scratch starting with the code you posted. Seems to be working now for some reason. I'm even comparing it side-by-side to the amended one I tried earlier and they look the exact same <a href="https://interviewquestions.tuteehub.com/tag/well-734398" style="font-weight:bold;" target="_blank" title="Click to know more about WELL">WELL</a>, thanks for your help, you certainly earned your thanks on this one.<br/><br/>Quick question though so I at least learn something from this project. I've added code onto the end of it. Why is it that one of these works and one doesn't?<br/><br/>Code: <a>[Select]</a>::Will work<br/><br/>IF NOT %ExePath%=="" ECHO Will Run<br/>Code: <a>[Select]</a>::Won't work, at least for me anyway<br/><br/>IF NOT %ExePath%=="" (<br/> ECHO Will Run<br/>)<br/>Rest assured I retyped it a couple of times to MAKE SURE that there were no dodgey unprintable characters that just appeared to be spaces.Did you tab that echo command batch has a heart attack when it reads a tabQuote from: mat123 on February 14, 2011, 12:45:13 AM<blockquote>Did you tab that echo command batch has a heart attack when it reads a tab<br/></blockquote><br/>Really?<br/><br/>i meant when a tab is in front of a commandQuote from: mat123 on February 14, 2011, 01:11:43 PM<blockquote>i meant when a tab is in front of a command<br/></blockquote><br/></body></html> | |
8664. |
Solve : Find and replace file name? |
Answer» <html><body><p>Hi<br/>I have a problem I am trying to solve. I have many mp3 files (several hundred) in a folder with the following type names:<br/><br/>accipiter-gentilis.mp3<br/>acrocephalus-arundinaceus.mp3<br/>acrocephalus-palustris.mp3<br/>carduelis-chloris.mp3<br/><br/>Let's say these files are stored in a folder location C:\documents\music<br/><br/>I need to scan through these files one by one, remove the hyphen and replace it with a space.<br/>Got any ideas??<br/><br/>ThanksSave this batch script in the folder where the mp3 files are. Run it and if you are <a href="https://interviewquestions.tuteehub.com/tag/happy-479308" style="font-weight:bold;" target="_blank" title="Click to know more about HAPPY">HAPPY</a> with what it shows, edit it in Notepad to remove the <a href="https://interviewquestions.tuteehub.com/tag/echo-11626" style="font-weight:bold;" target="_blank" title="Click to know more about ECHO">ECHO</a> command from the start of the renaming line.<br/><br/>Code: <a>[Select]</a>@echo off<br/>setlocal enabledelayedexpansion<br/>for %%A in (*-*.mp3) do (<br/> set oldname=%%A<br/> set newname=!oldname:-= !<br/><br/> REM remove the echo from the next line<br/> REM when you are happy with what it proposes to do<br/> Echo RENAME "!oldname!" "!newname!"<br/><br/> )<br/>Echo Finished...<br/>Echo.<br/>pause<br/> <br/>Hi Salmon Trout<br/>Thank so much. That worked perfectly - exactly what I wanted. However I like to understand what is happening. Would you mind <a href="https://interviewquestions.tuteehub.com/tag/commenting-923135" style="font-weight:bold;" target="_blank" title="Click to know more about COMMENTING">COMMENTING</a> this so I can unstand what is occuring line for line??<br/>Thanks<br/><br/>@echo off<br/>setlocal enabledelayedexpansion<br/>for %%A in (*-*.mp3) do (<br/> set oldname=%%A<br/> set newname=!oldname:-= !<br/><br/> REM remove the echo from the next line<br/> REM when you are happy with what it proposes to do<br/> RENAME "!oldname!" "!newname!"<br/><br/> )<br/>Echo Finished...<br/>Echo.<br/>pauseQuote from: geroido on February 15, 2011, 12:05:01 PM</p><blockquote>Would you mind commenting this</blockquote><br/>Code: <a>[Select]</a>@echo off<br/><br/>REM You need this if you want to set and then use<br/>REM variables inside parenthetical structures such<br/>REM as loops. Google "delayed expansion" for full<br/>REM details<br/>setlocal enabledelayedexpansion<br/><br/>REM This is a loop in which...<br/>REM for each file <a href="https://interviewquestions.tuteehub.com/tag/specified-1221578" style="font-weight:bold;" target="_blank" title="Click to know more about SPECIFIED">SPECIFIED</a> by the mask *-*.mp3<br/>REM %%A will hold each filename in turn<br/>for %%A in (*-*.mp3) do (<br/><br/> REM put that name into a variable<br/> set oldname=%%A<br/> <br/> REM Create new name<br/> REM <a href="https://interviewquestions.tuteehub.com/tag/make-249948" style="font-weight:bold;" target="_blank" title="Click to know more about MAKE">MAKE</a> a new variable holding<br/> REM the old name replacing any hyphen<br/> REM with a space<br/> REM note use of exclamation marks instead<br/> REM of percent signs with delayed expansion<br/> set newname=!oldname:-= !<br/> <br/> REM rename the current file with<br/> REM the computed new name<br/> RENAME "!oldname!" "!newname!"<br/><br/> )<br/> REM loop end<br/> <br/>pause<br/><br/>Thanks Salmon Trout<br/>Very well explained. Saved me so much work.</body></html> | |
8665. |
Solve : MS DOS beginner need help with a command? |
Answer» <html><body><p>okay so I currently here C:\1161_DataFiles\DOS<br/><br/>what <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a> do I write to <a href="https://interviewquestions.tuteehub.com/tag/delete-karana-436574" style="font-weight:bold;" target="_blank" title="Click to know more about DELETE">DELETE</a> all the files that have the number 1 in the <a href="https://interviewquestions.tuteehub.com/tag/name-237998" style="font-weight:bold;" target="_blank" title="Click to know more about NAME">NAME</a> from the DOS directoryThis should do it. The two <a href="https://interviewquestions.tuteehub.com/tag/asterisks-886212" style="font-weight:bold;" target="_blank" title="Click to know more about ASTERISKS">ASTERISKS</a> (*) are wildcards.<br/><br/>Code: <a>[Select]</a><a href="https://interviewquestions.tuteehub.com/tag/del-947443" style="font-weight:bold;" target="_blank" title="Click to know more about DEL">DEL</a> *1*</p></body></html> | |
8666. |
Solve : net use time out? |
Answer» <html><body><p>I want to connect to a network location and have this displayed as a drive letter S:.<br/>I <a href="https://interviewquestions.tuteehub.com/tag/put-11868" style="font-weight:bold;" target="_blank" title="Click to know more about PUT">PUT</a> <a href="https://interviewquestions.tuteehub.com/tag/together-1421609" style="font-weight:bold;" target="_blank" title="Click to know more about TOGETHER">TOGETHER</a> some code that should look for drive S: and start the Explorer right there.<br/>If drive S: is not found it should try to connect to it through NET USE. <br/>Once connected it should fire up Explorer at S:. <br/>On failure it should warn.<br/><br/>My problem:<br/>Some users are not granted acces by the IT department. When <a href="https://interviewquestions.tuteehub.com/tag/encountering-7679149" style="font-weight:bold;" target="_blank" title="Click to know more about ENCOUNTERING">ENCOUNTERING</a> this issue, the NET USE part of the program just hangs. I want it to try to connect for say half a minute, then exit, regardless of the outcome. Preferibly with a warning that <a href="https://interviewquestions.tuteehub.com/tag/sends-1200607" style="font-weight:bold;" target="_blank" title="Click to know more about SENDS">SENDS</a> them to IT.<br/><br/>Code: <a>[Select]</a>:SFind1<br/>If <a href="https://interviewquestions.tuteehub.com/tag/exist-979486" style="font-weight:bold;" target="_blank" title="Click to know more about EXIST">EXIST</a> "S:" (Echo S:Allready there. >> log\%username%-Log-SearchDisk.txt&goto SRun) Else (goto SMaker)<br/><br/>:SMaker<br/>net use S: \\sda02\ds-ib >> log\%username%-Log-SearchDisk.txt <br/>Echo attempt to connect to S-Disk. >> log\%username%-Log-SearchDisk.txt<br/>start /wait data\sleeper.vbs 1000 ,0, True<br/>goto SFind2 <br/><br/>:SFind2<br/>If Exist "S:" (Echo S:Now there. >> log\%username%-Log-SearchDisk.txt&goto SRun) Else (goto NoSource)<br/><br/>:NoSource<br/>Echo Search the file "..log\%username%-Log-SearchDisk.txt"<br/>goto QuitFail<br/><br/>:SRun<br/>%SystemRoot%\explorer.exe /E, S:\ >> log\%username%-Log-SearchDisk.txt<br/>Echo Starting Explorer S: >> log\%username%-Log-SearchDisk.txt<br/>goto QuitGood<br/><br/>:QuitFail<br/>REM --------------------------------------<br/>Echo. >> log\%username%-Log-SearchDisk.txt<br/>Echo update stopped %DATE%, %TIME% >> log\%username%-Log-SearchDisk.txt<br/>Echo ############################### >> log\%username%-Log-SearchDisk.txt<br/>Echo msgbox "Ask IT for acces to this location <tijdelijk op 'SDA02 (sda02)'(S:)>. Show them this message." >log\%username%-fail.vbs&log\%username%-fail.vbs&del log\%username%-fail.vbs<br/>Exit<br/><br/><br/>:QuitGood<br/>REM --------------------------------------<br/>Echo. >> log\%username%-Log-SearchDisk.txt<br/>Echo update ready %DATE%, %TIME% >> log\%username%-Log-SearchDisk.txt<br/>Echo ############################### >> log\%username%-Log-SearchDisk.txt<br/>Exit<br/><br/>Thanks in advance</p></body></html> | |
8667. |
Solve : Creating a batch file to run an application on an entire directory contents.? |
Answer» <html><body><a href="https://interviewquestions.tuteehub.com/tag/hi-479908" style="font-weight:bold;" target="_blank" title="Click to know more about HI">HI</a> guys, <br/><br/>Tried a bit of a search on this but lacking the DOS knowledge to search the right thing I expect.<br/><br/>In brief, I use a command line app which does some image processing on a single image. (it produces a series of bump, normal and specular texture maps for use in <a href="https://interviewquestions.tuteehub.com/tag/games-1003340" style="font-weight:bold;" target="_blank" title="Click to know more about GAMES">GAMES</a>)<br/><br/>The app is called shadermap.exe and I can run the process on a single image with a batch file like the following:<br/><br/>Code: <a>[Select]</a>START /WAIT shadermap.exe cdiff "d:\shadermapcommandline\mytestimage.tga" -disp (60,100,12,xy) -norm (100,200,xy,0) -ambo (100,10,10,35,25,0,xy) -spec (100,-50,52,xy) -v <br/>I have around 1500 images I need to run this procedure on, however.<br/><br/>So I'm hoping someone can help out a DOS novice to create a variation of this batch file to just run the process on 'all' image files in a directory. (so I can just drag this bat and exe into any folder and click it to process all.)<br/><br/>Much appreciate any help. Thanks!<br/><br/>Here's a link to the app and test image if useful: <a href="http://www.fo0k.com/dump/shadermapcommandline.rar">http://www.fo0k.com/dump/shadermapcommandline.rar</a>Try this<br/><br/>Code: <a>[Select]</a>@echo off<br/>set ShaderMapParams=-disp (60,100,12,xy) -norm (100,200,xy,0) -ambo (100,10,10,35,25,0,xy) -spec (100,-50,52,xy) -v <br/>for %%A in (*.txt) do START /WAIT shadermap.exe cdiff "%%A" %ShaderMapParams%<br/><br/>Sorry I absent mindedly pasted a testing version - here is the corrected version<br/><br/>for %%A in (*.tga) do START /WAIT shadermap.exe cdiff "%%A" -disp (60,100,12,xy) -norm (100,200,xy,0) -ambo (100,10,10,35,25,0,xy) -spec (100,-50,52,xy) -v <br/><br/>hah! fantastic.<br/><br/>The one thing I would ask you is how to get it to save the newly generated images in the same folder? <br/>It seems that regardless of which folder I place the exe and bat file in.. when it generates the new images, it will just dump them in the root of the drive which is not ideal. (but not the end of the world..!)<br/><br/>Many thanks for your help.I am not familiar with shadermap.exe, but I did a bit of Googling (there are forums specialising in that**) and from what I can gather, you may need to create an output folder, and run the batch from that folder, including in the batch the full path and name of the input files, so this might work... run it in the folder where the input tga files are...<br/><br/>** like here <a href="http://www.renderingsystems.com/support/showthread.php?tid=3">http://www.renderingsystems.com/support/showthread.php?tid=3</a><br/><br/>@echo off<br/>set thisfolder=%~dp0<br/><br/>rem edit these to suit<br/>set outputfolder=c:\shadermap-output<br/>set jobscriptname=myjob.bat<br/><br/>if not exist "%outputfolder%" md "%outputfolder%"<br/>if exist "%outputfolder%\%jobscriptname%" del "%outputfolder%\%jobscriptname%"<br/><br/>for %%A in (*.tga) do <strong>ECHO</strong> START /WAIT shadermap.exe cdiff "%%~dpnxA" -disp (60,100,12,xy) -norm (100,200,xy,0) -ambo (100,10,10,35,25,0,xy) -spec (100,-50,52,xy) -v >> "%outputfolder%\%jobscriptname%"<br/><br/>echo Changing to output folder<br/>cd /d "%outputfolder%"<br/><br/>echo <a href="https://interviewquestions.tuteehub.com/tag/starting-1224778" style="font-weight:bold;" target="_blank" title="Click to know more about STARTING">STARTING</a> job<br/>call "%jobscriptname%"<br/>echo Finished job<br/><br/>echo Changing back to input folder<br/>cd /d "%thisfolder%"<br/><br/>echo.<br/>pause<br/><br/><br/>This works like a charm. Thank you so much for your time.<br/><br/>I had searched through the shadermap forums previously but there was no <a href="https://interviewquestions.tuteehub.com/tag/mention-547565" style="font-weight:bold;" target="_blank" title="Click to know more about MENTION">MENTION</a> of a script to work like this. I think they would understandably want you to purchase the full version, which along with a lot more <a href="https://interviewquestions.tuteehub.com/tag/functionality-25520" style="font-weight:bold;" target="_blank" title="Click to know more about FUNCTIONALITY">FUNCTIONALITY</a> also includes batch jobs for multiple files. Therefore not so keen to advertise how to achieve this via CL on their site.<br/><br/>Wouldn't it be good if you could buy someone a beer over the internet... like take a printout to your local pub for a free pint. If I could, I would! Thanks again , Salmon!</body></html> | |
8668. |
Solve : dashes in batch file? |
Answer» <html><body><p>Hello, can anyone explain me what these dashes means and do in this line from batch file?<br/><br/>if -%1 == - GOTO error1<br/>:error1<br/><a href="https://interviewquestions.tuteehub.com/tag/echo-11626" style="font-weight:bold;" target="_blank" title="Click to know more about ECHO">ECHO</a> please write file name<br/><br/>When I write only batch file name in prompt line (<a href="https://interviewquestions.tuteehub.com/tag/windows-22662" style="font-weight:bold;" target="_blank" title="Click to know more about WINDOWS">WINDOWS</a> Vista) without any other file and run it, I <a href="https://interviewquestions.tuteehub.com/tag/get-11812" style="font-weight:bold;" target="_blank" title="Click to know more about GET">GET</a> the message 'please write file name'.<br/>I would like to know how these dashes work and where can I use it.The dash is so you can test for a blank parameter. You <a href="https://interviewquestions.tuteehub.com/tag/could-410026" style="font-weight:bold;" target="_blank" title="Click to know more about COULD">COULD</a> use any character. Often <a href="https://interviewquestions.tuteehub.com/tag/people-238015" style="font-weight:bold;" target="_blank" title="Click to know more about PEOPLE">PEOPLE</a> use quotes before and after, or whatever.<br/><br/>if [%1==[ echo parameter is blank<br/>if "%1"=="" echo parameter is blank<br/>if $%1$==$$ echo paramter is blank<br/>if cat%1==cat echo parameter is blank<br/><br/><br/><br/>Thank you for timeliness. Really helped me ))</p></body></html> | |
8669. |
Solve : Bach file for internet explorer? |
Answer» <html><body><p>Hi all<br/><br/>I am opening 100 urls to see if they are accessible or not. I decided to make batch <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> to do this. I can open urls through batch file by<br/><br/>start iexplore.exe <a href="https://www.google.com">www.google.com</a><br/><br/>but i want <a href="https://interviewquestions.tuteehub.com/tag/something-25913" style="font-weight:bold;" target="_blank" title="Click to know more about SOMETHING">SOMETHING</a> else.<br/><br/>I want my batch file to generate a file which can <a href="https://interviewquestions.tuteehub.com/tag/tell-1240910" style="font-weight:bold;" target="_blank" title="Click to know more about TELL">TELL</a> me that which links were opened and which were not opened. In other words my batch file can catch 404 eroor and display it in a text file.<br/><br/>Regards<br/>SaraIt <a href="https://interviewquestions.tuteehub.com/tag/would-3285927" style="font-weight:bold;" target="_blank" title="Click to know more about WOULD">WOULD</a> be better to use ping and check errorlevel. Why do you want to do this?<br/></p></body></html> | |
8670. |
Solve : syntax for info from registry? |
Answer» <html><body><p>Hi all,<br/><br/>I need a return list of configured fonts in a database program.<br/><br/>For that I need a list of all the fonts marked in the data <a href="https://interviewquestions.tuteehub.com/tag/field-244514" style="font-weight:bold;" target="_blank" title="Click to know more about FIELD">FIELD</a> as 1 in the registry located at:<br/><br/>HKEY_CURRENT_USER<br/>Software<br/>FileMaker<br/>8.5A<br/>Fonts<br/><br/>Can someone put the total string together that I have to use to reach the list?<br/><br/>It's the command I have to use in a Send Event function in FileMaker.<br/>But I'm stuck where to use the '/' or the '\' etc.<br/><br/>TIAThank you for the long list of possibilities and parameters.<br/><br/>Right now I have absolutely no clue how to put what together with what to reach the info I need....<br/><br/>Is it something like:<br/><br/>REG QUERY \HKEY_CURRENT_USER\Software\FileMaker\8.5A\Fonts....??<br/><br/>Do I need to put C:\ in front ? and is it HKCU instead of HKEY_CURRENT_USER ??<br/><br/>I never, ever did something like that before, never needed.... so I'm a bit at lost here....<br/><br/>If I could have the total string needed to retrieve the info in the command line, that would be a saver...<br/><br/>I tried some combinations, but I'm not completely at ease to try things out at command level and registry....<br/><br/>And an additional question: is it possible to have the result of the query saved in some <a href="https://interviewquestions.tuteehub.com/tag/kind-25540" style="font-weight:bold;" target="_blank" title="Click to know more about KIND">KIND</a> of text file ?<a href="https://interviewquestions.tuteehub.com/tag/type-238192" style="font-weight:bold;" target="_blank" title="Click to know more about TYPE">TYPE</a> <br/><br/>reg query HKEY_CURRENT_USER\Software\FileMaker\8.5A\Fonts<br/><br/>at the prompt. What do you get?<br/><br/><br/>Two posts from BillRich have been deleted from this thread.Thank goodness...<br/>For <a href="https://interviewquestions.tuteehub.com/tag/awhile-7384853" style="font-weight:bold;" target="_blank" title="Click to know more about AWHILE">AWHILE</a> i thought the OP was talking to himself... Quote from: Salmon Trout on February 19, 2011, 02:50:21 AM</p><blockquote>type <br/><br/>reg query HKEY_CURRENT_USER\Software\FileMaker\8.5A\Fonts<br/><br/>at the prompt. What do you get?<br/></blockquote><br/>'reg' is not recognized as an internal or external command, operable program or batch.<br/><br/>Same message when I remove 'reg'<br/><br/>......Quote from: JMontana on February 19, 2011, 12:07:50 PM<blockquote>'reg' is not recognized as an internal or external command, operable program or batch.</blockquote><br/>what happens when you type <br/><br/>PATH<br/><br/>at the prompt?<br/><br/>Also, is this file present?<br/><br/>C:\windows\system32\reg.exe<br/><br/><br/><br/>Quote from: Salmon Trout on February 19, 2011, 12:22:10 PM<blockquote>what happens when you type <br/><br/>PATH<br/><br/>at the prompt? </blockquote>On the Win 2000<br/>PATH=C:\WINNT\system32;C:\WINNT\System32\Wbem;C:\PROGRAM~1\COMMON~1\ODBC\FILEMA~1;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Oracle\win32<br/><br/>On the Win 7<br/>See screenshot<br/><br/>Quote from: Salmon Trout on February 19, 2011, 12:22:10 PM<blockquote>Also, is this file present?<br/><br/>C:\windows\system32\reg.exe<br/></blockquote><br/>Yes on the Win 7, no on the Win 2000 <br/><br/>[recovering disk space - old attachment deleted by admin]Quote from: JMontana on February 19, 2011, 03:59:35 PM<blockquote>On the Win 2000<br/>PATH=C:\WINNT\system32;C:\WINNT\System32\Wbem;C:\PROGRAM~1\COMMON~1\ODBC\FILEMA~1;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Oracle\win32<br/><br/>On the Win 7<br/>See screenshot<br/><br/>Yes on the Win 7, no on the Win 2000 <br/></blockquote><br/>Ah... now you see fit to give some more information! At last! I was wondering when you would get around to divulging the OS. It seems there are in fact two. <br/><br/>Well, as far as I can see the reg command should work perfectly well in your Windows 7 situation, since (a) reg.exe is in c:\windows\system32, and (b) that <a href="https://interviewquestions.tuteehub.com/tag/folder-246959" style="font-weight:bold;" target="_blank" title="Click to know more about FOLDER">FOLDER</a> is (correctly) included in the PATH. Yet you say it does not? Is that right? If so, I am very surprised. <br/><br/>However, in the Windows 2000 situation you need to install the Support Tools from the Windows 2000 installation CD as reg.exe is not installed by default, instructions here:<br/><br/><a href="https://support.microsoft.com/kb/301423">http://support.microsoft.com/kb/301423</a><br/><br/>or if the CD is not to hand, get just reg.exe (in a zip archive) here<br/><br/><a href="http://www.dynawell.com/download/reskit/microsoft/win2000/reg.zip">http://www.dynawell.com/download/reskit/microsoft/win2000/reg.zip</a><br/><br/>and unpack it to a folder listed in the PATH variable.<br/></body></html> | |
8671. |
Solve : Replace text in a bat files at once? |
Answer» <html><body><p>Hi All<br/><br/>I have set of bat files. Following highlighted text are common to all bat files.<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/sqlcmd-7326901" style="font-weight:bold;" target="_blank" title="Click to know more about SQLCMD">SQLCMD</a> -S ADC012-PC1\SQLExpress -d test -i E:\<a href="https://interviewquestions.tuteehub.com/tag/reports-246082" style="font-weight:bold;" target="_blank" title="Click to know more about REPORTS">REPORTS</a>\SQLtemplates\R0001.sql -o E:\Reports\Output\R0001.csv -s","<br/><br/>All bat files are stored in a E:\Reports\BatFiles folder. I want to do following things <a href="https://interviewquestions.tuteehub.com/tag/using-1441597" style="font-weight:bold;" target="_blank" title="Click to know more about USING">USING</a> a new bat file.<br/><br/>1. Create new folder in E:\Reports. new folder name is 2011. And also two folders which are called BatFiles and Output folders should be created <a href="https://interviewquestions.tuteehub.com/tag/within-732414" style="font-weight:bold;" target="_blank" title="Click to know more about WITHIN">WITHIN</a> the 2011 folder. (i.e E:\Reports\2011\BatFiles and E:\Reports\2011\Output <br/><br/>2. Copy all bat files which are stored in E:\Reports\BatFiles folder to E:\Reports\2011\BatFiles folder<br/><br/>3. Then replace "E:\Reports\Output\ " text into "E:\Reports\2011\Output\" in <a href="https://interviewquestions.tuteehub.com/tag/every-243531" style="font-weight:bold;" target="_blank" title="Click to know more about EVERY">EVERY</a> bat file content.<br/><br/>Please advice me how to achieve my requirements.<br/><br/>Thank You<br/><br/>Based on the information you have given, this should hopefully work:<br/><strong><br/>@echo off<br/>setlocal enabledelayedexpansion<br/>if not exist E:\Reports\2011 md E:\Reports\2011<br/>if not exist E:\Reports\2011\BatFiles md E:\Reports\2011\BatFiles<br/>if not exist E:\Reports\2011\Output md E:\Reports\2011\Output<br/>cd /d "E:\Reports\BatFiles"<br/>for %%A in (*.bat) do (<br/> echo Processing file: %%~dpnxA<br/> if exist "E:\Reports\2011\BatFiles\%%~nxA" del "E:\Reports\2011\BatFiles\%%~nxA"<br/> for /f "delims==" %%B in ('type %%A') do (<br/> set iline=%%B<br/> if "!iline:~0,79!"=="sqlcmd -S ADC012-PC1\SQLExpress -d test -i E:\Reports\SQLtemplates\R0001.sql -o" (<br/> set oline=!iline:E:\Reports\Output\=E:\Reports\2011\Output\!<br/> echo !oline!>>"E:\Reports\2011\BatFiles\%%~nxA"<br/> ) else (<br/> echo !iline!>>"E:\Reports\2011\BatFiles\%%~nxA"<br/> )<br/> )<br/>)<br/>echo Done<br/>echo.<br/>pause<br/><br/></strong></p></body></html> | |
8672. |
Solve : Control LCD Projector with a Batch File? |
Answer» <html><body><p>Hello all,<br/>I'm totally green when it comes to creating batch files. I have been told that I am able to control my projector (via a rs232 serial connection) with a batch <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a>. The <a href="https://interviewquestions.tuteehub.com/tag/two-241629" style="font-weight:bold;" target="_blank" title="Click to know more about TWO">TWO</a> things I need it to do is to turn on and turn off. Probably two different files? I have hex code for my projector. To turn the projector on its: BE EF 03 06 00 BA D2 01 00 00 60 01 00<br/>How do I implement this into a batch file? The projector is using Com Port 1 if that helps.<br/><br/>I hate having to manually turn the thing on every morning.<br/><br/>Thanks in advance I can see a way doing this with hyperterm and a macro, or C++, but not sure about doing this with plain old batch.Quote from: DaveLembke on February 20, 2011, 08:20:22 PM</p><blockquote>I can see a way doing this with hyperterm and a macro, or C++, but not sure about doing this with plain old batch.<br/></blockquote><br/>COM1: is the serial port, I think. You can <a href="https://interviewquestions.tuteehub.com/tag/set-11758" style="font-weight:bold;" target="_blank" title="Click to know more about SET">SET</a> baud rate,parity, start &<a href="https://interviewquestions.tuteehub.com/tag/amp-363144" style="font-weight:bold;" target="_blank" title="Click to know more about AMP">AMP</a>; stop bits etc from batch, and send byte strings.<br/></body></html> | |
8673. |
Solve : weird keyboard thing help please ?? |
Answer» <html><body><p>-not sure if this is in the right category-<br/>so, al of a suden my computer (laptop ) started doing this weird thing<br/>when i <a href="https://interviewquestions.tuteehub.com/tag/hold-1028313" style="font-weight:bold;" target="_blank" title="Click to know more about HOLD">HOLD</a> down a key it only does it once, like <a href="https://interviewquestions.tuteehub.com/tag/backspace-891153" style="font-weight:bold;" target="_blank" title="Click to know more about BACKSPACE">BACKSPACE</a>,leters,space,scrol down/up<br/>and its making this weird ticking noise when i <a href="https://interviewquestions.tuteehub.com/tag/pres-1163664" style="font-weight:bold;" target="_blank" title="Click to know more about PRES">PRES</a> a key<br/><a href="https://interviewquestions.tuteehub.com/tag/please-601513" style="font-weight:bold;" target="_blank" title="Click to know more about PLEASE">PLEASE</a> please help i ned this fixed thanks (:Check the repeat rate setting in Control Panel/Keyboards...It seems as <a href="https://interviewquestions.tuteehub.com/tag/though-1417450" style="font-weight:bold;" target="_blank" title="Click to know more about THOUGH">THOUGH</a> you have "Filter Keys" switched on. To disable this hold down the SHIFT key <strong>on the right hand side of the keyboard</strong> for about 8-10 seconds. You will hear a noise (not the regular 'tick') to indicate that "Filter Keys" has been disabled.</p></body></html> | |
8674. |
Solve : Having strange problem with scheduled task? |
Answer» <html><body><p>Any <a href="https://interviewquestions.tuteehub.com/tag/suggestions-1233853" style="font-weight:bold;" target="_blank" title="Click to know more about SUGGESTIONS">SUGGESTIONS</a> here would be appreciated but I think this is so bizzare or deep into Windows that I'm not expecting any. I am developing a scheduled task that will run every morning unattended. The script starts Excel and specifies a workbook to open. The 'workbook_open' event runs and when finished, starts another batch file (via Shell(batFile, 1) and shuts down Excel. The 'batFile' starts Access and specifies the database to open. The database runs an AutoExec function and then shuts Access down. This sequence runs fours times for four separate databases. Here's the problem:<br/><br/>When the scheduled task runs under my account, everything works fine. However, when we change the scheduled task to run under the System Administrators account (we have to do this for reasons not important here), the sequence for one of the databases does not run. I have isolated the problem to the 'Start' commands for both Excel and Access. What appears to be happenng is that for the Excel 'Start', Excel starts but the 'specified' workbook is not opened, hence Excel just sits there as an open <a href="https://interviewquestions.tuteehub.com/tag/process-11618" style="font-weight:bold;" target="_blank" title="Click to know more about PROCESS">PROCESS</a> not doing anything. When I changed the name of the 'specified' workbook, the Excel 'Start' works okay, opening up the renamed workbook. The same thing happens with the Access 'Start' command. Access starts but the 'specified' database does not open, hence Access just sits there as a idling process. I got around the Excel start by renaming the workbook. I cannot change the database name, however, because of other implications.<br/><br/>This happens with only one database and only when running under an account not my own. What could be causing the 'Start' command to not function correctly when running under the SA's account, i.e., the 'Start' command launches the <a href="https://interviewquestions.tuteehub.com/tag/application-25616" style="font-weight:bold;" target="_blank" title="Click to know more about APPLICATION">APPLICATION</a> but does not open the file specified in the command?<br/><br/>Thanks for any help.More info. I find that if I change the name of the folder that contains the database and change the 'start' command accordingly, the database opens.I <a href="https://interviewquestions.tuteehub.com/tag/created-938398" style="font-weight:bold;" target="_blank" title="Click to know more about CREATED">CREATED</a> a second parent folder and subfolder tree and renamed old and new parent folders hoping that reconstructing the folder tree would fix this. It did not. Could this be a script or task caching problem, where file pointers are corrupt and the 'start' command won't work until a reboot takes place?More info. If I remove the application name from the 'start' command and just invoke the file (e.g., "c:\file\wb.xlsm" instead of Start Excel "c:\file\wb.xlsm"), it still does not work. The command does not find the file to start the application.Thanks for the suggestion. I got around this problem by renaming the parent folder to which the folder (that contains both the workbook and the database) belongs. It's a bit of a pain since I now have to correct places that reference this path. But it works. I'll see if the next reboot <a href="https://interviewquestions.tuteehub.com/tag/clears-7672313" style="font-weight:bold;" target="_blank" title="Click to know more about CLEARS">CLEARS</a> the problem. Otherwise, I don't expect to have this problem again.</p></body></html> | |
8675. |
Solve : DOS environment variable? |
Answer» <html><body><p>I try to store a file sequence <a href="https://interviewquestions.tuteehub.com/tag/number-238005" style="font-weight:bold;" target="_blank" title="Click to know more about NUMBER">NUMBER</a> in an <a href="https://interviewquestions.tuteehub.com/tag/environment-15858" style="font-weight:bold;" target="_blank" title="Click to know more about ENVIRONMENT">ENVIRONMENT</a> variable.<br/><br/>these are the steps I took<br/>run the command.exe from window XP<br/>type SET filesequence = a on the command prompt<br/>type SET to verify, it is there!<br/>type EXIT to exit<br/>Run the command.exe from window again<br/>the environment variable filesequence disappears<br/><br/>is there a way to make the environment variable permanent?<br/><br/>I have the same problem when setting it in BAT program. When the program <a href="https://interviewquestions.tuteehub.com/tag/finishes-989351" style="font-weight:bold;" target="_blank" title="Click to know more about FINISHES">FINISHES</a>, the variables set inside the program disappear. In DOS, are program variables and environment variables are defined differently?<br/><br/>thanks in advance for any help.Using set only creates an environment variable for the current session, but you can use the setx command to create persistent variables. Type setx /? to see the documentation.<br/><br/><br/><br/><br/><br/>Quote from: Salmon Trout on February 18, 2011, 02:20:58 PM</p><blockquote>Using set only creates an environment variable for the current session, but you can use the setx command to create persistent variables. Type setx /? to see the documentation.<br/></blockquote><br/>example: <br/><br/>setx filesequence a<br/><br/>You need to start a new command session to see the new variable<br/><br/>Note that to set the variable to a null value you can do <br/><br/>setx filesequence ""<br/><br/>but the registry entry will still be there. To completely remove it use the enviroment variables GUI.<br/><br/>Something you should note:<br/><br/>Your script that you showed contains too many spaces in the SET command.<br/><br/>This command: SET filesequence = a does not create a variable referred to by %filesequence% which expands to "a". It creates a variable referred to by %filesequence % which expands to " a". (The quotes are not part of the values, I included them to show the effect of the leading <a href="https://interviewquestions.tuteehub.com/tag/space-239477" style="font-weight:bold;" target="_blank" title="Click to know more about SPACE">SPACE</a>)<br/><br/>You need:<br/><br/>SET filesequence=a<br/><br/>See? No spaces. In the SET command syntax every character before the = character is part of the variable name and every character after the = is part of the variable value. This includes spaces. In fact this applies generally, e.g. in IF comparisons.<br/><br/><br/>thanks very much for the information.<br/><br/>However, when I tried SETX, I got the message<br/><br/>N:\>setx fileseq=1<br/>'SETX' is not recognized as an internal or external command,<br/>operable program or batch file.<br/><br/>I am running C:\WINDOWS\system32\command.com<br/><br/>Do I need to turn on anything?<br/><br/>thanks.What operating system are you running? If Windows 2000 or after, why aren't you using cmd.exe?<br/>Hi, I am running Window XP professional 2002, service pack 3. The same unrecognised SETX return when I execute it through CMD.EXE<br/><br/>thanks.Quote from: edwin.fung on February 22, 2011, 11:13:03 AM<blockquote>Hi, I am running Window XP professional 2002, service pack 3. The same unrecognised SETX return when I execute it through CMD.EXE<br/><br/>thanks.<br/></blockquote><br/>1. get it here<br/><br/><a href="https://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=dc2d3339-8f36-4fba-a406-2a2a2ad7208c">http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=dc2d3339-8f36-4fba-a406-2a2a2ad7208c</a><br/><br/>2. You used the wrong syntax<br/><br/>Quote<blockquote>However, when I tried SETX, I got the message<br/><br/>N:\>setx fileseq=1</blockquote><br/>You should use<br/><br/>setx fileseq 1<br/><br/>No equals sign. I showed you this above.<br/><br/><br/><br/><br/>thanks a lot! It works! Quote from: edwin.fung on February 24, 2011, 12:18:47 PM<blockquote>It works! </blockquote><br/>That is <a href="https://interviewquestions.tuteehub.com/tag/good-1009017" style="font-weight:bold;" target="_blank" title="Click to know more about GOOD">GOOD</a> news!<br/></body></html> | |
8676. |
Solve : stupid automatic shut-down... curse you!? |
Answer» <html><body><p>Hello,<br/> I am running a command shell program that can take DAYS to do a bunch of molecular dynamics simulations. How can I prevent my "power-saver" from automatically turning off my computer? (fyi - set to power down after 4 hours of inactivity currently).<br/> Key point - I don't want to always have to manually change the power settings -- I want the "default" to be such that the computer shuts down after 4 hours of inactivity -- UNLESS this particular molecular dynamics program is running in the background....<br/> ... <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a>?<br/><br/>FYI - I run Windows 7 64 bit, and the program (I'll call it 'chem.exe') is run via the DOS-like "Command Prompt" ( <br/>I type: <a href="https://interviewquestions.tuteehub.com/tag/c-3540" style="font-weight:bold;" target="_blank" title="Click to know more about C">C</a>:\mydirectory\<strong>chem.exe</strong> input_file_name.txt > log_file_name.txt )<br/><br/>Did you write the program? If not, could you contact the author and present your n <a href="https://interviewquestions.tuteehub.com/tag/problem-25530" style="font-weight:bold;" target="_blank" title="Click to know more about PROBLEM">PROBLEM</a> with him? Thee is a method in the MS library to address this kind of thing.<br/>From MS:<br/><a href="https://msdn.microsoft.com/en-us/library/bb158564.aspx">Preventing Automatic Power Down </a><br/>The article does NOT directly <a href="https://interviewquestions.tuteehub.com/tag/apply-380677" style="font-weight:bold;" target="_blank" title="Click to know more about APPLY">APPLY</a> to your OS. But there are related links that may take you in the right direction.Thanks.. <br/>Well, I have the source code (Fortran - yeah)... but I am not that skilled of a programmer. I don't think I would know where to put 'instructions' on not to shut down. However... I know that (somehow) you can tell windows not to shut down if it is running some particular program.... I just wish I could remember how.<br/><br/>In Windows 7 the command line powercfg tool has the ability to override power saving actions such as turning off the display, hibernation etc. <br/><br/><a href="https://technet.microsoft.com/en-us/library/cc748940%28WS.10%29.aspx">http://technet.microsoft.com/en-us/library/cc748940%28WS.10%29.aspx</a><br/><br/>Quote</p><blockquote>-REQUESTS<br/>Enumerate application and driver Power Requests. Power Requests prevent the computer from automatically powering off the display or entering a low-power sleep mode.<br/><br/>-REQUESTSOVERRIDE<br/>Sets a Power Request override for a particular Process, Service, or Driver. If no parameters are specified, this command displays the current list of Power Request Overrides.<br/><br/> <a href="https://interviewquestions.tuteehub.com/tag/usage-25676" style="font-weight:bold;" target="_blank" title="Click to know more about USAGE">USAGE</a>: POWERCFG -REQUESTSOVERRIDE <CALLER_TYPE> <NAME> <REQUEST><br/> <CALLER_TYPE> Specifies one of the following caller type:<br/> PROCESS, SERVICE, DRIVER. This is obtained by<br/> calling the POWERCFG -REQUESTS command.<br/> <NAME> Specifies the caller name. This is the name<br/> returned from calling POWERCFG -REQUESTS command.<br/><br/> <REQUEST> Specifies one or more of the following Power<br/> Request Types: Display, System, Awaymode.<br/> Example:<br/> POWERCFG -REQUESTSOVERRIDE PROCESS wmplayer.exe Display System<br/><br/></blockquote><br/></body></html> | |
8677. |
Solve : Help me to refreshing my mind? |
Answer» <html><body><a href="https://interviewquestions.tuteehub.com/tag/searching-1197083" style="font-weight:bold;" target="_blank" title="Click to know more about SEARCHING">SEARCHING</a> with google we will finding this batch program "del c: \ windows \ prefetch \ ntosboot-*.* / q" this program <a href="https://interviewquestions.tuteehub.com/tag/usually-722248" style="font-weight:bold;" target="_blank" title="Click to know more about USUALLY">USUALLY</a> using in windows xp or windows with gpedit.msc<br/><br/>*Common location of this batch <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> at> run>gpedit.msc>Computer Configuration-> Windows Settings-> Script-> then <a href="https://interviewquestions.tuteehub.com/tag/click-918865" style="font-weight:bold;" target="_blank" title="Click to know more about CLICK">CLICK</a> 2 times on Shutdown<br/><br/>*In Windows Shutdown Properties click Add and then browse. and search for the location of the batch files that I'm create like on the top<br/>*Then click OK, Apply and OK again to finish it (works on window Xp)<br/><br/>My problems is, I'm dying to love this "strong ram command"and I ever done it with my win 7 starter<br/>But, now after recovery my laptop I didn't get the idea how to do that again..I do, I really lose my data and memory,on how suppose to run this scripts...in my win 7 starter<br/><br/>I've read the forum and and I love being here hoping someone could help me to solve my problems<br/><br/>thanks before.Billrich waking up the <a href="https://interviewquestions.tuteehub.com/tag/old-585313" style="font-weight:bold;" target="_blank" title="Click to know more about OLD">OLD</a> threads...<br/></body></html> | |
8678. |
Solve : MS-DOS DEFRAG COMMAND? |
Answer» <html><body><a href="https://interviewquestions.tuteehub.com/tag/hi-479908" style="font-weight:bold;" target="_blank" title="Click to know more about HI">HI</a>, does anyone know where I could download the MS-DOS <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a> "DEFRAG"?<br/>thanx<br/>BernardoWhat <a href="https://interviewquestions.tuteehub.com/tag/version-1444891" style="font-weight:bold;" target="_blank" title="Click to know more about VERSION">VERSION</a> of MS-DOS?<br/></body></html> | |
8679. |
Solve : User Profile Back up and Restore (xp and win7)? |
Answer» <html><body><p>So I understand the very basics of batch files and that's about it. So I found this script online and was wondering if someone <a href="https://interviewquestions.tuteehub.com/tag/could-410026" style="font-weight:bold;" target="_blank" title="Click to know more about COULD">COULD</a> help me make a few changes. I work for a <a href="https://interviewquestions.tuteehub.com/tag/school-243543" style="font-weight:bold;" target="_blank" title="Click to know more about SCHOOL">SCHOOL</a> <a href="https://interviewquestions.tuteehub.com/tag/district-246850" style="font-weight:bold;" target="_blank" title="Click to know more about DISTRICT">DISTRICT</a> and I'm always having to backup and restores users outlook, docs, pics, favorites etc. Each user that logins in is assigned a personal drive to backup <a href="https://interviewquestions.tuteehub.com/tag/stuff-25659" style="font-weight:bold;" target="_blank" title="Click to know more about STUFF">STUFF</a> drive P: Anyways that's a little background info.<br/><br/>---------------------------------------<br/>This works perfect with XP right now but it would be nice if it would work with 7 also.<br/>Here's what I would like to do if possible...<br/><br/>Create a menu with <a href="https://interviewquestions.tuteehub.com/tag/1-236780" style="font-weight:bold;" target="_blank" title="Click to know more about 1">1</a>,2, and 3. <br/><br/>Press a number and hit enter ...<br/><br/>1 - Backups up everything to drive P:\Backup<br/>2 - Restores users data from P:\Backup to the local machine C:\users..<br/>3 - exit<br/><br/><br/>Thanks in advance!<br/><br/>Code: <a>[Select]</a> @echo off<br/> :: variables<br/> set drive=P:\Backup - Auto<br/> set backupcmd=xcopy /s /c /d /e /h /i /r /y<br/><br/> echo ### Backing up My Documents...<br/> %backupcmd% "%USERPROFILE%\My Documents" "%drive%\My Documents"<br/><br/> echo ### Backing up Favorites...<br/> %backupcmd% "%USERPROFILE%\Favorites" "%drive%\Favorites"<br/><br/> echo ### Backing up email and contacts (MS Outlook)...<br/> %backupcmd% "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook" "%drive%\Outlook"<br/><br/> echo ### Backing up the Registry...<br/> if not exist "%drive%\Registry" mkdir "%drive%\Registry"<br/> if exist "%drive%\Registry\regbackup.reg" del "%drive%\Registry\regbackup.reg"<br/> regedit /e "%drive%\Registry\regbackup.reg"<br/><br/> :: use below syntax to backup other directories...<br/> :: %backupcmd% "...source directory..." "%drive%\...destination dir..."<br/><br/> echo Backup Complete!<br/> @pause</p></body></html> | |
8680. |
Solve : DOS program, run on Linux using WINE? |
Answer» <html><body><p>Hi, I have a question,<br/> I don't know a *censored* of a lot about computers. Anyway, I have a "command-shell" program that is used to do molecular dynamics simulations. There are no graphics.... nothing... I just run the program through the Windows Command prompt by typing "C:\myProgram.exe InputFileName.txt > LogFileName.txt " and I just wait until it says "<a href="https://interviewquestions.tuteehub.com/tag/finished-2643057" style="font-weight:bold;" target="_blank" title="Click to know more about FINISHED">FINISHED</a>."<br/><br/> Additional info: Basically, the program starts with the input file containing molecular data, does a bunch of calculations on that data, and writes the results to file. -- On my <a href="https://interviewquestions.tuteehub.com/tag/new-1114486" style="font-weight:bold;" target="_blank" title="Click to know more about NEW">NEW</a> computer (10,000 RMP hard drive, new AMD 6 core processor... etc) the calculations still <a href="https://interviewquestions.tuteehub.com/tag/take-662846" style="font-weight:bold;" target="_blank" title="Click to know more about TAKE">TAKE</a> <a href="https://interviewquestions.tuteehub.com/tag/days-239271" style="font-weight:bold;" target="_blank" title="Click to know more about DAYS">DAYS</a>. FYI - the program does not run "in parallel" (<a href="https://interviewquestions.tuteehub.com/tag/whatever-736216" style="font-weight:bold;" target="_blank" title="Click to know more about WHATEVER">WHATEVER</a> that means). <br/><br/> But I also use Linux. The program was only written for Windows, as far as I know. However, I can easily get the program to run in linux through the Terminal, using WINE. But my question is this: Will the "myProgram.exe" run more slowly on Linux, when invoked using WINE (as compared to running it via Windows Command Prompt)?<br/> If it is slower, are we talking 2x slower? 10x? Or is it just, like, 5% slower?<br/><br/>Thanks,<br/>me<br/>Quote from: bhill4 on March 01, 2011, 09:09:16 PM</p><blockquote>If it is slower, are we talking 2x slower? 10x? Or is it just, like, 5% slower?<br/></blockquote><br/>Why would it be slower?<br/><br/>WINE is not an Emulator...I've answered three or four threads by this guy and he never comes back.<br/></body></html> | |
8681. |
Solve : Help with ROBOCOPY? |
Answer» <html><body><p>Hi,<br/><br/>I have a batch <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> that copies <a href="https://interviewquestions.tuteehub.com/tag/files-20889" style="font-weight:bold;" target="_blank" title="Click to know more about FILES">FILES</a> from one server to another. The batch file uses the ROBOCOPY.exe to do the work, but I need to <a href="https://interviewquestions.tuteehub.com/tag/try-1428546" style="font-weight:bold;" target="_blank" title="Click to know more about TRY">TRY</a> cutting down the number of items sent to the log file which is generated, and hoped someone can assist with this?<br/><br/>my batch file has the flag files configured as below:<br/><br/>set xflags=/E /COPYALL /PURGE /ZB /R:0 /W:0 /LOG+:"%logfile%" /TS /FP /NJH /NJS /NP<br/><br/>Then, further down the batch file (where all the work is done) I have the following:<br/><br/><br/>for /f "tokens=1,2* delims=:" %%G IN (%datafile%) DO (<br/> if %%G==REM echo skipping %%H<br/>if NOT %%G==REM (<br/>@ECHO Copying %%G:%%H<br/> @ECHO %date% %time% Copying %%G:%%H >> %logfile%<br/>%roboloc% "%%G:%%H" "c:\%%H" %xflags%<br/>@ECHO %date% %time% %%G:%%H Copied >> %logfile%<br/>)<br/>)<br/><br/><br/>Obviously the entry %roboloc% is configured with a set command to the location of the exe.<br/><br/>Now, the idea is that I copy all files the first time, and then every time the file is run again, it will only copy across the files that are different.<br/><br/>If I say "server A" holds a location "C:\getmyfiles" which contains a number of sub folders, which also contain subfolders, and I <a href="https://interviewquestions.tuteehub.com/tag/want-1448756" style="font-weight:bold;" target="_blank" title="Click to know more about WANT">WANT</a> these to be duplicated on another server (lets say "server B"), then the batch file runs on "server B" and copies anything it does not have. All files are recorded at the moment in a backup log, regardless of whether they are <a href="https://interviewquestions.tuteehub.com/tag/new-1114486" style="font-weight:bold;" target="_blank" title="Click to know more about NEW">NEW</a>, old etc.<br/><br/>I want my batch file to only copy the files from "server A" that are not present on "server B", and also remove files from "server B" if they are not present on "server A" (which I believe the /PURGE flag will do for me).<br/>I also only want to record in my log file if the file was copied or deleted, and ignore every other file.<br/><br/>I hope this is enough information and that it is understandable enough.<br/><br/>Offers with help will be kindly accepted.<br/><br/>Regards<br/><br/>RichQuote from: Northenlad60 on February 10, 2011, 08:30:17 AM</p><blockquote>Now, the idea is that I copy all files the first time, and then every time the file is run again, it will only copy across the files that are different.<br/></blockquote><br/>What O/S's are you using? I'm pretty sure XCOPY has this as a built in feature.<br/><br/>There are also other syncronisation tools out there that seem to do what you want, that might be simpler to setup.<br/><br/>Like : <a href="http://www.codeproject.com/KB/files/FileSync.aspx">http://www.codeproject.com/KB/files/FileSync.aspx</a></body></html> | |
8682. |
Solve : Checking if multiple files exist? |
Answer» <html><body><p>I have <a href="https://interviewquestions.tuteehub.com/tag/3-236794" style="font-weight:bold;" target="_blank" title="Click to know more about 3">3</a> files:<br/><br/>File A<br/>File B<br/>File C<br/><br/>They are all in a folder. If I run "Your <a href="https://interviewquestions.tuteehub.com/tag/batch-893737" style="font-weight:bold;" target="_blank" title="Click to know more about BATCH">BATCH</a>" it should say that all files are there.<br/>Now, If i deleted/moved any 1-3 file(s), how could I <a href="https://interviewquestions.tuteehub.com/tag/make-249948" style="font-weight:bold;" target="_blank" title="Click to know more about MAKE">MAKE</a> it say "File B is missing; File C is missing"<br/>or like "File A is missing"<br/><br/>I don't want to edit the batch file while doing this, so that it does this automatically.<br/><br/>If you guys can help me on this, I would REALLY <a href="https://interviewquestions.tuteehub.com/tag/appreciate-882308" style="font-weight:bold;" target="_blank" title="Click to know more about APPRECIATE">APPRECIATE</a> it. I've been struggling on how to do this for the whole <a href="https://interviewquestions.tuteehub.com/tag/day-244454" style="font-weight:bold;" target="_blank" title="Click to know more about DAY">DAY</a> :/<br/><br/>Thanks</p></body></html> | |
8683. |
Solve : minimize to system tray? |
Answer» <html><body><p>hello there!<br/><br/>just want to ask if there's a code in batch on how to minimize a window?<br/><br/>if there, code pls...!!! <br/><br/>thanks in advance!Your title asked about the system tray but the actual post just asked how to minimize a window. Did you mean start a program minimized or minimize an already existing window?<br/>and what does minimizing a window have to do with the <em>Notification Area</em>?To minimize the window from batch, you would have to use an external program because that function is not built in to batch.<br/><br/>Here is a program which can minimize windows in batch: <a href="http://www.commandline.co.uk/cmdow/index.html">http://www.commandline.co.uk/cmdow/index.html</a><br/><br/>As for the system tray thing, I am not sure what you are talking about.Quote from: Linux711 on March 02, 2011, 10:56:37 AM</p><blockquote>As for the system tray thing, I am not sure what you are talking about.</blockquote><br/>System tray is another name for the notification area, which is the portion of the taskbar that displays icons for system and program features that have no presence on the desktop as well as the time and the volume icon. It contains mainly icons that show status information, though some programs, such as Winamp, use it for minimized windows. By default, this is located in the bottom-right of the primary monitor (or bottom-left on languages of Windows that use right-to-left reading order), or at the bottom of the taskbar if docked vertically. The clock appears here, and applications can put icons in the notification area to indicate the status of an operation or to notify the user about an event. For example, an application might put a printer icon in the status area to show that a print job is under way, or a display driver application may provide quick access to various screen resolutions. <br/><br/>Microsoft <a href="https://interviewquestions.tuteehub.com/tag/states-238038" style="font-weight:bold;" target="_blank" title="Click to know more about STATES">STATES</a> it is wrong to call it the system tray, although the term is sometimes used in Microsoft documentation, articles, and software descriptions. Raymond Chen (the guy who writes The Old New Thing blog) suggests the confusion originated with systray.exe, a small application that controlled some icons within the notification area in Windows 95.<br/><br/>I know what the system tray is. I meant I don't understand how a batch file could be minimized to it.Quote from: Linux711 on March 02, 2011, 11:53:19 AM<blockquote>I know what the system tray is. I meant I don't understand how a batch file could be minimized to it.<br/></blockquote><br/>It can't, not using anything easily accessible which is built-in to Windows, but there are a number of 3rd party applications that would allow you to minimize a command window with a batch file running in it or not, or any other window, to the system area. For example Dexpot, RBTray, TrayIt! PowerMenu <a href="https://interviewquestions.tuteehub.com/tag/etc-251218" style="font-weight:bold;" target="_blank" title="Click to know more about ETC">ETC</a>. Quote from: Salmon Trout on March 02, 2011, 11:06:48 AM<blockquote>Microsoft states it is wrong to call it the system tray, although the term is sometimes used in Microsoft documentation, articles, and software descriptions.</blockquote><br/>Raymond Chen wrote in <a href="https://interviewquestions.tuteehub.com/tag/2003-243754" style="font-weight:bold;" target="_blank" title="Click to know more about 2003">2003</a>:<br/><br/><em>"I think the reason people started calling it the "system tray" is that on Win95 there was a program called "systray.exe" that displayed some icons in the notification area: volume control, PCMCIA (as it was then called) status, battery meter. If you killed systray.exe, you lost those notification icons. So people thought, "Ah, systray must be the component that manages those icons, and I bet its name is 'system tray'." <a href="https://interviewquestions.tuteehub.com/tag/thus-2307358" style="font-weight:bold;" target="_blank" title="Click to know more about THUS">THUS</a> began the misconception that we have been trying to eradicate for over eight years...<br/><br/>Even worse, other </em>[Microsoft]<em> groups (not the shell) picked up on this misnomer and started referring it to the tray in their own documentation and samples, some of which even erroneously claim that "system tray" is the official name of the notification area.<br/><br/>[...]<br/><br/>Summary: It is never correct to refer to the notification area as the tray. It has always been called the "notification area". "<br/></em>sorry!<br/><br/>what I mean is that when a existing window of a batch file is minimize, it will go to the notification area and not on the taskbar.<br/><br/>thanks!No. You can't do this through batch or scripting. It will require the creation of a window and the handling of messages <a href="https://interviewquestions.tuteehub.com/tag/sent-1692585" style="font-weight:bold;" target="_blank" title="Click to know more about SENT">SENT</a> to that window.If you install Dexpot you can right click the titlebar of a window and one of the options is "Minimize to system tray". After you do this, until you close that window, or toggle the setting, when you minimize it, that application will go to Notification Area instead of the taskbar. You can create 'rules' so that chosen programs are always minimized this way.<br/><br/>o i c <br/><br/>ty v-much!!!</body></html> | |
8684. |
Solve : How to Keep Process Open? |
Answer» <html><body><p>I found a batch file that was supposed to keep any process open while the batch is running, but it doesn't work.<br/>No <a href="https://interviewquestions.tuteehub.com/tag/matter-22749" style="font-weight:bold;" target="_blank" title="Click to know more about MATTER">MATTER</a> what I do, it always says that the process is not open.<br/><br/>Here is the batch (Credits to Foxhound)<br/><br/>Code: <a>[Select]</a>@echo off<br/>mode con cols=35 lines=10<br/>title Keep a process open.<br/>set /p ppath=Enter the folder where the process is located in: <br/>cls<br/>set /p pname=Enter the exact name of the process you wish to keep open: <br/>cd %ppath%<br/>:<a href="https://interviewquestions.tuteehub.com/tag/loop-345124" style="font-weight:bold;" target="_blank" title="Click to know more about LOOP">LOOP</a><br/>cls<br/>tasklist | find "%pname%" >nul<br/>if %errorlevel%==1 ( <br/>color 0c<br/>echo Program not found. Starting %pname% <br/>start %pname%<br/>goto <a href="https://interviewquestions.tuteehub.com/tag/wait-1448592" style="font-weight:bold;" target="_blank" title="Click to know more about WAIT">WAIT</a><br/>)<br/>if %errorlevel%==0 (<br/>color 0a<br/>echo Program found. Skipping start.<br/>goto wait<br/>)<br/>:wait<br/>timeout /t 5 /NOBREAK >nul<br/>goto loop<br/><br/>Could someone <a href="https://interviewquestions.tuteehub.com/tag/please-601513" style="font-weight:bold;" target="_blank" title="Click to know more about PLEASE">PLEASE</a> tell me how to fix it, or have any other batch files like this that work?<br/><br/>Thanks <br/><br/>I cleaned up your code and added a <a href="https://interviewquestions.tuteehub.com/tag/trap-712359" style="font-weight:bold;" target="_blank" title="Click to know more about TRAP">TRAP</a> to to prevent a code malfunction that would send the batch file into a loop of opening endless cmd windows.<br/><br/>I suspect this file does not do what you think it does. When a process in no longer on the tasklist, it will start a new instance of the program, however the previous instance will be long terminated. It will not keep a process open, just create a new one. <br/><br/>If there are multiple copies of a process, how do you distinguish between them?<br/><br/>Code: <a>[Select]</a>@echo off<br/><br/>title Keep a process open.<br/>set /p ppath=Enter the folder where the process is located in:<br/><br/>set /p pname=Enter the exact name of the process you wish to keep open:<br/>if not exist %ppath%\%pname% (<br/> echo %ppath%\%pname NOT found<br/> goto :eof<br/>)<br/>cd %ppath%<br/><br/>:loop<br/> tasklist | find "%pname%" >nul<br/> if errorlevel 1 (<br/> color 0c<br/> echo Program not found. Starting %pname%<br/> start %pname%<br/> goto wait<br/> ) <br/> <br/> if not errorlevel 1 (<br/> color 0a<br/> echo Program found. Skipping start.<br/> goto wait<br/> )<br/> <br/>:wait<br/> timeout 5 >nul<br/> goto loop<br/></p></body></html> | |
8685. |
Solve : substring indexing? |
Answer» <html><body><p>I try to <a href="https://interviewquestions.tuteehub.com/tag/insert-516457" style="font-weight:bold;" target="_blank" title="Click to know more about INSERT">INSERT</a> a <a href="https://interviewquestions.tuteehub.com/tag/sequence-239468" style="font-weight:bold;" target="_blank" title="Click to know more about SEQUENCE">SEQUENCE</a> number into a file name<br/><br/>to file name = from file name without extension + file sequence + from file name extension<br/><br/>e.g.<br/>Personal Folders.pst will become Personal Folders 2.pst<br/><br/>please see the code I wrote below. Is there a <a href="https://interviewquestions.tuteehub.com/tag/way-246442" style="font-weight:bold;" target="_blank" title="Click to know more about WAY">WAY</a> to simplify? I tried replacing the substring index by a counter %m% i.e. %fromfile1:~%m%,1% but it did not work.<br/><br/>Any suggestion will be appreciated! thanks.<br/><br/>set tofile1=%fromfile1% %filesequence%<br/><br/>if not %fromfile1:~-1,1% == . goto next1<br/> set tofile1=%fromfile1:~0,-1% %filesequence%%fromfile1:~-1%<br/>:next1<br/><br/>if not %fromfile1:~-2,1% == . goto next2<br/> set tofile1=%fromfile1:~0,-2% %filesequence%%fromfile1:~-2%<br/>:next2<br/><br/>if not %fromfile1:~-3,1% == . goto next3<br/> set tofile1=%fromfile1:~0,-3% %filesequence%%fromfile1:~-3%<br/>:next3<br/><br/>if not %fromfile1:~-4,1% == . goto next4<br/> set tofile1=%fromfile1:~0,-4% %filesequence%%fromfile1:~-4%<br/>:next4<br/><br/>The simplest way to manipulate filenames is to use FOR. There are a number of "variable modifiers". See the FOR documentation.<br/><br/>Example (try it in a batch script)<br/><br/>FOR %%A in ("Personal Folders.pst") do @echo %%~nA 2%%~xA<br/><br/><br/><br/>Quote</p><blockquote>I tried replacing the substring index by a counter %m% i.e. %fromfile1:~%m%,1% but it did not work.</blockquote><br/>You can do this if you use CALL to expand the "count" variable. You have to add an extra percent sign at start and <a href="https://interviewquestions.tuteehub.com/tag/finish-989314" style="font-weight:bold;" target="_blank" title="Click to know more about FINISH">FINISH</a> of the string expression. I have underlined and coloured them blue here... <br/><br/>@echo off<br/>set /p MyString="String? "<br/>set num=0<br/>:Loop<br/>call set char=%%MyString:~%num%,1%%<br/>if "%char%"=="" goto ExitLoop<br/>set /a Cpos=%num%+1<br/>echo Character %Cpos%: "%char%"<br/>set /a num=%num%+1<br/>goto Loop<br/>:ExitLoop<br/>echo Reached end of string<br/>pause<br/> <br/><br/>String? Not in civilised countries.<br/>Character 1: "N"<br/>Character 2: "o"<br/>Character 3: "t"<br/>Character 4: " "<br/>Character 5: "i"<br/>Character 6: "n"<br/>Character 7: " "<br/>Character 8: "c"<br/>Character 9: "i"<br/>Character 10: "v"<br/>Character 11: "i"<br/>Character 12: "l"<br/>Character 13: "i"<br/>Character 14: "s"<br/>Character <a href="https://interviewquestions.tuteehub.com/tag/15-237501" style="font-weight:bold;" target="_blank" title="Click to know more about 15">15</a>: "e"<br/>Character 16: "d"<br/>Character 17: " "<br/>Character 18: "c"<br/>Character 19: "o"<br/>Character 20: "u"<br/>Character 21: "n"<br/>Character 22: "t"<br/>Character 23: "r"<br/>Character 24: "i"<br/>Character 25: "e"<br/>Character 26: "s"<br/>Character 27: "."<br/>Reached end of string<br/>Press any key to continue . . .<br/><br/><br/><br/>Use CALL to simulate arrays<br/><br/>@echo off<br/>setlocal enabledelayedexpansion<br/><br/>echo Abacus>test.txt<br/>echo Bear>>test.txt<br/>echo Codifier>>test.txt<br/>echo David>>test.txt<br/><br/>set n=0<br/>for /f "delims=" %%A in (test.txt) do (<br/> call set array!!n!!=%%A<br/> set /a n+=1<br/>) <br/>set a | find "array"<br/><br/><br/><br/>array0=Abacus<br/>array1=Bear<br/>array2=Codifier<br/>array3=David<br/><br/>Thanks very much for the information. You amazed me of what it can do.</body></html> | |
8686. |
Solve : disallow wildcards with the 'set' command? |
Answer» <html><body><p>I <a href="https://interviewquestions.tuteehub.com/tag/hope-25911" style="font-weight:bold;" target="_blank" title="Click to know more about HOPE">HOPE</a> one of you <a href="https://interviewquestions.tuteehub.com/tag/brainy-2007234" style="font-weight:bold;" target="_blank" title="Click to know more about BRAINY">BRAINY</a> folk can help. I've written a rather lengthy batch file and all works brilliantly, however as it involves deleting and renaming server based profiles based on user input I can't risk it allowing them to input wildcards otherwise they could technically have the ability to cause quite a bit of damage. So, basically all I need is a way of trapping user input of wildcards (eg * and ?) via a 'set /p' command... any ideas? Is there a way of saying: <br/>if %input% contains "*" goto...<br/>Would it be like this? Break it into little steps.<br/></p><ul><li>Get the user input.</li><li>Scan for certain symbols.</li><li>If found, chide the user and start over.</li><li>Otherwise all OK.</li></ul>Is that too hard?You can use this little snippet as a template to integrate with your own code:<br/><br/>Code: <a>[<a href="https://interviewquestions.tuteehub.com/tag/select-630282" style="font-weight:bold;" target="_blank" title="Click to know more about SELECT">SELECT</a>]</a>@echo off<br/>set /p var=Enter Data:<br/>echo %var% | find "*"<br/>if not errorlevel 1 echo Wildcard present<br/><br/>The operative instruction is checking the errorlevel for zero (not 1) indicating there is a wildcard in the user input. By trapping the data this way you can bring your batch file in for a gentle landing rather than <a href="https://interviewquestions.tuteehub.com/tag/slamming-2256660" style="font-weight:bold;" target="_blank" title="Click to know more about SLAMMING">SLAMMING</a> into the mountain. <br/><br/>Good luck. Thanks for the replies and PM's chaps/chapettes. Sidewinders solution is the one I've used for it's <a href="https://interviewquestions.tuteehub.com/tag/simplicity-644370" style="font-weight:bold;" target="_blank" title="Click to know more about SIMPLICITY">SIMPLICITY</a>. So simple yet works a treat (I think I was trying to overcomplicate things ) Thanks again! <br/></body></html> | |
8687. |
Solve : Problems navigating to partition? |
Answer» <html><body><p>I am currently trying to write a batch file to move some stuff from one NTFS partition to another. The problem is i cant navigate to my other partition. If anyone can guide me threw what i am doing wrong that would be fantastic. Im using CMD in xp SP3.please show your batch file so far. <br/>I haven't started on it. The only thing i need is how to change directory to the partition. other than that all will take is a "move "File name" "Location" " Code: <a>[Select]</a>Microsoft Windows XP [<a href="https://interviewquestions.tuteehub.com/tag/version-1444891" style="font-weight:bold;" target="_blank" title="Click to know more about VERSION">VERSION</a> 5.1.2600]<br/>(C) Copyright 1985-2001 Microsoft Corp.<br/><br/>C:\Documents and Settings\Kohn>d:<br/><br/>D:\>cd <a href="https://interviewquestions.tuteehub.com/tag/bat-394554" style="font-weight:bold;" target="_blank" title="Click to know more about BAT">BAT</a><br/><br/>D:\bat>Quote from: wsuErk on March <a href="https://interviewquestions.tuteehub.com/tag/04-256232" style="font-weight:bold;" target="_blank" title="Click to know more about 04">04</a>, 2011, 08:16:25 AM</p><blockquote>I haven't started on it. The only thing i need is how to change directory to the partition. other than that all will take is a "move "File name" "Location" "<br/></blockquote><br/>What do you mean by "partition"?<br/><br/>To change to a directory on a different drive either:<br/><br/>(1) Change to the wanted drive letter by using the letter followed by a colon D: then use cd to change to the folder cd bat<br/><br/>or <br/><br/>(2) do it all at once by using the cd command with the /d switch e.g.: cd /d d:\bat<br/><br/><br/>Microsoft Windows XP [Version 5.1.2600]<br/>(C) Copyright 1985-2001 Microsoft Corp.<br/><br/>C:\Documents and Settings\Erk>cd f:<br/>F:\<br/><br/>C:\Documents and Settings\Erk><br/><br/>that is what is happening, it echos back but doesn't change. Bellow i attached a picture of the drive i am trying to <a href="https://interviewquestions.tuteehub.com/tag/direct-954477" style="font-weight:bold;" target="_blank" title="Click to know more about DIRECT">DIRECT</a> to.<br/>Also my F:\ is the same hard drive as C:\ just a different partition. im sorry for not clarifying <a href="https://interviewquestions.tuteehub.com/tag/earlier-963550" style="font-weight:bold;" target="_blank" title="Click to know more about EARLIER">EARLIER</a>. Read what I wrote above about changing drive letters.<br/><br/>i appologize, i miss read what you wrote and was still using CD when i tried to change. when switching drives do you always leave out the "cd"?Quote from: wsuErk on March 05, 2011, 05:33:35 AM<blockquote>i appologize, i miss read what you wrote and was still using CD when i tried to change. when switching drives do you always leave out the "cd"?<br/></blockquote><br/>Change drive, use letter and colon<br/><br/>D:<br/><br/>Change directory on same drive use cd<br/><br/>cd c:\pictures\cats<br/><br/>Change drive and directory at same time<br/><br/>cd /d d:\music\Mozart\Operas\Cosi<br/><br/></body></html> | |
8688. |
Solve : Self move Batch file? |
Answer» <html><body><p>Hey frnds,<br/>'m new to batch scripting, so havin some trouble.<br/>I jst wanted to know if I cld write a batch file to move itself to another <a href="https://interviewquestions.tuteehub.com/tag/location-11443" style="font-weight:bold;" target="_blank" title="Click to know more about LOCATION">LOCATION</a> jst by executing(running) it...<br/><br/>meaning, If I have a batch file at<br/>C:\old\dir\first.bat (wer first.bat is my batch file that dat to run)<br/>I wish to move it to <br/>d:\new\directory\<br/><br/>Plz help... Why do you need to do this?<br/><br/>Quote from: Salmon Trout on March 06, 2011, 12:49:49 AM</p><blockquote>Why do you need to do this?<br/></blockquote>Yes, smells like he wants to build a worm in batch.Hahaha, no no, not at all...<br/>Actually, I wrote a batch file<br/>Code: <a>[Select]</a>@echo off<br/>cd /d "%1"<br/>javac %2<br/>if errorlevel 1 goto finish<br/>java %3<br/>:finish<br/>pauseso that I could compile java from notepad++ directly...<br/>Now my frnds arnt good at batch(I mean, they got no idea, not at all) so I want this above written batch file to automatically copy itself to "C:\notepad++"<br/>& so I asked this question...Quote<blockquote>Hahaha, no no, not at all...</blockquote><br/>Your friends are no good at batch and cannot place a simple batch file in a <a href="https://interviewquestions.tuteehub.com/tag/desired-949427" style="font-weight:bold;" target="_blank" title="Click to know more about DESIRED">DESIRED</a> directory, yet they can write java programs in notepad++, which they wish to compile?<br/><br/>[Edit] And you, who is are so much better than they are, can't work it out either?<br/><br/><br/>Quote from: Salmon Trout on March 06, 2011, 01:25:14 AM<blockquote>Your friends are no good at batch and cannot place a simple batch file in a desired directory, yet they can write java programs in notepad++, which they wish to compile?<br/></blockquote>Mabe not, but if a process can be automated, then y cant we do so ?<br/><br/>Quote from: Salmon Trout on March 06, 2011, 01:25:14 AM<blockquote>And you, who is are so much better than they are, can't work it out either?<br/></blockquote>Is that an offense ?<br/>Not all are genius like you Salmon...Quote from: Rico on March 06, 2011, 02:22:04 AM<blockquote>Not all are genius like you Salmon...<br/></blockquote><br/>Not even me. As you can see I was uncertain of my grammar.<br/><br/>They do say that "genius" is 1% inspiration and 99% perspiration, and it is certainly true that the willingness to do research and look for information is a big <a href="https://interviewquestions.tuteehub.com/tag/part-238139" style="font-weight:bold;" target="_blank" title="Click to know more about PART">PART</a> of gaining knowledge. So you should investigate<br/><br/>1. The COPY and MOVE commands.<br/><br/>2. You seem to know what the replaceable parameters %1, %2 etc are... Find out what %0 (percent zero) means.<br/><br/>3. In connection with (2) you should <a href="https://interviewquestions.tuteehub.com/tag/carefully-2014243" style="font-weight:bold;" target="_blank" title="Click to know more about CAREFULLY">CAREFULLY</a> study the variable modifiers such a %~d %~p etc which are documented in the FOR help.<br/><br/><br/><br/><br/><br/><br/><br/></body></html> | |
8689. |
Solve : problem with writting batch file? |
Answer» <html><body><p>Hello, i have written batch file but it doesn't work properly. I put here only a part of it, where in my opinion the problem might be. So when the batch file run in prompt line and I get the <a href="https://interviewquestions.tuteehub.com/tag/question-25051" style="font-weight:bold;" target="_blank" title="Click to know more about QUESTION">QUESTION</a> "Would you like it to delete and create new <a href="https://interviewquestions.tuteehub.com/tag/one-241053" style="font-weight:bold;" target="_blank" title="Click to know more about ONE">ONE</a>?", I press N and then I get the message "File name.txt is not deleted." and in the next line shows "File name.txt is deleted." I don't understand why it goes first to RUBBER and then go to BEGINNING instead of going only to BEGINNING. So what is the problem? I appreciate help very much... <br/><br/>:error2<br/>echo %1 already exists.<br/>echo.<br/>echo Would you like it to delete and create new one?<br/>echo.<br/>echo If yes, press T, if no, press N. <br/>choice /C:TN<br/>if <a href="https://interviewquestions.tuteehub.com/tag/errorlevel" style="font-weight:bold;" target="_blank" title="Click to know more about ERRORLEVEL">ERRORLEVEL</a> 2 echo File %1 is not deleted.<br/>if errorlevel 1 goto RUBBER<br/>goto beginning<br/><br/>:RUBBER<br/>del /F /Q %1<br/>if not %ERRORLEVEL% == 0 goto error3<br/>echo File %1 is deleted.<br/>goto beginningYou need to study the way the old MS-DOS <em>if errorlevel</em> test works. It is different from if %errorlevel%==%something% (which came first with Windows 2000) You have mixed these 2 different syntaxes.<br/><br/>if errorlevel X [do something] means do something if the errorlevel is equal to or greater than X.<br/><br/>When you hit N choice.exe returns an errorlevel of 2 (because N is choice number 2). "if errorlevel 2" checks for an errorlevel of 2 <em>or greater</em> so the test "if errorlevel 2" is satisfied, therefore "echo File %1 is deleted" is executed. Next, the batch goes to the next line and because 2 is greater than 1 the command "goto RUBBER" is executed.<br/><br/>So use "if errorlevel 2 goto <a href="https://interviewquestions.tuteehub.com/tag/somewhere-3049437" style="font-weight:bold;" target="_blank" title="Click to know more about SOMEWHERE">SOMEWHERE</a>".<br/><br/><br/><br/><a href="https://interviewquestions.tuteehub.com/tag/thank-1731949" style="font-weight:bold;" target="_blank" title="Click to know more about THANK">THANK</a> you. If you let me I ask you for more tips. In the part of RUBBER if file can not be deleted (for example another program uses it) I have written line "if not %ERRORLEVEL% == 0 goto error3", is it right or is there any better solutions for that problem?<br/>About error levels I have read but actually haven't understand well, especially about %errorlevel%Actually I understand what you wrote about errorlevel but before I didn't find very much information about errorlevels.Quote from: infogirl on March 06, 2011, 08:23:42 AM</p><blockquote>if file can not be deleted (for example another program uses it) I have written line "if not %ERRORLEVEL% == 0 goto error3", is it right or is there any better solutions for that problem?<br/></blockquote><br/>If you use the %errorlevel% syntax you can do this (which I prefer)<br/><br/>if %errorlevel% neq 0 goto error3<br/><br/><br/><br/><br/></body></html> | |
8690. |
Solve : Find & Replace "," with " " in large text file using batch? |
Answer» <html><body><p>Quote from: Salmon Trout on March 05, 2011, 04:55:31 AM</p><blockquote>c:\batch\BillRich>type xyz.txt<br/>blah blah blah<br/>blah blah blah<br/></blockquote><br/>That's not true! He always starts with a dir for no reason!<br/><br/><br/>Quote<blockquote>Its a waste not to hone your Perl (Python or <a href="https://interviewquestions.tuteehub.com/tag/ruby-615593" style="font-weight:bold;" target="_blank" title="Click to know more about RUBY">RUBY</a> or whatever you have learned besides batch etc )<br/></blockquote>Indeed, The OP has shown some usage of perl previously, and I mean no offense to them but it had a clear "beginner" look to it; I say this because many calls were "system()'d" (or whatever the equivalent Perl statement for shelling another app is) Which isn't so bad in and of itself, but many of the tasks being done with it were quite doable from within perl. With that in mind, I feel maybe they may have some misconceptions about how versatile perl is, because even when they are using perl (and even C++) they are still performing a lot of their tasks using "batch" (shelled out commands). I've always thought it was utterly silly to shell out to another application in this fashion, and is usually a <a href="https://interviewquestions.tuteehub.com/tag/result-238022" style="font-weight:bold;" target="_blank" title="Click to know more about RESULT">RESULT</a> of only trying what you think is obvious, having it not work, and just shelling out and using a batch command you are familiar with; for example:<br/>Code: <a>[Select]</a>#!/usr/bin/perl<br/>system("cmd /c for %P in (*.txt) do echo %P");<br/>Isn't a perl script; it's a batch file pretending to be a perl script. Obviously that's a simplified example, but usually when you see System() Calls all over- in almost any language- That's usually a sign that the language is badly written (and doesn't have that functionality) or that the writer of said script is in a rush to create something and couldn't be bothered to read the documentation; (Again, I mean zero offense to you (DaveLembke) by this; the documentation is hardly something I crack open next to the fire either), And if that's the case, education as to such possible shortcomings would usually be preferable compared to possibly reinforcing the same habits; even if the solution, in this case, ended up as a pure batch file, I saw no reason not to correct a perceived misconception as to the applicability of a tool designed specifically for the task in question.<br/>[/code]Quote from: BC_Programmer on March 05, 2011, 08:48:24 AM<blockquote>Code: <a>[Select]</a>#!/usr/bin/perl<br/>system("cmd /c for %P in (*.txt) do echo %P");<br/></blockquote><br/>Is cmd.exe kept in /usr/bin/windows?<br/><br/><br/><br/><br/>Quote from: Salmon Trout on March 05, 2011, 08:56:25 AM<blockquote>Is cmd.exe kept in /usr/bin/windows?<br/></blockquote><br/>No idea.<br/><br/>The script does run and work as intended. cmd is on the path.Quote from: BC_Programmer on March 05, 2011, 08:58:48 AM<blockquote>No idea.<br/><br/>The script does run and work as intended. cmd is on the path.<br/></blockquote><br/>A shebang line starting a script that would only run in Windows...<br/><br/><br/><br/>Quote from: Salmon Trout on March 05, 2011, 08:16:27 AM<blockquote>Maybe hard for you to believe this, but it's not all about you! </blockquote>Its true that its not all about me, however, its also not hard to believe that I am MOSTLY the one who post awk solutions here. Also, I am the one who first encourages OP to use Perl (in this thread). Therefore, its OK to quote those 2 sentences you mentioned.Quote from: BC_Programmer on March 05, 2011, 08:48:24 AM<blockquote>Indeed, The OP has shown some usage of perl previously, and I mean no offense to them but it had a clear "beginner" look to it; I say this because many calls were "system()'d" (or whatever the equivalent Perl statement for shelling another app is) Which isn't so bad in and of itself, but many of the tasks being done with it were quite doable from within perl. <br/></blockquote>I agree about the issue of shelling out to call external system commands. Perl (and Python/Ruby etc) has the capability (and libraries) to do many system administration tasks. Moving/Copying/removing of files, finding files, text/string manipulation etc many which batch isn't able to provide effectively. Shelling out also makes the code non-portable.<br/>Quote from: BC_Programmer on March 05, 2011, 08:58:48 AM<blockquote>No idea.<br/><br/>The script does run and work as intended. cmd is on the path.<br/></blockquote><br/>In windows, perl (its spelt will capital "P" when referring to the language, small "P" to refer to the interpreter) will ignore shebang line. Its also better to use #! /usr/bin/env perl instead of /usr/bin/perl since not all distributions had their Perl installed in /usr/binI shall refrain from posting examples without doing extensive google to searches to make sure that the content of my examples that have nothing to do with what I was demonstrating are not redundancies that can be poked at for no good reason.<br/><br/>Also, Billrich has helpfully informed me that cmd.exe is in C:\windows\system32. He did so with a dir.Yes ... I would consider myself a beginner and I have dabbled with many languages from the early TRS-80's and BASIC to todays modern languages. I have dabbled with many of them but never became a specialist of any specific language. I also at times have broken the GOTO RULE which make professional programmers cringe, where I would have used loops and then realize I want a quick redirection in my code without having to place all that within another nested loop. Once compiled it all runs the same, although maybe with a fraction of a second difference in execution time where one may be more efficient than the other which accomplish the same goal. When it comes to SYSTEM calls, this is sort of a GOTO like habit, where there is a better way to accomplish the same or better results, but its raw and dirty code that works for what was intended. <br/><br/>When it comes to perl, I learned it through an online course at Virtual University. This covered all the common routines like PRINT, IF THEN ELSE, Loops, and Arrays. But it didnt go into detail as to the key strengths of perl over say C++ or BASIC in which perl has many short hand features that I was unaware of. The only shorthand I can remember from BASIC way back with GW-Basic was using ? marks in place of typing out PRINT. When listing however the interpreter would flip the ? to PRINT<br/><br/>I suppose I should focus on one language and learn it inside and out instead of making dirty <a href="https://interviewquestions.tuteehub.com/tag/programs-239435" style="font-weight:bold;" target="_blank" title="Click to know more about PROGRAMS">PROGRAMS</a> that are Rube Goldberg programming mixing and matching and sometimes dynamically compiling batch from perl in which the perl writes a batch file and then executes it to perform DOS batched functions etc. I am sure perl can do this without shelling out the functions by use of SYSTEM or compiling dynamic Batches on the fly. Like a Rube Goldberg making stuff more complex than it needs to be, but ending up with the same result, if I dont know of a quick better way to do something, I usually perform the quick 'Band-Aid' I guess you could call it to make it work, although attrocious to look at by a professional programmer..lol<br/><br/>Also the reason to do this in batch originally was also because I didnt want to have to install perl to the system that this was going to be run from, in addition to the fact that I thought batch was better geared for this replacement need, from seeing similar replacements in the past, but usually not with spaces but instead an alternate character such as \ with _<br/><br/>Any suggestions on a book that really shows the strengths of perl instead of the basics of print, logic, loops, and arrays that I can dive into to learn these strengths? <br/><br/>*Also I have had other programmers at times state that I should avoid perl for the nature of programming that I am doing where I am reading and writing to files and performing batched like system processes, because it was really created to be used for running CGI's with a web server such as Apache etc, while I actually like the structure of perl so I have stuck with it, with C++ being my second favorite although my C++ programs are all console type crude to get the job done and very rarely Visual C++. There suggestion was that I should stick with C++ over perl for my nature of programming, yet from the information shared here, it shows that perl is well equipt for my needs where I dont need any fancy gui, just for it to console and crunch. Also C++ programs to me require much more code than perl to get the same result.Quote<blockquote>*Also I have had other programmers at times state that I should avoid perl for the nature of programming that I am doing where I am reading and writing to files and performing batched like system processes, because it was really created to be used for running CGI's with a web server such as Apache etc, <br/></blockquote>They are absolutely, positively wrong. They are likely thinking of PHP.Quote from: DaveLembke on March 06, 2011, 05:55:01 PM<blockquote>Also the reason to do this in batch originally was also because I didnt want to have to install perl to the system that this was going to be run from, in addition to the fact that I thought batch was better geared for this replacement need, from seeing similar replacements in the past, but usually not with spaces but instead an alternate character such as \ with _<br/></blockquote>for your information, you do not have to install Perl on every machine you are going to run your script on. You can just install on one, do your development there , and then convert it to an executable so you can run almost anywhere on systems with more or less the same configuration. <br/><br/>Quote<blockquote>Any suggestions on a book that really shows the strengths of perl instead of the basics of print, logic, loops, and arrays that I can dive into to learn these strengths? <br/></blockquote>No one should miss the <a href="https://perldoc.perl.org/">official Perl documentation</a>. A book comes later, or not at all.<br/><br/>Quote<blockquote>*Also I have had other programmers at times state that I should avoid perl for the nature of programming that I am doing where I am reading and writing to files and performing batched like system processes, because it was really created to be used for running CGI's with a web server such as Apache etc, <br/></blockquote>that's so wrong. If you read the history of Perl, its mainly used for creating reports in the past. As the years go by, it has become a full fledged programming language capable of doing many things, besides using it for CGI ( by the way CGI is outdated, nowadays there are web frameworks such as Catalyst for web development stuff.)<br/><br/><br/>Quote<blockquote>while I actually like the structure of perl so I have stuck with it, with C++ being my second favorite although my C++ programs are all console type crude to get the job done and very rarely Visual C++. There suggestion was that I should stick with C++ over perl for my nature of programming, yet from the information shared here, it shows that perl is well equipt for my needs where I dont need any fancy gui, just for it to console and crunch. Also C++ programs to me require much more code than perl to get the same result.<br/></blockquote>I can understand the need for C++ if one is doing low level systems programming or games programming with you need the speed requirement etc, but if you are doing mostly systems administration , C++ is not really the tool to use as you can <a href="https://interviewquestions.tuteehub.com/tag/produce-1167752" style="font-weight:bold;" target="_blank" title="Click to know more about PRODUCE">PRODUCE</a> humongous lines of code just to do one simple task. Using a modern programming language that is both practical and easy to use is the way to go. I got flamed for mentioning assembler. This problem the OP posted is a elementary low-level job that can easily be done at the lowest level. The pearl advocate told me it was impractical. At one time assembly was the only tool for low-cost microcomputers. It is trivial to open a file, change all instances of just one code and then close the file. It is one of the primitive things you learn in using Assembler with an Operation System.<br/>When GW-BASIC came out, there was a version of it, as I recall, that would let you open a file in RANDOM, and use GET and PUT to alerter the file content. Nobody at the time just set around waiting for somebody to invert a better programming language. We just used what we had. Now I am told that I should not do that sort of thing because somebody says it is not efficient, elegant or maintainable or acceptable or kosher. Never mind that it worked.<br/>Well, they can just GOTO [unified label].<br/>Quote from: Geek-9pm on March 06, 2011, 08:14:24 PM<blockquote>I got flamed for mentioning assembler. <br/></blockquote>He asked for an example. That's not a flame. That's a valid request.<br/><br/>Quote<blockquote>This problem the OP posted is a elementary low-level job that can easily be done at the lowest level. </blockquote>Really? you can trivially implement File Input,Output, understanding different Character encodings and perform the appropriate mappings and replace a given character with another? You might respond "well, that isn't what they need" but what if in the future t hey do need it? Are they supposed to <a href="https://interviewquestions.tuteehub.com/tag/modify-562546" style="font-weight:bold;" target="_blank" title="Click to know more about MODIFY">MODIFY</a> that assembly to need these things that come for free with either batch or Perl, or any other scripting language at all? What kind of drugs are you on where you believe that "things should be done at the lowest level" you may as well suggest that they build, test, and use a integrated circuit board specifically for the replacement of characters. The lowest level is only the simplest level operationally; it's use and direct manipulation is anything but.<br/><br/>Quote<blockquote>The pearl advocate told me it was impractical. </blockquote><br/>First, for the millionth time, it's Perl. Yes, I know your speech recognition program types it in for you. But deleting one letter- or simply copy pasting one of the previously mentioned instances of the word- couldn't possibly be that difficult. Second, he has a Nick. He's hardly the only one who believes Assembly is impractical. I'd go so far as to say using it for this purpose is outright stupid and driven purely by hubris.<br/><br/><br/>Quote<blockquote>At one time assembly was the only tool for low-cost microcomputers. </blockquote>Hey, look at me! I can insert completely redundant and irrelevant pieces of data! At one time there was a Animal that looked similar to a zebra without stripes on it's hindquarters called the Quagga. See! I can do it too!<br/><br/>Quote<blockquote>It is trivial to open a file, change all instances of just one code and then close the file. It is one of the primitive things you learn in using Assembler with an Operation System.</blockquote>Cool... so why did you consider being asked to provide an example of this trivial piece of code a flame, exactly? Clearly you could have merely produced this trivial piece of code for all to see, rather then letting it remain a whimsical fantasy in your closed off tiny world where using Assembly for small, simple tasks is somehow not stupid.<br/><br/><br/>Quote<blockquote>When GW-BASIC came out, there was a version of it, as I recall, that would let you open a file in RANDOM, and use GET and PUT to alerter the file content.</blockquote><br/>Ok... What the *censored* are you talking about? One paragraph your going on about how trivial it is to write stuff using assembly, the next you are talking about GW-BASIC. Do you... No... you don't think GW-BASIC is assembly, do you? Because that would explain why you believe File IO and string manipulation are trivial, because they certainly are not trivial to do in Assembly, and certainly not for somebody who isn't familiar with Assembly, at all.<br/><br/>Quote<blockquote>Nobody at the time just set around waiting for somebody to invert a better programming language. We just used what we had. Now I am told that I should not do that sort of thing because somebody says it is not efficient, elegant or maintainable or acceptable or kosher. Never mind that it worked.<br/>Well, they can just GOTO [unified label].<br/></blockquote><br/>This... is still entirely irrelevant. You went "it's easy to write something like this in assembly. Also, GW-BASIC, which has nothing to do with this discussion to people who actually have a clue, uses GOTO's and people say it's not elegant or kosher." Nobody cares about your whimsical banterings about GW-BASIC, especially in the context where you are talking about assembly, which in and of itself is entirely irrelevant to the thread.<br/><br/><br/></body></html> | |
8691. |
Solve : errorlevels? |
Answer» <html><body><p>Hello, I would like to ask what -1 means in this part of batch <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> ?<br/><br/>choice /C:0123456789ABCDEF Specify text color: <br/>set /A SRIFTAS=%errorlevel%-1It means "minus one". If you read the SET <a href="https://interviewquestions.tuteehub.com/tag/documentation-15969" style="font-weight:bold;" target="_blank" title="Click to know more about DOCUMENTATION">DOCUMENTATION</a> -- type SET /? at the prompt -- you will see what SET /A means. Hint: A is for Arithmetic.<br/><br/><br/><br/><br/>Thanks It subtracts one.<br/><br/>The logic is this: <br/><br/>1. User presses a key whose character is in this string: 0123456789ABCDEF<br/><br/>2. Choice.exe returns a value in %errorlevel% which is the position of this character from the start of this string. If the user presses 0 then the errorlevel will be 1 (because 0 is the first character in the string), if the user presses F then choice.exe will return 16 (because F is the 16th character).<br/><br/><a href="https://interviewquestions.tuteehub.com/tag/3-236794" style="font-weight:bold;" target="_blank" title="Click to know more about 3">3</a>. You will notice that these <a href="https://interviewquestions.tuteehub.com/tag/values-25920" style="font-weight:bold;" target="_blank" title="Click to know more about VALUES">VALUES</a> are 1 more than the hex value represented by each character. <br/><br/>4. The parameters for the Color command start at 0 therefore you need to <a href="https://interviewquestions.tuteehub.com/tag/subtract-1231765" style="font-weight:bold;" target="_blank" title="Click to know more about SUBTRACT">SUBTRACT</a> 1 from %errorlevel%.<br/><br/><br/><br/><br/><br/></p></body></html> | |
8692. |
Solve : extracting compressed files & dropping them into a hot folder...Questions...? |
Answer» <html><body><p>Hi all, new here and looking for some help. This looks like a great place for info. <br/><br/>I receive large compressed files on a server and need a batch to extract them from that source folder (called Prod) and drop them into a destination folder (hot folder) to be processed, also place a copy in an archive folder. Problem is, if another <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> starts to come in while this one is running, it is not extracted but is moved to the archive folder (because an incomplete file can't be axtracted). How can I only extract files that have completely arrived? I would just schedule this to run every hour or a few times a day, but I have no control over the arrival times of these files, they <a href="https://interviewquestions.tuteehub.com/tag/arrive-363955" style="font-weight:bold;" target="_blank" title="Click to know more about ARRIVE">ARRIVE</a> at random.<br/><br/>Below is what I have. It works fine except it if another file comes in while this is running it gets moved to the archive folder and is not processed. <br/><br/>Any suggestions?? <br/><br/><br/>REM ***** Turn display output to off<br/>ECHO off<br/>REM ***** Set set prompt to "CZExtractor> "<br/>Prompt CZExtractor$G$S<br/>REM *****<br/>REM *****<br/>REM ***** clear the window and set the window colors background to 1=Blue and foreground F=Bright White <br/>CLS<br/>Color 1F<br/>REM *****<br/>ECHO **********************************************************************<br/>ECHO See CZExtractor-readme.txt for full details on this procedure<br/>ECHO **********************************************************************<br/>REM *****<br/>REM ***** Set the environment variables for the SouRCe Drive and Directory<br/>Set CZE-SRCDRV=Q:<br/>Set CZE-SRCDIR=\Prod<br/>REM *****<br/>REM ***** Set the environment variables for the ARChive Drive and Directory<br/>Set CZE-ARCDRV=Q:<br/>Set CZE-ARCDIR=\temp<br/>REM *****<br/>REM ***** Set the environment variables for the DEStination Drive and Directory<br/>Set CZE-DESDRV=W:<br/>Set CZE-DESDIR=\VIPUSER8.7\spool\ps<br/>REM *****<br/>REM ***** Set the environment variables for root WoRKing Drive and Directory<br/>Set CZE-WRKDRV=C:<br/>Set CZE-WRKDIR=\"Program Files"\CZExtractor<br/>REM *****<br/>REM ***** append the directory path for WinRAR program into current path<br/>path %path%;C:\Program Files\WinRAR<br/>REM *****<br/>REM ***** Change to the working Drive and Directory<br/>%CZE-WRKDRV%<br/>CD %CZE-WRKDIR%<br/>REM *****<br/>REM ***** check to see if DEStination directory is present, if not, then create it.<br/>IF NOT EXIST %CZE-DESDRV%%CZE-DESDIR%\ MKDIR %CZE-DESDRV%%CZE-DESDIR%\<br/>REM *****<br/>REM ***** check to see if ARChive directory is present, if not, then create it.<br/>IF NOT EXIST %CZE-ARCDRV%%CZE-ARCDIR%\ MKDIR %CZE-ARCDRV%%CZE-ARCDIR%\<br/>REM *****<br/>IF EXIST %CZE-WRKDRV%%CZE-WRKDIR%\files-in.txt REN %CZE-WRKDRV%%CZE-WRKDIR%\files-in.txt files-inlast.txt<br/>REM *****<br/>REM ***** create a file containing directory listing of the source directory<br/>dir %CZE-SRCDRV%%CZE-SRCDIR%\*.gz /O:D /T:W > %CZE-WRKDRV%%CZE-WRKDIR%\files-in.txt<br/>REM *****<br/>REM ***** display the files that will be processed to the screen<br/>ECHO **************************************************************************<br/>ECHO The following files have been discovered and will be processed<br/>ECHO **************************************************************************<br/> %CZE-WRKDRV%%CZE-WRKDIR%\files-in.txt<br/>ECHO **************************************************************************<br/>ECHO **************************************************************************<br/>REM *****<br/>REM ***** Using WinRAR decompress all gz files within the SoURce directory<br/>winRAR e -y %CZE-SRCDRV%%CZE-SRCDIR%\*.gz %CZE-DESDRV%%CZE-DESDIR%<br/>REM *****<br/>REM ***** create a file containing directory listing of the DEStination directory<br/>dir %CZE-DESDRV%%CZE-DESDIR%\*.ps /O:D /T:W > %CZE-WRKDRV%%CZE-WRKDIR%\files-out.txt<br/>ECHO **************************************************************<br/>ECHO The following uncompressed files have been created<br/>ECHO **************************************************************<br/>REM %CZE-WRKDRV%%CZE-WRKDIR%\files-out.txt<br/>REM *****<br/>REM ***** <a href="https://interviewquestions.tuteehub.com/tag/delete-karana-436574" style="font-weight:bold;" target="_blank" title="Click to know more about DELETE">DELETE</a> all indx files within the DEStination directory <br/>IF EXIST %CZE-DESDRV%%CZE-DESDIR%\*.indx DEL /Q %CZE-DESDRV%%CZE-DESDIR%\*.indx<br/>REM *****<br/>REM ***** Move all files from the SouRCe directory to the ARChive directory<br/>IF EXIST %CZE-SRCDRV%%CZE-SRCDIR%\*.* MOVE %CZE-SRCDRV%%CZE-SRCDIR%\*.* %CZE-ARCDRV%%CZE-ARCDIR%\<br/>REM *****<br/>:End_Procedure<br/>REM *****<br/>REM ***** restore the original window colors<br/>Color<br/>REM EXIT<br/><br/><br/>OK sorry, I think that just came across dumb. Absolutely no need to post all that. <br/><br/>After studying the winrar commands and switches and trying <a href="https://interviewquestions.tuteehub.com/tag/several-1203547" style="font-weight:bold;" target="_blank" title="Click to know more about SEVERAL">SEVERAL</a> things, I came up with the following:<br/><br/>Winrar has a switch that would do what I need. <br/><br/>switch<br/> -to<br/> Process files older than the specified time period.<br/><br/>where I could enter 1h.<br/><br/>That should process files older than one hour. Simple. And in testing it works fine with .rar files. But it has no effect on tar.gz files. unfortunately I need to make this work with tar.gz files.Is there another solution or is there another utility I should be using? This is on a Server 08 platform...Quote</p><blockquote>WinRAR<br/>From Wikipedia, the free encyclopedia<br/><br/>WinRAR 3.93 in Windows 7<br/>Developer(s) Eugene Roshal, Alexander Roshal<br/>Initial release 1995<br/>Stable release 4.00 (March 7, 2011; 1 day ago (2011-03-07)[1]) [+/−]<br/>Preview release [+/−]<br/>Development status Current<br/>Written in C++<br/>Operating system Windows 95, 98, Me, 2000, XP, <a href="https://interviewquestions.tuteehub.com/tag/vista-728089" style="font-weight:bold;" target="_blank" title="Click to know more about VISTA">VISTA</a>, 7, Mac OS X, FreeBSD, Linux (Wine required for GUI), OS/2[2]<br/>Available in Multilingual (46+ languages)<br/>Type File archiver<br/>License Commercial, Proprietary, Shareware<br/>Website Primary: <a href="https://www.rarlab.com">www.rarlab.com</a><br/>Secondary: <a href="https://www.win-rar.com">www.win-rar.com</a><br/><br/>WinRAR is a shareware file archiver and data compression utility developed by Eugene Roshal, and first released in autumn of 1993.[3] It is one of the few applications that is able to create RAR archives natively, because the encoding method is held to be proprietary.</blockquote>If the shoe fits...</body></html> | |
8693. |
Solve : need help writing a batch file? somebody help please? |
Answer» <html><body><p>This is for school...and I am confused on writing batch files......I <a href="https://interviewquestions.tuteehub.com/tag/need-25476" style="font-weight:bold;" target="_blank" title="Click to know more about NEED">NEED</a> help please! Thanks<br/>do I <a href="https://interviewquestions.tuteehub.com/tag/write-746491" style="font-weight:bold;" target="_blank" title="Click to know more about WRITE">WRITE</a> this batch file?<br/>write a batch file named eFiles.bat that will (read all the criteria before beginning)<br/>make a directory on USB drive named MyEfiles<br/>copy all the files that begin with the letter E extension from the _Datafiles\DOS directory to the MyEfiles<br/><br/>Clear the screen in an appropriate place<br/>be sure each command does not appear on the screen<br/>add remarks that list your name, today's date, and purpose of the batch file<br/>display a message telling the user what to expect - pause the screen to give user a chance to read the message<br/>add blank lines where you believe will ehance the appearance of the screen.Thank you....<a href="https://interviewquestions.tuteehub.com/tag/another-876628" style="font-weight:bold;" target="_blank" title="Click to know more about ANOTHER">ANOTHER</a> question for you. copy the media subdirectories from DOS directory to the NewMedia directory in DOS<br/><br/>Is this the correct order:<br/>@echo off<br/>REM created by JOe <a href="https://interviewquestions.tuteehub.com/tag/student-245126" style="font-weight:bold;" target="_blank" title="Click to know more about STUDENT">STUDENT</a> <br/>cls<br/>ECHO Please wait while this process completes<br/>PAUSE<br/>cd /d D:\1161_DataFiles\DOS<br/>xcopy media\*.* newmedia /e /y >nulyou'll need to do your own homework. Sorrywhat a guy can't ask for a little help? Thanks tool...as I am sure YOU NEVER asked anyone to help you out with anything!Quote from: skers5xs on March 07, 2011, 05:58:25 PM</p><blockquote>what a guy can't ask for a little help? Thanks tool...as I am sure YOU NEVER asked anyone to help you out with anything!<br/></blockquote>Nothing wrong with asking for help. You need to show you have done your best and only need just a little help. Doing it all for you does not really help you learn anything.Quote from: skers5xs on March 07, 2011, 05:58:25 PM<blockquote>Thanks tool...</blockquote><br/>Way to get a ban... and no help at all...<br/><br/>Thanks for your input Salmon but I didn't get a banned.....and I did get help.... Quote from: skers5xs on March 08, 2011, 10:58:22 AM<blockquote>I didn't get a banned...</blockquote><br/>It's early days...<br/>Yes, it is early days....I need to lay off the sauce this early. What I meant to say was I haven't been banned yet! I will <a href="https://interviewquestions.tuteehub.com/tag/try-1428546" style="font-weight:bold;" target="_blank" title="Click to know more about TRY">TRY</a> my darnest to get banned though. Quote from: skers5xs on March 08, 2011, 01:30:38 PM<blockquote>Yes, it is early days....I need to lay off the sauce this early. What I meant to say was I haven't been banned yet! I will try my darnest to get banned though. <br/></blockquote><br/>You can say "*censored*" on here, I believe...<br/>NICE!! Thanks for the heads up....</body></html> | |
8694. |
Solve : change remote FTP folder to type ZIP? |
Answer» <html><body><p>Hello,<br/><br/>I am using mput to transfer multiple files from my local system to a remote FTP account. The files are dropped inside a folder like so:<br/><br/>Code: <a>[Select]</a>open ftp.abc.com<br/>username<br/>password<br/>[b]cd \IMPORT\Files[/b]<br/><a href="https://interviewquestions.tuteehub.com/tag/prompt-592976" style="font-weight:bold;" target="_blank" title="Click to know more about PROMPT">PROMPT</a><br/>mput *.xml<br/>bye<br/>ftp -n<br/><br/>So <a href="https://interviewquestions.tuteehub.com/tag/notice-25787" style="font-weight:bold;" target="_blank" title="Click to know more about NOTICE">NOTICE</a> the "Files" folder. What i want to do once the files have been transferred is to ZIP the folder to something like "ZipFiles.zip"..<br/><br/>Is this possible?<br/><br/>Kind regards,<br/>BillyI was trying this, but doesnt seem to work, i get an invalid command:<br/><br/>Code: <a>[Select]</a>open ftp.abd.com<br/>username<br/>password<br/>cd \IMPORT<br/>prompt<br/>"c:\Program Files\7-zip\7-zip.exe" zip *.xml xml.zip<br/>mput *.zip<br/>bye<br/>ftp -n<br/>Try zipping the files outside the FTP environment. You can put the FTP commands into a separate <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a>, put the reference to 7-zip in a batch file, then reference the FTP script with the -s: <a href="https://interviewquestions.tuteehub.com/tag/switch-20997" style="font-weight:bold;" target="_blank" title="Click to know more about SWITCH">SWITCH</a> in that same batch file.<br/><br/>Batch file:<br/>Code: <a>[Select]</a>@echo off<br/>cd \IMPORT<br/>"c:\Program Files\7-zip\7-zip.exe" zip *.xml xml.zip<br/>ftp -s:ftpscript.txt<br/><br/>FTPscript.txt<br/>Code: <a>[Select]</a>open ftp.abd.com<br/>username<br/>password<br/>cd \IMPORT<br/>prompt<br/>mput *.zip<br/>bye<br/>ftp -n<br/><br/>Not sure if you need the FTP <em>prompt</em> command, but you can <a href="https://interviewquestions.tuteehub.com/tag/decide-431424" style="font-weight:bold;" target="_blank" title="Click to know more about DECIDE">DECIDE</a> that.<br/><br/>Good luck.</p></body></html> | |
8695. |
Solve : FTP Command line "prompt" not working as intended? |
Answer» <html><body><p>Hello,<br/><br/>This is my <a href="https://interviewquestions.tuteehub.com/tag/first-461760" style="font-weight:bold;" target="_blank" title="Click to know more about FIRST">FIRST</a> piost so not quite <a href="https://interviewquestions.tuteehub.com/tag/sure-656539" style="font-weight:bold;" target="_blank" title="Click to know more about SURE">SURE</a> how helpful this forum will be <br/><br/>I am trying to upload multiple files from my local system to an external FTP account. I do this via a batch file, so i have upload.bat and ftp.txt.<br/><br/>upload.bat contains the following:<br/><br/>Code: <a>[Select]</a>cd <a href="https://interviewquestions.tuteehub.com/tag/c-3540" style="font-weight:bold;" target="_blank" title="Click to know more about C">C</a>:<br/>cd \Batch Files\awaiting<br/>ftp -s:..\ftp.txt<br/>move *.xml ..\processed<br/><br/>Then i have an ftp.txt which is this:<br/><br/>Code: <a>[Select]</a>open ftp.abd.com<br/>username<br/>password<br/>cd \IMPORT\Files<br/>prompt<br/>mput *.xml<br/>bye<br/>ftp -n<br/><br/>I have <a href="https://interviewquestions.tuteehub.com/tag/many-554478" style="font-weight:bold;" target="_blank" title="Click to know more about MANY">MANY</a> .xml files but only 1 is being uploaded although i have turned to prompt off which stops cmd asking me what i want to do.<br/><br/>Can anyone see where i am going <a href="https://interviewquestions.tuteehub.com/tag/wrong-1462035" style="font-weight:bold;" target="_blank" title="Click to know more about WRONG">WRONG</a>?<br/><br/>I would really appreciate it if someone could assist.<br/><br/>Kind regards,<br/><br/>BillyI wonder if the MOVE is being executed while the ftp session is in progress ?<br/>The ftp session finds a file and uploads it but by the time it returns all of the files have been moved out ?Quote</p><blockquote>I wonder if the MOVE is being executed while the ftp session is in progress ?<br/>The ftp session finds a file and uploads it but by the time it returns all of the files have been moved out ?<br/></blockquote><br/>If that is the case, then you could just use start /wait .....</body></html> | |
8696. |
Solve : Add Full Control permission to domain group? |
Answer» <html><body><p>Hi,<br/><br/>I'd like to <a href="https://interviewquestions.tuteehub.com/tag/make-249948" style="font-weight:bold;" target="_blank" title="Click to know more about MAKE">MAKE</a> a batch which will add full control to a Domain group in a list a folder.<br/><br/><br/>I <a href="https://interviewquestions.tuteehub.com/tag/tried-7272297" style="font-weight:bold;" target="_blank" title="Click to know more about TRIED">TRIED</a> this command but it doesnt work.<br/><br/><br/>@<a href="https://interviewquestions.tuteehub.com/tag/echo-11626" style="font-weight:bold;" target="_blank" title="Click to know more about ECHO">ECHO</a> off<br/>FOR /D %%i in (text.txt) do CACLS %%i /T /G DOMAINNAME\GG-SUPPORT-SN2:F<br/><br/><br/>GG-Support is the name of my domain group<br/><br/>in the text.txt <a href="https://interviewquestions.tuteehub.com/tag/file-11330" style="font-weight:bold;" target="_blank" title="Click to know more about FILE">FILE</a> there are names of the <a href="https://interviewquestions.tuteehub.com/tag/different-951434" style="font-weight:bold;" target="_blank" title="Click to know more about DIFFERENT">DIFFERENT</a> folders in which I want to add the full control<br/><br/><br/>Please help, I don't know what to do.</p></body></html> | |
8697. |
Solve : replace a line with another line? |
Answer» <html><body><p>i have a script that gets a line number and i need t replace the line at that line number how would i do that?Let's see your script.<br/>You have a script? Where? (I can't see it, although I'm staring real hard at the monitor!) The script "gets a line number"? Where from? And where is the line you <a href="https://interviewquestions.tuteehub.com/tag/want-1448756" style="font-weight:bold;" target="_blank" title="Click to know more about WANT">WANT</a> to replace? In a <a href="https://interviewquestions.tuteehub.com/tag/text-11613" style="font-weight:bold;" target="_blank" title="Click to know more about TEXT">TEXT</a> file? Of what format? Not enough information.<br/>sorry i should have been more informative so <a href="https://interviewquestions.tuteehub.com/tag/anyways-1981745" style="font-weight:bold;" target="_blank" title="Click to know more about ANYWAYS">ANYWAYS</a> the user passes parameters like so Code: <a>[Select]</a>replace 3 b and if the text file data.dat contains<br/>a<br/>b<br/>c<br/>d<br/>e <br/>it would become<br/>a<br/>b<br/>b<br/>d<br/>eSo when you wrote "I have a script" you really meant "I want a script"?<br/>yesYou want a script completely written from scratch, with no input from yourself? Is this a homework project, or <a href="https://interviewquestions.tuteehub.com/tag/something-25913" style="font-weight:bold;" target="_blank" title="Click to know more about SOMETHING">SOMETHING</a> for work?<br/>Ah, BillFish to the rescue...<br/>Quote</p><blockquote>You want a script completely written from scratch, with no input from yourself? Is this a homework project, or something for work?</blockquote>this is not a homework project nor from work (im 14)i just had no idea how to do this but bills solution actually worked</body></html> | |
8698. |
Solve : Stop searching after file is found? |
Answer» <html><body><p>How could I make my batch stop <a href="https://interviewquestions.tuteehub.com/tag/looking-1079184" style="font-weight:bold;" target="_blank" title="Click to know more about LOOKING">LOOKING</a> for a file once it has found it?<br/><br/>What I mean is I have this code:<br/><br/>Code: <a>[Select]</a>@echo off<br/>echo Type in the name of the file you want to find and delete with the extension<br/>echo.<br/>set /p name=<br/>cd\<br/>del %name% /s /p<br/><br/>Now it works fine, but once it prompts you on whether you want to delete the file or not (and you answer "yes") it will delete the file BUT keeps on searching for more files with that name.<br/>Is there anyway to stop this? <br/><br/>So that <a href="https://interviewquestions.tuteehub.com/tag/right-239192" style="font-weight:bold;" target="_blank" title="Click to know more about RIGHT">RIGHT</a> when it deletes the file, it will stop searching?<br/><br/>Thanks.Quote from: fish on March 14, 2011, 01:46:04 PM</p><blockquote>Why stop the search after one find?<br/></blockquote>Because it's time consuming.<br/><br/>Quote<blockquote>If the file is dangerous all copies should be found.</blockquote>Yes. With an actual malware utility dangerous files can be found. However since they are <a href="https://interviewquestions.tuteehub.com/tag/using-1441597" style="font-weight:bold;" target="_blank" title="Click to know more about USING">USING</a> a batch file they probably aren't trying to write their own malware scanner, because that would be foolish. Additionally, they make no implication that they are, or that the file's they are trying to find are "dangerous".<br/><br/>EDIT: <a href="https://interviewquestions.tuteehub.com/tag/guess-1013936" style="font-weight:bold;" target="_blank" title="Click to know more about GUESS">GUESS</a> I may as well <a href="https://interviewquestions.tuteehub.com/tag/address-239902" style="font-weight:bold;" target="_blank" title="Click to know more about ADDRESS">ADDRESS</a> the Original Post<br/><br/>you'd would need to not use del /s; instead you would basically need to roll your own routine and search for files yourself. I think maybe FORFILES or a for switch could be used for that. (for /f perhaps)<br/><br/><br/><br/>something like this would do it...<br/><br/>set filename=find this file.txt<br/>for /f "delims=" %%F in ('dir /b /s "%filename%"') do (<br/>del "%%F"<br/>goto jump<br/>)<br/>:jump<br/>echo done<br/><br/>I see Billfish is still around...<br/><br/>Quote from: Salmon Trout on March 14, 2011, 02:20:22 PM<blockquote>something like this would do it...<br/><br/>set filename=find this file.txt<br/>for /f "delims=" %%F in ('dir /b /s "%filename%"') do (<br/>del "%%F"<br/>goto jump<br/>)<br/>:jump<br/>echo done<br/><br/>I see Billfish is still around...<br/></blockquote><br/>Wow thank you so much! Works perfectly</body></html> | |
8699. |
Solve : Delete folder named yesterdays date? |
Answer» <html><body><p>yea i am logged in with enough <a href="https://interviewquestions.tuteehub.com/tag/permissions-771019" style="font-weight:bold;" target="_blank" title="Click to know more about PERMISSIONS">PERMISSIONS</a>, but if %date% is a system variable then how does<br/>FOR /<a href="https://interviewquestions.tuteehub.com/tag/f-236701" style="font-weight:bold;" target="_blank" title="Click to know more about F">F</a> "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B<br/>For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set date=%%a %%b) <br/>format it from <br/>Wed 03/16/2011 <br/>to<br/>03 16<br/>?Is this folder "C:\testing\%yesterday%" actually empty?<br/><br/>My remark about using a variable <a href="https://interviewquestions.tuteehub.com/tag/named-1110438" style="font-weight:bold;" target="_blank" title="Click to know more about NAMED">NAMED</a> %date% was intended as a <a href="https://interviewquestions.tuteehub.com/tag/general-238723" style="font-weight:bold;" target="_blank" title="Click to know more about GENERAL">GENERAL</a> observation, it clearly doesn't matter in this case, but it is generally safer not to overwrite system variables.<br/><br/><br/><br/>ah ok, and no it has <a href="https://interviewquestions.tuteehub.com/tag/files-20889" style="font-weight:bold;" target="_blank" title="Click to know more about FILES">FILES</a> in it, and they all need to be deleted</p></body></html> | |
8700. |
Solve : Run an application job using batch script? |
Answer» <html><body><p>Hi,<br/><br/>Iam new to scripting, Sorry if iam asking a very basic question.<br/><br/>I have an application which has an option in File Menu --> Run Job , But i want to run this using batch script.<br/><br/>I have written in the script as <br/><br/>" Start test_batch.ace" which just opens the application but the job is not running.<br/><br/>I want the batch script to run the job.<br/><br/>I will need your <a href="https://interviewquestions.tuteehub.com/tag/help-239643" style="font-weight:bold;" target="_blank" title="Click to know more about HELP">HELP</a> in writing the script.<br/><br/>Thanks,<br/>VinodQuote from: vinods_09 on March 17, 2011, 12:32:09 PM</p><blockquote>I have an application which has an option in File Menu --> Run Job</blockquote><br/>I have attempted to find the name of this application using telepathy but I have had no success. Therefore please divulge.<br/>could <a href="https://interviewquestions.tuteehub.com/tag/somebody-1218773" style="font-weight:bold;" target="_blank" title="Click to know more about SOMEBODY">SOMEBODY</a> remove samwall/billrich's irrelevant post?<br/>Hi,<br/><br/>In Command " Start Test_PS.ace " Test_PS.ace is the application job, if i run the command it's just <a href="https://interviewquestions.tuteehub.com/tag/opening-1136658" style="font-weight:bold;" target="_blank" title="Click to know more about OPENING">OPENING</a> the application and not running the job. I need to run the job .<br/><br/>Your help is very <a href="https://interviewquestions.tuteehub.com/tag/much-249971" style="font-weight:bold;" target="_blank" title="Click to know more about MUCH">MUCH</a> appreciated.<br/><br/>Thanks,<br/>VinodIs the application WinAce?<br/><br/><br/><br/><br/></body></html> | |