This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 301. |
Solve : Hi,, I need to change image sequece file names into one line name? |
|
Answer» Hi,, I need to fix this problem now. it can read first image, but it can't read whole images. I am not sure what you mean by this. Hi.. Thank you for the response. 1. numerical sequence number is different. sometimes 5 digits, sometimes 3 digits 2. test.0002.jpg, test.0003.jpg, test.0004.jpg, test.0005.jpg.... 3. ex, there are 5 files, like image.0004.jpg, image.0005.jpg, image.0006.jpg, image.0007.jpg, image.0008.jpg i want to convert these to movie. The converter should reand these sequence files to "image.0004-0008.jpg" Then it executes as "div_convert.exe image.0004-0008.jpg test.mov" It will make a movie. Quote from: ylthh on October 16, 2010, 01:19:21 PM Hi,, I need to fix this problem now.So you just rename the first file? Why have you QUOTED yourself? correct, rename the first file.is filename format always something dot NNNN dot jpg like this: abcd.0001.jpg? (always three parts separated by dots?) yes Code: [Select]echo off set fullname=%~1 set foldernm=%~dp1 set barename=%~nx1 cd /d "%foldernm%" for /f "tokens=1-3 delims=." %%A in ("%barename%") do ( set fileroot=%%A set firstnum=%%B set fileextn=%%C ) set filespec=%fileroot%.*.%fileextn% for /f "tokens=1-3 delims=." %%A in ('dir /b "%filespec%"') do set lastnum=%%B set param1=%fileroot%.%firstnum%-%lastnum%.%fileextn% set param2=%fileroot%.mov "C:\Program Files (x86)\djv 0.8.2\bin\djv_convert.exe" "%param1%" "%param2%" pause Hi, Salmon Thank you so much for your help. In network server, "dir /b" didn't work well. The file order is not alphabetical. Then I added dir /b /o, then it worked. Is it correct? Then when I execute batch file, it worked. Thank you so much again. Quote from: ylthh on October 17, 2010, 09:02:10 AM In network server, "dir /b" didn't work well. The file order is not alphabetical. Then I added dir /b /o, then it worked. That sounds good to me. |
|
| 302. |
Solve : Replace the particular string using Dos batch program? |
|
Answer» Hi, Code: [Select]for /f "delims=" %%A in (fulllist.txt) do echo \\Server\%%~pnxA Thanks! i want redirect the results new file.. Quote from: csselva on October 24, 2010, 05:41:33 AM i want redirect the results new file.. I am sure you know how to do that. |
|
| 303. |
Solve : Batch to ping network range? |
|
Answer» Trying to make a program to ping network range. Is PING.exe reading the IP literally .. ? Not SURE what you mean by this. It will run as so... Code: [Select]set /p range= Please select Range: Quote user sees: Please select range:It will loop till 254 on that range Quote from: Phuhrenzix on OCTOBER 27, 2010, 11:04:57 AM It will loop till 254 on that range What do you mean by this? it will start on 192.168.1.1 and end in 192.168.1.254 in this example. (the code is highly redundant because I couldn't get the FOR to loop and echo properly) Quote from: Phuhrenzix on October 27, 2010, 11:18:26 AM it will start on 192.168.1.1 and end in 192.168.1.254 in this example. How does it do that? here, i'm probably not explaining well enough. Code: [Select]echo off SET /p username=User Name: SET /p password=Password: IF %password%==foo goto start ELSE goto try1 :try1 echo login failed 1/3 SET /p password=Password: IF %password%==foo goto start :try2 ELSE goto try2 echo login failed 2/3 SET /p password=Password: IF %password%==foo goto start ELSE goto try3 :try3 echo login failed 3/3 SET /p password=Password: IF %password%==foo goto start ELSE goto end :start set /p range=please enter range: Echo sniff sniff sniff :1 PING -n 1 %range%.1 |find "reply" >NUL IF NOT ERRORLEVEL 1 goto s1 IF ERRORLEVEL 1 goto f1 :s1 echo sniff sniff sniff, %range%.1 lives! :f1 echo whimper, sorry Master %username% I could not find %range%.1 goto 2 :2 PING %range%.2|find "reply from " >NUL IF NOT ERRORLEVEL 1 goto s2 IF ERRORLEVEL 1 goto F2 :s1 echo sniff sniff sniff, %range%.1 lives! goto 3 :f1 echo whimper, sorry Master %username% I could not find %range%.1 goto 2 . . . :end You seem to think that the ping command will ping a range of IP addresses, but you are only giving it one IP address. it continues on :1 area pings %range%.1 :2 area pings %range%.2 :3 area pings %range%.3 and so on like i said it is highly redundant and has a instance for 1-254 to ping, the actual code isnt one IP address, unless it's only pinging what is entered for range.You mean you have 254 separate labels and 254 separate sections? Is this true? 1. Why??? 2. Why did you not mention this before? 3. What are you trying to do here? Is it some kind of hack? 1. because I want it to return if the IP's are existant on the network. and the FOR wouldn't run the echo's properly 2. I was just with bad word choice 3. This is an alternative to ARP(which doesnt return IP's on public networks) on public networks to be used by network administrators. If you want to think of it as a hack in that element, yes. If you're thinking it is a hack as in illegal, no. 1. Either make the string for FIND to be "Reply" with a capital R or else make the find case-insensitive with the /I switch. 2. This is how to loop through a range of numbers using FOR Code: [Select]REM example set range=192.168.1 for /L %%N in (1,1,254) do PING %range%.%%N | find "Reply">nul && echo Reply from %range%.%%N I'm finally seeing results from this.... however, the return is returning even failed pings. Code: [Select]echo off REM example set range=192.168.1 set num=1 :loop PING -n 1 %range%.%num% | find "Reply from"> nul if %errorlevel% equ 0 ( echo %range%.%num% YES ) else ( echo %range%.%num% NO ) set /a num+=1 if %num% equ 255 goto next goto loop :next echo Completed pinging range %range% This is an awesome fix thanks, just one question though; why is the router not returning as existent? |
|
| 304. |
Solve : Batch file completion? |
|
Answer» Hello |
|
| 305. |
Solve : File attribute change - run as administrator? |
|
Answer» I need to copy / overwrite approxiamately 200 files located on a network share into a workstation subdirectory with 20 read only files. The target directory has an existing 300+ files. The target workstations do not have LOCAL admin rights. I've created a successful batch file, but it runs as the local user account logged into the MACHINE and it generates "access denied" error. |
|
| 306. |
Solve : Batch trim audio files at regular/sequential intervals? |
|
Answer» (hope I didn't post this twice - I think I was logged off on my first try) Out of curiosity, why do you want to break up these audio files? The answer might help some one else to offer a solution. Hi rthompson, Thanks for the suggestion. The RECORDINGS are of bird choruses and the two minute segments will be used to test volunteer bird counter's ability to identify BIRDS by song. Maybe the best thing to do process each file on its own but I thought if there was a better way I should learn it. Thanks. Code: [Select]MS DOS 5.1.2600 There is no such animal; I BELIEVE you mean Windows XP command line which is not MS-DOS. If you can get the files into mp3 format, which is a trivial undertaking, you can use a tool called mp3splt which (among other things) can split an mp3 file into equal sized parts Quote mp3splt -t 10.00 album.mp3 [Split album.mp3 in many equal-sized parts of 10 minutes each.] http://labnol.blogspot.com/2006/10/mp3-cutters-split-mp3-files-into.html Great, thanks Salmon Trout! mp3splt looks like just what I need. And you are correct of course, I'm using the XP command prompt v. 5.1.2600. Not sure way I wrote MS DOS... I do know better |
|
| 307. |
Solve : Sound and Hidden Legacy Support?? |
|
Answer» Hey guys, I'm confused. Hey guys, I'm confused.Yes. It does. Mouse.com only works with Serial and PS/2 mice. Therefore the USB mice is acting as one of the two; almost certainly PS/2. Quote Now that the mouse works in DOS, I'd like to tackle, or at least explore, the much harder issue of getting sound to work. Using the program lspci from linux, I found that my onboard audio is "N10/ICH7 Intel (rev. 2)". At least, I hope this is accurate. Is there a driver that can make this work in DOS? And if my BIOS has legacy support, but it's hidden and undisclosed (weird), I assume that sound would/could already be working with no driver at all? "N10/ICH7 Intel (rev. 2)" is the IDE/SATA controller.... Chances are, with a netbook, or really any laptop, is that it uses Host-based processing, for example, it may claim to have say a "realtek high definition audio controller" or something to that EFFECT, but what this generally means is that the "controller" defers all the actual processing of the sound to the CPU. (I'm not sure if they've changed this). This is largely redundant- you would almost certainly need the sound device to emulate a Sound Blaster in order to use it. DOS does not and has never had native sound support; generally you would buy a sound card back in the good old days and it would come with a driver disk, and then you'd change config.sys to load the driver with very specific settings (and you would need to flip about jumpers and whatnot on the actual card to match the settings you choose in config.sys, and hope it doesn't conflict with something). the drivers, however, were wholly unneeded a lot of the time. First off- DOS never emits sound through the sound card, and programs that did use the sound card would look for a certain environment variable, the "BLASTER" variable. this commonly set like this in autoexec.bat or config.sys: Code: [Select]SET BLASTER=A220 I5 D1 H5 P330 E620 T6 This tells the game/program where to look for a sound card. IN fact I cannot think of a single game that needed you to load the included "drivers" disk, aside from the fact that it added this environment variable for you. Basically, I'd throw something like that into autoexec.bat and run a game/program that uses audio. NOTHING included with DOS uses the sound card AFAIK.BC, So I guess the question is, can this netbook's hardware emulate a SB? I was playing with autoexec.bat SET BLASTER before posting, and I also tried your line, matching my programs configurations to the line (hex, dma, irq), but it still isn't working. I'm not new to these things, I have adjusted jumpers on modems back in DOS and Win95 days, and have editted config/autoexec many-a-time. I think I need to identify the audio hardware before I can really diagnose the issue, do I not? So I can find out if it emulates an SB? I am unsure how to do this. I used DOS for years, and I am aware that drivers were not needed, the reason I mention drivers now is because, I assume, only some boards emulate SB (aka, DOS compatible) and others might need some "help". As I said, I used lspci in linux and the only line with the word "audio" in it did indeed describe this as n10/ich7. Are you sure these designations refer only to IDE/SATA, and not something more general? |
|
| 308. |
Solve : pasword protection? |
|
Answer» Hi to all. |
|
| 309. |
Solve : loggin console output of batch to text file without using redirect? |
|
Answer» Hi, |
|
| 310. |
Solve : Batch file/Terminal server help? |
|
Answer» Right, apologies i this has been asked, I did search but I am at work and extremely BUSY so didn't get to look completely. I'm also quite new to batch files. |
|
| 311. |
Solve : save .dbf file to .csv by opening it..!? |
|
Answer» hey folks . |
|
| 312. |
Solve : output files based on two FIND criterias with .bat file.? |
|
Answer» I wrote a .bat script that will search a folder for files with file names that were modified on todays date and then output the results to a .txt file. I want to change it to only return files that were not modified on todays date. I tried to use /V in the second FIND statements, but it appears to apply the /V to both FIND statements. "%test_script.txt% %script_test.txt%" What do these variables hold? Those are file names. I need to check just the file names I include in those strings for modified dates <> today and return them. In my test c:\temp folder I have three files script_test.txt modified: 10/28/2010 test_script.txt modified: 10/29/2010 not_included.txt does not matter because it is not named in the script. The goal would be to return: script_test.txt 10/28/2010 This would tell me quickly that this file was not updated so I could troubleshoot the process responsible for updating that file. I have to check a ton of folders each morning. My ultimate goal is the clean up the process, but in the meantime I need this to take less of my DAY. New jobs have their quirks. Thank you. |
|
| 313. |
Solve : How to install a software autiomatically by using batch file? |
|
Answer» Hi all, |
|
| 314. |
Solve : how do I delete a primary partition both C: and D: are primary??? |
|
Answer» I want to delete the D: Partition and expand the C: partition, but the OS says no, how do I tackle the problem or what DOS command do I use to delete D:?? Shrugs, sorry but I won't treat any user as a complete noobie - that's already Vista's job, lol. Even THOUGH they have listed their experience as beginner, well done. Which indicates that they might not even know what a recovery drive is or does. Your so quick to give advice and not so good at taking it. You can do more harm than good. ( Suppose its all part of growing up) |
|
| 315. |
Solve : Old files deletion? |
|
Answer» Hi all, |
|
| 316. |
Solve : How to prompt for a string and upshift the input.? |
|
Answer» Anyone know how to prompt for a value and upshift the INPUT? |
|
| 317. |
Solve : Making Multiple folder(s) with batch File? |
|
Answer» Hello Everyone, I WOULD like some help making a batch FILE as a side project for modding games, |
|
| 318. |
Solve : Syntax problem with the FOR command? |
|
Answer» HI, I'm trying to extract File extensions (8.3) from a text file but I can't get it to work, any ideas? Here is the code i'm trying to use: DIR "C:\test\datafile.*" /b > C:\data.lst" FOR /F "eol= " %%i IN (C:\data.lst) DO ( SET FileExt=%%i:~9% ECHO %FileExt% ) The contents of "C:\data.lst" looks like: datafile.1 datafile.7 datafile.25 datafile.98 datafile.167 datafile.817 ThanksI figured it out, I NEEDED to use the SETLOCAL command and instead of using % I needed to use !. This is the syntax I'm using: DIR "C:\test\datafile.*" /b > "C:\data.lst" SetLocal EnableDelayedExpansion FOR /F "eol= " %%i IN (C:\data.lst) DO ( SET DataFile=%%i SET FileExt=!DataFile:~9! ECHO !FileExt! ) EndLocal If anyone has any better ideas to do this, I'm all ears!!set fileExt=%%~xi type FOR /? at the prompt for full help |
|
| 319. |
Solve : i need help with batch files?? |
|
Answer» how do i CREATE a BATCH file which will create a folder at the ROOT of the C drive? More HOMEWORK?yesSorry. As I told you in the other threads, we don't do homework. |
|
| 320. |
Solve : OR operator? |
|
Answer» I've searched a lot for this but I can't find the answer. What I want to do is the following (doesn't work otherwise I wouldn't have opened a new topic ) Of course I did. Well a solution would be to always use quotes and always specify %2. if you want to know if %2 is NULL (blank) then you need to do if "%~2"=="" then [whatever] or if {%~2}=={} then [whatever] or you can use any non-control character as the prefix and suffix. Unlike some programming languages this "" is not an empty string in batch. It is a string of length 2 characters. And you cannot do this SET %2=Failed! |
|
| 321. |
Solve : Using the Path in Windows 7 doesn't like (x86)? |
|
Answer» Can someone tell me how to add something to the path in a WINDOWS 7 (x64) that CONTAINS (x86). |
|
| 322. |
Solve : lpr command? |
|
Answer» Hello, |
|
| 323. |
Solve : How to compare 2 text files in a script?? |
|
Answer» Hello Yep, noticed that too. I will give it a try. I am sure it will work.Quote from: BC_Programmer on November 03, 2010, 05:46:46 PM to my understanding FC doesn't return an errorlevel. That's odd because I thought it returned 0 if the files are the same, 1 if they are different, and 2 if one or both files do not exist. Code: [Select]echo off echo hello > test1.txt copy test1.txt test2.txt>nul echo goodbye > test3.txt fc test1.txt test2.txt>nul echo Compare 2 identical files errorlevel=%errorlevel% fc test1.txt test3.txt>nul echo Compare 2 different files errorlevel=%errorlevel% fc test1.txt test4.txt 2>1>nul echo compare file with nonexistent file errorlevel=%errorlevel% fc test5.txt test4.txt 2>1>nul echo compare two nonexistent files errorlevel=%errorlevel% Code: [Select]Compare 2 identical files errorlevel=0 Compare 2 different files errorlevel=1 compare file with nonexistent file errorlevel=2 compare two nonexistent files errorlevel=2 Identical output on Windows XP Professional 32 bit SP3 and Windows 7 64 bit Professional. Am I being dumb here and missing something? cool, that should make the script even shorter then; just a quick errorlevel check in the original script presented by the OP would have done the trick. For some reason I didn't even check if fc actually returned errorlevels. But you know what they say, assuming makes an *censored* out of u and some guy named ming, guess that's what I did. |
|
| 324. |
Solve : MKDIR: Access is Denied But Can Create Folder via Windows? |
|
Answer» Hi |
|
| 325. |
Solve : MS DOS Memory Stick Boot Up? |
|
Answer» Hey I Have A Problem Which has probably wasted about 8 hours of my time, im not sure if ANYONE throughout the ms dos forum know how how to boot ms dos through a memory stick please can you help IVE been trying forever to get it to WORK |
|
| 326. |
Solve : DOS Output? |
|
Answer» Is there a way to simultaneously REDIRECT the DOS OUTPUT to both the printer and a text FILE?Maybe something like this: |
|
| 327. |
Solve : batch 2 change files's created date 2 modified date? |
|
Answer» I NEED a batch file to copy a files modified date to the created date.Don't think this is possible. There is no native way to do this in batch so you'll need a 3rd party program called Touch. You can read about it here and if it seems helpful follow the link to the download Is there a way to recopy the files while modifying the create date to the modify date in the process? No. You'll have to wait until the pictures reach their final destination before modifying any dates. How is this MicroSD card connected to the computer? If you look in My Computer does it have a drive letter assigned? Do you use the NT copy command to transfer the pictures or some sort of software that came with the phone? The links I posted may have been unclear. FileTouch can be run from the command line and with a little imagination you can extract the modified date of a file and push it into the date created field: Code: [Select]echo off setlocal enabledelayedexpansion SET picDir=c:\temp for /f "tokens=* delims=" %%i in ('dir %picDir% /b') do ( set dtmMod=%%~ti "e:\Small Applications\FileTouch\FileTouch" "%picDir%\%%i" "!dtmMod!" -c echo. ) picDir = the location of the pictures. This is why I asked if the SD card (or phone) is assigned a drive letter c:\filetouch\filetouch = the fully qualified path to the filetouch program; change as required Good luck. Thanks, I will give it a try. The sd card is set up with a drive letter on the lan as I am now using the card slot in my printer. I was SIMPLY using drag and drop to do the transfer. |
|
| 328. |
Solve : Append file name with the hostname? |
|
Answer» I have a batch file to capture tracert and systeminfo and saving to a .txt file, though want to have the file name include the 'hostname'. Example is the file would be tracert(hostname).txt |
|
| 329. |
Solve : Batch script to read data in a URL and save in .csv or .txt format? |
|
Answer» Hi there, |
|
| 330. |
Solve : readyboost + ms-dos prompt? |
|
Answer» HI all .. i really need HELP .. is there any way to activate readyboost by COMMAND prompt? thanks a lot .. Readyboost is a Windows program which uses the Superfetch SERVICE and a USB flash drive or memory card as memory cache and performs boot optimization. It cannot work with any version of MS-DOS. Did you mean Windows command prompt? Anyhow, in a version of Windows which has Readyboost as an option, you activate Readyboost from the context menu of a SUITABLE USB device. Maybe you think there is a magic command that will enable Readyboost on a Windows version that does not support it, or a USB device that fails the compatibility test? Well, there isn't. i see .. thanks a lot sir .. really appreciate it .. Quote from: Salmon Trout on November 06, 2010, 11:17:04 AM Readyboost cannot work with any version of MS-DOS. |
|
| 331. |
Solve : Can batch files edit themselves?? |
|
Answer» I was wondering if it is possible to use a batch file to edit part of another batch file (or itself) Depending on what code is being run, the batch file can continue without error, but most often you will get some obscure error involving an unknown command (even though there isn't). Yes, because when the command interpreter executes a command or program, it stores its position in the script, and if you alter the code size prior to that, when cmd.exe returns, it still returns to that byte position. If it now lands in the middle of a word or command, it may have NONSENSE to interpret. That would explain it! Thanks Salmon! |
|
| 332. |
Solve : How to make a bat file to return the latest file name in a dir ?? |
|
Answer» How to? |
|
| 333. |
Solve : Installing Dos6.22 from CD (I've got a problem)? |
|
Answer» I have a n old very basic computer I want to install Dos6.22 on, I do not have any usable floppy disk's. Even if I had floppy disks that worked I would not want to create un-install disks. The "true" MS-DOS install floppies do not create uninstall disks. The "upgrade" versions; for example, MS-DOS 6.22 Step-up (6.0 to 6.22) Do, however. Otherwise, no Uninstall disks are ever prompted or created. In either case, you should be able to skip it by RUNNING setup with the /G switch. Patio: Since it's prompting for Uninstall disks, it sounds like an upgrade version, which MS has for free download on their site (also, they are useless without a previous installed version of DOS, iirc). How it got on a CD image I haven't the faintest, though.Thanx for the heads up BC... Quote from: BC_Programmer on November 11, 2010, 06:43:25 AM How it got on a CD image I haven't the faintest, though. I can guess... see above remarks about warez. |
|
| 334. |
Solve : copy all pro? |
|
Answer» Hi dear friends, |
|
| 335. |
Solve : MSDOS batch to delete folders older than 30 days? |
|
Answer» Hello i have the following batch file: |
|
| 336. |
Solve : Help with my program!? |
|
Answer» I have made this PROGRAM but i have a major problem. When i run the program and try to make it act on the answers i've inserted it just takes it from the top it doesn't jump to the ":nametag" i've made. Please try it and SEE if one of ya can find the problem i really hope so. if /i [%Answer%]==[Fine] (goto :Good This looks over complex. What's wrong with something like this Code: [Select]if /i [%Answer%]==[Fine] goto :Good if /i [%Answer%]==[Bad] goto :Bad goto :howru By the way, I am uneasy about that shutdown stuff at the end. Childish prank scripts that shut down other people's computers are kind of borderline in terms of the CH RULES aren't they? (I'm being polite - in fact I'm sure they are well over the line.) |
|
| 337. |
Solve : entering directory with commond CD ... not workz if space? |
|
Answer» HI any1 can tell me .... cd doeznt work if space b/w directori name or file name detail: V can enter any directory with commond cd but i experienced dat when there any space b/w a directory nam or file then cd commmend doesnt work Code: [SELECT]C:\> C:\> C:\>cd "\documents and settings\Kohn" C:\Documents and Settings\Kohn> He is saying use QUOTE MARKS. |
|
| 338. |
Solve : Help needed for file deletion based on file extension and specify folder? |
|
Answer» Hi All, |
|
| 339. |
Solve : Command inside for loop in a batch file is not working? |
|
Answer» Hi All, |
|
| 340. |
Solve : Check for case? |
|
Answer» Is there a simple way to check the VALUE of a variable, to determine if begins with an upper/lowercase letter? Or WOULD I have to do a case-sensitive check against a-z separately? |
|
| 341. |
Solve : Dos Batch: Kill parallel jobs at the same time? |
|
Answer» I am running the bat job(main bat) and that will call the two bats parallely at the same time, I am running the bat job(main bat) and that will call the two bats parallely at the same time, How are you doing that? When a call is made, the calling file enters a wait state and the called file begins executing. When the called file ends, control is returned to the calling file at the next sequential instruction after the call. This occurs no matter how MANY levels of calls are used. USING ctl+C will terminate the entire run unit. It would be helpful if you posted your code and please mention your OS. Thankyou.. Following is the code of the main bat file.. D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MAbatch\jobs\old_Campaign_DB_Personal.bat call D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MAbatch\jobs\Count_db_pers.bat Following is the code for the 2 bat files.. Following is the code of the first bat file... setlocal REM ********************************************************* REM * Rundate 'D'YYMMDD must be specified as first argument * REM ********************************************************* REM ********************************************************* REM * Command-file must exist * REM ********************************************************* FOR /R D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MASched\jobs\DB_Personal\ %%G IN (*.bat) DO start /b "call D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MASched\jobs\DB_Personal\" %%G set rc=%errorlevel% REM ******************************************************* REM * Exit script and report return code * REM ******************************************************* :done echo rc=%rc% exit /b %rc% REM ******************************************************* REM * Handle argument errors * REM ******************************************************* :noargument echo Error: No argument specified set rc=2 goto done :nopgm echo Error: Command file "%sch_command%" does not exist set rc=2 goto done Following is the code of the second bat file. echo off & setLocal enableDELAYedexpansion set toterrors= set totjobs= for /f "tokens=1 delims= " %%a in (D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MASched\jobs\count\count.txt) do ( set /a toterrors+=%%a ) for /f "tokens=2 delims= " %%b in (D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MASched\jobs\count\count.txt) do ( set /a totjobs+=%%b ) echo total errors is !toterrors! echo total jobs is !totjobs! goto :EOF Wow! Main.bat Quote D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MAbatch\jobs\old_Campaign_DB_Personal.bat The first statement will transfer control to old_Campaign_DB_Personal.bat. There is no mechanism to return, the next statement (call) will never GET executed. First.bat Quote FOR /R D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MASched\jobs\DB_Personal\ %%G IN (*.bat) DO start /b "call D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MASched\jobs\DB_Personal\" %%G Choose either start or call but not both. Note the /b switch on the start command disables CTL+C. The Second.bat file seems OK. It may help to map out what you expect to happen, read up on the both the start and call commands and go from there. Good luck. |
|
| 342. |
Solve : Creating different version in a folder? |
|
Answer» Hi All, |
|
| 343. |
Solve : CIPHER command? |
|
Answer» Hi all, Are you saying that if i encrypt a file that another user on the same computer wont be able to see it? No. I'm saying they won't be able to access it. Quote from: BC_Programmer on November 15, 2010, 07:41:58 PM No. I'm saying they won't be able to access it. Indeed. One thing that you can’t do with the Cipher tool that you can do through the GUI is give other users cryptographic access to encrypted files or folders. Windows XP and 2003 Server (unlike Windows 2000) allow the person who encrypts a file to ADD other user accounts that enable others to view his/her encrypted data. This is done through the Encryption Details dialog box (accessed VIA the Details button on the Advanced Attributes property sheet). There is no mechanism for doing this with the Cipher tool. Quote from: Salmon Trout on November 16, 2010, 12:23:18 AM There is no mechanism for doing this with the Cipher tool. Windows 7 or vista added a /ADDUSER switch to cipher. |
|
| 344. |
Solve : using one router like the "GoToMyPC" technology? |
|
Answer» all, Would it be possible for me to connect to one computer that is connected to the same router as my requesting computer?Of course. Quote What I want to do is use my one router that I have as a substitute for a LAN. I know that really can't be done technically,That's EXACTLY what it is; the computers connected to a router form a LAN. short story: you'd need to find the lan side IP address of the computers involved. My desktop, for example, is 192.168.0.100; obviously, this has nothing to do with connecting to the internet or anything outside the LAN; other network computers can see my desktop as that IP, but outside of the LAN it's meaningless. Usually, there is a PAGE on the router setup pages where you can see the IP assignments within the LAN for each machine. Or, you can just use ipconfig; the IP address of your machine is the LAN-side address. |
|
| 345. |
Solve : "invalid drive specification"? |
|
Answer» Hope this isnt a silly question...ive created an xp boot disk. after booting to it i type C: to get to the c drive but all i get is "invalid drive specification". Hope this isnt a silly question...ive created an xp boot disk. after booting to it i type c: to get to the c drive but all i get is "invalid drive specification".Quote from: manishverma481 on NOVEMBER 23, 2010, 12:38:03 AM Start a new thread and don't reopen threads that are almost seven years old. |
|
| 346. |
Solve : sync folders? |
|
Answer» Hi, this is my first post here, so please forgive me if I have done something wrong (posted in the wrong place or i dunno) Right now I've got a batch file to backup from My Documents to a NETWORKED drive at work. But I was wondering if there was a way to do this, but check to see if a file has been deleted. I have gotten rid of some files in my documents and they are still on my network drive. If I don't delete them from both at the same time I forget which ones they are.Ok, It took me over 5 days, but I finally found a solution, well, a partial solution anyway, heres the new code for anyone that's interested: Code: [Select]echo off title = Folder Backup! (program by Polle) color 0e MKDIR %~d0\Music MKDIR %~d0\willekeurig MKDIR %~d0\Vuze MKDIR %~d0\batch MKDIR %~d0\CwindowsMD cls set /P backup= Backup van alles maken? (j/n) : if %backup% EQU j goto B set /P muziek= Backup van muziek maken? (j/n) : set /P willekeurig= Backup van documenten maken? (j/n) : set /P Vuze= Backup van Vuze maken? (j/n) : set /P Batch= Backup van batch bestanden maken? (j/n) : goto A :A set start1=%time:~0,2% set start2=%time:~3,2% set start3=%time:~6,2% set starttime=%start1%:%start2%:%start3% title = making music backup... (program by Polle) if %muziek% EQU j xcopy /d /c /y "C:\Users\Polle\Music" "%~d0\Music" for /r "%~d0\Music\" %%F in (*.*) do echo %%F>> file.txt for /F "tokens=2* delims=\" %%I in (file.txt) do if not exist "C:\Users\Polle\%%I\%%J" del "%~d0\%%I\%%J" del file.txt title = making documents backup... (program by Polle) if %willekeurig% EQU j xcopy /s /d /c /y "C:\Users\Polle\willekeurig" "%~d0\willekeurig\" for /r "%~d0\willekeurig\" %%F in (*.*) do echo %%F>> file.txt for /F "tokens=2* delims=\" %%I in (file.txt) do if not exist "C:\Users\Polle\%%I\%%J" del "%~d0\%%I\%%J" del file.txt title = making Vuze backup... (program by Polle) if %Vuze% EQU j xcopy /s /d /c /y "C:\Users\Polle\Vuze" "%~d0\Vuze\" for /r "%~d0\Vuze\" %%F in (*.*) do echo %%F>> file.txt for /F "tokens=2* delims=\" %%I in (file.txt) do if not exist "C:\Users\Polle\%%I\%%J" del "%~d0\%%I\%%J" del file.txt title = making batch backup... (program by Polle) if %Batch% EQU j xcopy /s /d /c /y "C:\Users\Polle\Desktop\danger" "%~d0\batch\" if %Batch% EQU j xcopy /s /d /c /y /h "C:\Program Files\CwindowsMD" "%~d0\CwindowsMD" for /r "%~d0\batch\" %%F in (*.*) do echo %%F>> file.txt for /F "tokens=2* delims=\" %%I in (file.txt) do if not exist "C:\Users\Polle\Desktop\%%I\%%J" del "%~d0\%%I\%%J" del file.txt for /r "%~d0\CwindowsMD\" %%F in (*.*) do echo %%F>> file.txt for /F "tokens=2* delims=\" %%I in (file.txt) do if not exist "C:\Program Files\%%I\%%J" del "%~d0\%%I\%%J" del file.txt set stop1=%time:~0,2% set stop2=%time:~3,2% set stop3=%time:~6,2% set stoptime=%stop1%:%stop2%:%stop3% set /A result1=%stop1% - %start1% set /A result2=%stop2% - %start2% set /A result3=%stop3% - %start3% set resulttime=%result1%:%result2%:%result3% cls echo start = %starttime% echo stop = %stoptime% echo duration = %resulttime% pause exit :B set muziek=j set willekeurig=j set Vuze=j set Batch=j goto A It now finds and deletes 99% of the incorrect files, but it doesn't delete the incorrect folders If anyone knows a similar solution to delete the folders, please tell, but for now, this is good enough for me * NOTE: I did clean up the file a bit tough, so it's smaller, so it doesn't perfectly reflect the first file i posted *FINAL SOLUTION: this removes files AND directories This finds all files that are on your external HDD but not on your home pc and erases them: note: I am comparing the folders "%~d0\Music\" (on my HDD) and "C:\Users\Polle\Music" (on my home PC) Code: [Select]for /r "%~d0\Music\" %%F in (*.*) do echo %%F>> file.txt for /F "tokens=2* delims=\" %%I in (file.txt) do if not exist "C:\Users\Polle\%%I\%%J" del "%~d0\%%I\%%J" del file.txt this will delete all remaining empty folders on my HDD: Code: [Select]for /f "usebackq delims=" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d" |
|
| 347. |
Solve : Dos:Unable to call multiple bat files from single bat file? |
|
Answer» I am trying to CALL the bat file(main.bat) which contains 2 bat files(first, second and first bat files internally calls multiple bat files and outputs that to a file(also echos) and second bat file reads that file and calculates the total and echos back to the dos You are using D:\DAT\SAS\DMT\Lev1\SASMain\Data\MAMisc\MASched\jobs\DB_Personal\True, but chances are the file system arrangement is beyond their control. You can't just say "Because it is easier for me, everybody must store their files in this particular arrangement" in a company. Quote Why do you confuse the whole situation with the complication ofProbably because that was in his batch file. Quote Finally, this code fragment is ludicrously wrongIt works fine. It looks like they were trying to run the various batch files asynchronously, but because /b was specified they all end up waiting on each other for the console anyway. Quote REGARDLESS of all the previous horrors, buried at the end of all the needless verbiage, is the SPACE character, i.e.it works either way. Quote from: BC_Programmer on November 22, 2010, 02:09:34 PM True, but chances are the file system arrangement is beyond their control. You can't just say "Because it is easier for me, everybody must store their files in this particular arrangement" in a company.I accept that he cannot stipulate the paths that are used company wide, but he SHOULD have the ability to compose a very concise file path with which to explore how to call / start bat scripts. I find extremely verbose scripts to be a pain and tend to obscure any tiny (but significant) code error. I always prefer to have a small script with the one feature that does not work for me, and only after learning how to use it will I go back to the grand picture. Quote it works either way.Are you sure, or did you fail to spot the obscure error to which I drew attention ? Please explain any error in my test and explanation which follows. I have created TEST.BAT at location D:\DAT TEST.BAT code Code: [Select]echo This script is %0 I have used RUN and launched CMD.EXE and invoked TEST.BAT twice, with and without the extraneous space character, and selected and pasted the window contents below. Code: [Select]Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. C:\Documents and Settings\Dad>CALL D:\DAT\ TEST 'D:\DAT\' is not recognized as an internal or external command, operable program or batch file. C:\Documents and Settings\Dad>CALL D:\DAT\TEST C:\Documents and Settings\Dad>echo This script is D:\DAT\TEST This script is D:\DAT\TEST C:\Documents and Settings\Dad> Regards Alan Quote from: ALAN_BR on November 22, 2010, 03:22:49 PM Are you sure, or did you fail to spot the obscure error to which I drew attention ?Works for me. Probably because I tested what he had and was executing, rather then a more bare case that essentially avoids any issue. First, I created a bunch of batch files in D:\testbat, test1.bat through test9.bat, they simple contained: Code: [Select]echo this is %0 and then this one (in a separate folder) Code: [Select]FOR /R D:\testbat\ %%G IN (*.bat) DO start /b "call D:\testbat\" %%G and the output: Code: [Select] D:\testbat>start /b "call D:\testbat\" D:\testbat\test1.bat D:\testbat>start /b "call D:\testbat\" D:\testbat\test10.bat D:\testbat>start /b "call D:\testbat\" D:\testbat\test2.bat D:\testbat>start /b "call D:\testbat\" D:\testbat\test3.bat D:\testbat>start /b "call D:\testbat\" D:\testbat\test4.bat ♪◙ D:\testbat>start /b "call D:\testbat\" D:\testbat\test5.bat this is D:\testbat\test1.bat D:\testbat>start /b "call D:\testbat\" D:\testbat\test6.bat ♪◙ D:\testbat>start /b "call D:\testbat\" D:\testbat\test7.bat D:\testbat>this is D:\testbat\test2.bat this is D:\testbat\test10.bat D:\testbat>this is D:\testbat\test3.bat start /b "call D:\testbat\" D:\testbat\test8.bat D:\testbat> D:\testbat>start /b "call D:\testbat\" D:\testbat\test9.bat D:\testbat> D:\testbat> D:\testbat>this is D:\testbat\test4.bat this is D:\testbat\test7.bat D:\testbat>this is D:\testbat\test5.bat this is D:\testbat\test6.bat D:\testbat> D:\testbat>this is D:\testbat\test8.bat D:\testbat> D:\testbat>this is D:\testbat\test9.bat which was certainly weird (what with the starts and the fact that the output was usually delayed and they had to wait for each other and all) but there were no syntax errors. On the other hand, when I said "it works either way" I was being disingenuous; truly, it doesn't work with the %%G in the quotes. In the first case (outside the quotes) start is using the quoted portion as the window title, and then executes the second part (the batch filename). Whether this was intended, I haven't a clue. Including the %%G within the quotes would cause an error, as it would then expand to start /b "call D:\testbat\D:\testbat\test9.bat" which clearly wouldn't work. Also, I rather like the musical symbols that the batch throws in the output. adds a nice touch. Thanks for the explanation. I like your concise code, i.e. Code: [Select]FOR /R D:\testbat\ %%G IN (*.bat) DO start /b "call D:\testbat\" %%G I now see that "call D:\testbat\" is the title and not part of the command. I was rather confused that the title was preceded by the argument /b. I thought the title was always first after the start. It has been a long time since I used "FOR /R" and I wrongly guessed that %%G would be appending the name of each *.bat in the folder, so assumed the intention was Code: [Select]call "D:\very long path which MAY have spaces that need quotes\"%%Gin which case a space before the %%G would have broken the path Question, what are the benefits and side effects of giving a title to a program with no window so no title BAR ? I have just created t.bat and started it with a title, it ran in the "DOS window" that invoked it and had no effect on the existing title bar, no effect whilst it was paused, no effect after it was ended. Code: [Select]C:\Documents and Settings\Dad>echo pause > t.bat C:\Documents and Settings\Dad>start /b "a silly misleading title" t C:\Documents and Settings\Dad> C:\Documents and Settings\Dad>pause Press any key to continue . . . C:\Documents and Settings\Dad> Regards Alan Quote from: ALAN_BR on November 23, 2010, 05:23:44 AM I like your concise code, i.e.Not sure if it's sarcasm... but in any case, I basically wanted to test what they had; so that I could see the same sort of behaviour. Upon seeing that it worked, it was possible to figure out why. Quote I was rather confused that the title was preceded by the argument /b.I don't think it really matters wether switches appear before or after; although they have to appear before the command (which in this case is %%G) (otherwise those switches will be sent to the command) Quote Question, what are the benefits and side effects of giving a title to a program with no window so no title bar ?none... since the /b switch suppresses creating a new window, the title has no effect. I suspect the batch was only working entirely accidentally. Quote from: BC_Programmer on November 23, 2010, 05:28:24 AM Not sure if it's sarcasm...Definitely not sarcasm. Short and all on one line, not long and wrapped to continue on following line. Simple to read. I admire your patience at testing every aspect of the original code. I developed undying hatred of software verbosity when I inherited and had to correct code from vandals that MOVED away. They left me with 'C' code in which every line of code was up to 400 characters wide. When I scrolled to the last bug on a line, I could no longer see the previous 75% of the line. Partly the problem was that they chose to indent the code by increments of 8 characters and they had many levels of indentation, but mostly they chose NOT to document Global Variables with a comment upon the real purpose, and instead the variable was given a LENGTHY self documenting name. e.g. code such as Value_to_put_in_DAC_register_1 ^= Value_for_DAC_register_1 *= Scaling_Factor_for PAL_Colour - PAL_SECAM_OFFSET etc etc Some of their code depended upon the "rules of precedence" for which there are ANSI standard rules, but the compilers in use were not quite compliant ! ! ! Regards Alan |
|
| 348. |
Solve : Separate String with No Delimiters? |
|
Answer» Is it possible to tokenize a given string, character by character, when no DELIMITERS are present? E.G., if the string contained "abcd" instead of "a,b,c,d". |
|
| 349. |
Solve : need batch file code to start a program minimized, "start /b /min" does not work? |
|
Answer» my .bat file code: |
|
| 350. |
Solve : change to a server drive in a BAT file? |
|
Answer» in the RUN cmd I can TYPE \\myserver\d$ and it will direct me there. |
|