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.
| 2501. |
Solve : List Directories in other user profiles? |
|
Answer» Hello again! |
|
| 2502. |
Solve : How do you replace char in "%DATE%" "/" to "? |
|
Answer» Looking for a way to replace the "/" spit out in the %DATE% command with "_", so that when declaring to create a folder which has the Date Stamp, I dont end up with the primary folder Wed 11, subfolder 22, subfolder 2006, when executing command MD "%DATE%" in my archive to pass daily full backups to of specific data in my batch. For "Wednesday 11/22/2006" |
|
| 2503. |
Solve : Prompt for dir name when copying files? |
|
Answer» Hey all! I've searched far and wide trying to FIND the right commands but i couldnt find the answers so i hope someone can help me! |
|
| 2504. |
Solve : Copy file by date? |
|
Answer» Hi All, |
|
| 2505. |
Solve : using batch file to process lines of text file? |
|
Answer» I have a batch file to check and see if files exist and if so then list them in a txt file - something like this: Thank you. I will look into that. Do have know of a good resource or two for writing VBScript? i came up with this link http://podgoretsky.com/ftp/Docs/VBScript/. you can have a look. There are other links too, if you search hard enough. good luck I just wanted to report back that after removing the quote marks the proposed method woks nicely. See below: Code: [Select]@echo off for /f "tokens=* delims=" %%i in (path\filename.ext) do ( if exist %%i echo %%i>>%systemdrive%\found.txt ) THANKS FOR YOUR HELP |
|
| 2506. |
Solve : Replacing spaces with underscores in a string? |
|
Answer» I have a string which has spaces in it, and I NEED to replace all of the spaces with UNDERSCORES: I have a string which has spaces in it, and I need to replace all of the spaces with underscores: if you have PYTHON Code: [Select]C:\>python -c "PRINT 'This is a string'.replace(' ','_') " This_is_a_string I do like the python solution, but once I get the return from the line: C:\>python -c "print 'This is a string'.replace(' ','_') " This_is_a_string (i.e. the part that says "This_is_a_string"), how do I put that part into a new string? Thanks, darrylwell since you have Python, just do a Python script Code: [Select]s = "This is my string" result = s.replace(" ", "_") #store the result in variable print result save the code as test.py. Then from command prompt, type c:\> python test.py |
|
| 2507. |
Solve : Interrupts? |
|
Answer» I used Turbo C for programming in INTERRUPTS. Some of the interrupts work well in win 98. But not in win 2000 Please help.The ONES that done work are probably ones that WOULD be bad for USE in a multi tasking environment |
|
| 2508. |
Solve : Library in need of help with batch script? |
|
Answer» Hello, |
|
| 2509. |
Solve : Redundant Hardware Batch to Stop? |
|
Answer» Hello... I am working on a batch file that will constantly run in a timed loop using the choice command from an earlier Windows release in Windows XP Pro, with a 60 second timer, so that I dont have a constant ping to the systems being monitored. Everything works except I cant FIGURE out how to pass or (read) the OUTPUT to a condition to be tested for PINGING or NO PING in the batch. |
|
| 2510. |
Solve : CMD need help :'(? |
|
Answer» How to disable keypresses like ctrl+alt+delete or nearly equal commands or just SINGLE buttons like "K". |
|
| 2511. |
Solve : Open Excel program? |
|
Answer» my batch file coding as follows, my batch file coding as follows, This can't work. This should START the Macro1.xls and exit the batchfile: If the batchfile shall wait: call "C:\Testing\Macro1.xls" To check if the macro is in the folder use for example: if EXIST "C:\Testing\Macro1.xls" ("C:\Testing\Macro1.xls") hope it helps uli if you just want to open the macro1.xls why don't you use this: Code: [Select]start c:\testing\macro1.xls |
|
| 2512. |
Solve : Need Help importing and exporting data? |
|
Answer» I am still pretty new to batch files, but am getting a handle on the simple things. Some of the more complex syntax is still a mystery to me and I think that's the help I could use. I've looked at these forums quite a bit, but some of the scripting you all do is pretty wild and sometimes difficult to get a handle on. |
|
| 2513. |
Solve : Determine if command is successful in silent mode?? |
|
Answer» Hello all. |
|
| 2514. |
Solve : Expanded? |
|
Answer» I have an old Toshiba T6400SX LAPTOP running DOS 5.0 with Lotus 123 2.3 installed. |
|
| 2515. |
Solve : Appending modification timestamp to a filename? |
|
Answer» I've been asked to write a batch file to do the following: ftp a LOG file from a unix server to a Windows machine and append the modification date and time of that file to its name. These ftp'd files will always be called log1, log2 etc up to log5. |
|
| 2516. |
Solve : seperate #'s from folder name and adding 1? |
|
Answer» Hello again. I'm reposting this question a little clearer to hopefully remove some of the confusion about it. For the "looping from 99 to 00" you can do: Thanks.Ok, nevermind on that as well, I fiddled with it and worked it Thanks again guys. This is gonna help a LOT. For those interested, here's the final code: Code: [Select]@echo off for /f "delims=" %%a in ('dir /od /b "\\ullsapcwdyfd0\acftsends\big windy\101"') do set newest=%%a set lasttwo=%newest:~6% set /a next=%lasttwo%+1 if %next% GEQ 100 set /a next-=100 if %next% LEQ 9 set next=0%next% echo The Data Transfer expected is: FCO101%next% pause for /f "tokens=1-2 delims=." %%t in ('dir /b b:\*.a01') do set current=%%t echo You are trying to send %current% pause if FCO101%next% equ %current% ( color a0 call c:\send.bat ) else ( color 40 echo THIS IS NOT THE CORRECT SEND NUMBER! WE ARE EXPECTING FCO101%next% PLEASE SEND THE CORRECT ONE. pause ) With send.bat being: Code: [Select]@echo off for /f "tokens=1-2 delims=." %%i in ('dir /b b:\*.a01') do ( md "\\ullsapcwdyfd0\acftsends\big windy\101\%%i" copy b:\*.* "\\ullsapcwdyfd0\acftsends\big windy\101\%%i" ) PAUSE Works like a champ |
|
| 2517. |
Solve : Query a service? |
|
Answer» HI all, I can't seem to figure it out for the life of me. Is it possible to query a service that is running or not? I WANTED to query a service and have a prompt that it is running or not. Like: reg query "HKLM\System\CurrentControlSet\Services\srservice" /v start For this instance, I would like to be prompted if the service is running or not. The "start" value determines if it is running or not, 4 is disabled, 2 is ENABLED. If there is another way other than QUERYING the registry, it would be helpful as well. depending on your OS , you can use resource kit tools like sc, sclist http://www.ss64.com/nt/sclist.htmlYou can use the NET START command to see a list of running services. In fact, I just posted some of this same code a few questions back. It looks like you are looking at the System Restore service, so you could use: Code: [Select]net start | FIND /I "System Restore" >NUL if not ERRORLEVEL 1 ( echo System Restore appears to be enabled ) else echo System Restore does not appear to be enabled |
|
| 2518. |
Solve : Hide DOS window when using vbs shortcut? |
|
Answer» I'm using a .vbs shortcut to open as Access database. Everything works great but I would like to hide the DOS window when opening the database. As it is now, the DOS window executes for a split second and then my database opens. I don't want the DOS window to be seen at all. Is this possible??? |
|
| 2519. |
Solve : %1 problem? |
|
Answer» hello,
for the moment it's easy, so hello.bat world will print " you have pressed world" but i would like a kind of security showing " you have to write something like hello.bat test " if nothing is wrote after the batch name but i dont know how to do that. i'm looking for something like Quote
thanks, regards. Try this IF "%1"=="" echo "you have to write something like hello.bat test" else ( echo "you have pressed world %1") Graham perfect !!! thanks a LOT! |
|
| 2520. |
Solve : copy under Dos? |
|
Answer» HELLO there I am working under MS-Dos. I would like to copy a file from a floppy disk to another floppy disk using the same disk drive. I don´t have any hard disk drive. What is the appropriate command with options? xuRight in the BACKYARD...diskcopy a: a: and press enterHmmmm.. We just gotta do better... Pity the OP didn't give the MS-Dos version in use.. No hdd means running Ms-Dos from a floppy. So, basic assumption - no Windows of any breed. The OP wants to copy a [highlight]file[/highlight] not a disk. Provided that the target file is on the disk in A: surely MS-Dos will accept the command: Copy A:\filename.ext B: The user will be prompted to insert the diskette for either A: or B: and may be prompted several times depending on the size of the file. Anyway, that's how it works on my MS-Dos beasties.. (vers 6.22 and 7.10) The Copy parameters are: COPY [/A | /B] source [/A | /B] [+ source [/A | /B] [+ ...]] [destination [/A | /B]] [/V] [/Y | /-Y] source Specifies the file or files to be copied. /A Indicates an ASCII text file. /B Indicates a binary file. destination Specifies the directory and/or filename for the new file(s). /V Verifies that new files are written correctly. /Y SUPPRESSES prompting to confirm you want to overwrite an existing destination file. /-Y Causes prompting to confirm you want to overwrite an existing destination file. The switch /Y may be preset in the COPYCMD environment variable. This may be overridden with /-Y on the command line To append files, specify a single file for destination, but multiple files for source (using wildcards or file1+file2+file3 format). How did you get DOS On a floppy :-? I'm just currious Thanks Al968Quote We just gotta do better Seriously!! Good answer. Copy a:xxx to b:xxx will work fine on most setups. Maybe the OP will come back with details if it doesn't. Mac Just couldn't resist - also ran Copy A:>>> B:>>> using MS-Dos 3.21 on old Bondwell hardware, single 720k floppy drive, worked a treat. Al968 - MS-Dos will boot from just about 3 or 4 files which must include MS-Dos.sys and Command.Com. The rest of the files such as Copy, Append, Attrib, included with MS-Dos are add-ins which make life easy but are not essential. My geriatric Bondwell boots into MS-Dos 3.21 and I have RUN QBasic, Assembler and user apps from the single 720 floppy. If your query really asks where did I get MS-Dos on a floppy, my copy came with the hardware from an on-line auction, if you're asking where to download it from forum rules do not permit me to answer that. Here's a CH article. Good luck, hope the OP comes back to report success or failure.. But those are enough to include basic DOS internal commands.Sure - most of the externals are not required so a lot of disk space can be freed up by backing up the bootable disk then deleting them from the disk used to boot. Also it's possible to create a ramdisk which could be used to emulate a little hdd - kinda!! - if there is enough ram available. Lot of fun to be had with geriatric systems... Thanks Dusty Actually I was just wondering what files you had to put where you GOT it from or where you downloaded from doesn't specialy interest me Thanks Al968Meanwhile he has gone AWOL...but feel free to carry on. Aye aye skipper.. |
|
| 2521. |
Solve : Directory size.? |
|
Answer» In any version of MS-DOS is it possible to display the total size of a directory without using a third party utility? |
|
| 2522. |
Solve : help with delete user batch code? |
|
Answer» Hi, |
|
| 2523. |
Solve : Batch File Help...please? |
|
Answer» Hi everyone... Set /P filenum Yeah, Graham - That answers the users "prompt me" need. I don't use that because Set /P does not work on WindowsNT (in cmd or command or QBasic's funny command) So I cannot prompt from a BAT file. If I ever have the need, I use a QBasic program (which comes free with WindowsNT, presumably to overcome limitations like that - LOL) Mac |
|
| 2524. |
Solve : Problems with the command.com? |
|
Answer» Hello I have tried a program based on ms-dos to run, when tried to load the computer it is sent me a message that didn't find the command.com and it halted the computer. the ms-dos version is 6,22. In some PART I could read that this sometimes happens when there is virus, but have I tried to find some ant-virus that it can run from a disquet That recommend me? with a boot disk it is able to carry out a transfer of the system with the SYS, attempt load the complete MS-DOS but neither it starts up.Quote Hello I have tried a program based on ms-dos to run, when tried to load the computer it is sent me a message that didn't find the command.com and it halted the computer. the ms-dos version is 6,22. In some part I could read that this sometimes happens when there is virus, but have I tried to find some ant-virus that it can run from a disquet That recommend me? with a boot disk it is able to carry out a transfer of the system with the SYS, attempt load the complete MS-DOS but neither it starts up. Try AVG antivirus it works great 8-) and the command.com file can you find just by searching in google MJGG.. Are you trying to install MS-Dos 6.22 on your hard disk :-? Will you be running standalone MS-Dos :-? PLEASE give some details of your pc and OS..Hello, yes i try to install MS-Dos 6.22 for run one aolication on Dos, but the computer y for work only on ms-dos.If your hdd is formatted (FAT) then boot from the bootdisk and at the A:\> prompt type SYS C: and press ENTER. This should transfer MS-Dos 6.22 files to the hdd. Now remove the bootdisk from the drive and boot from the hdd. If you fail to boot from the hdd check the boot sequence in bios and change it if necessary. Good luckYes, i did all that you write me, and when i start the computer again give diferent message, some TIME run good in c:, but other time no star, o halt the system, i transfer with SYS from a boot disk, and start, and after when i try the install the program, give the error no found command.com???More info please - How are you trying to install the program :-? What commands do you enter to run the program :-? |
|
| 2525. |
Solve : want to remove USB drive after executing .bat? |
|
Answer» I've checked the forums using what strings I could think of in hopes of finding the question answered, but MAYBE I'm just not supplying the correct search strings. I apologize if this has been answered before. I believe the problem is that the first batch file is not fully ending and then starting a new process for the second batch file Unless there is more code in the first batch file, it's safe to say the first batch file ends. As written, the started task (runcust.bat) is inheriting the environment from first.bat...presumably with the USB drive allocated. Try using the /i switch on the start command where the new environment will be the original environment passed to cmd.exe and not the current environment. USB drives should not be removed before stopping them. Either use the "Safely Remove Hardware" icon from within Windows or you can use: RunDll32.exe shell32.dll,Control_RunDLL hotplug.dll from within the command processor or a batch file. The above task is interactive, so you may think twice about adding it to your batch file. Why the rush to remove the drive anyway? 8-)I will give the /i switch a try. I think I may have given that a shot, but then again, I could be wrong. I do know that the USB drive shouldn't be removed without safely removing it first, but 1, its a work thumbdrive, and everything on it is also saved on several other locations (excluding my custom batch files), and the entire thing is only about 5-600 mb, not a big deal to format and copy the data back over, and 2, I have never had a problem with just pulling it out, as long as I close any files that are open (which is part of why I am so concerned about this batch file). As to why I'm in a rush to remove the drive, I have only two thumb drives, and have to run this batch file and all the other files on 5-10 computers at a time, and each need to be done in about 20-30 min, tops. Anything I can do to automate this process is good for me Also, the less user intervention, the better... my fellow technicians (and i, sometimes, i'll admit) are forgetful, especially when we are really, really busy, and so we sometimes FORGET to remove some critical settings, such as the proxy server, or forget to delete this folder off the desktop, so I want to make it as foolproof as possible. If /i doesn't work, I guess I give up. Its not a huge deal, I was just hoping to help out my team a bit. |
|
| 2526. |
Solve : Remove text file from? |
|
Answer» Thanks to alot of help in this forum, I am moving forward with a batch script that will input system names from a text file and then copy a certain file to these systems. I have included that script below. |
|
| 2527. |
Solve : Performance Logs? |
|
Answer» HELLO all, Looking to find a WAY of checking on the status of COUNTER Logs to ensure they are started/running by MEANS of a script ?? If the log/s happen to be stopped, then the SAID script would start those logs stopped. Have no idea what commands would accomplish such a task. |
|
| 2528. |
Solve : Editing .lnk files? |
|
Answer» Hi All, |
|
| 2529. |
Solve : Copying files in MS Dos Network? |
|
Answer» Can any BODY tell me.... |
|
| 2530. |
Solve : Altering Properties of a Service? |
|
Answer» Hi all, |
|
| 2531. |
Solve : msdos cursor? |
|
Answer» how do i exit the msdos CURSOR. I already WROTE exit next to the cursor and nothing happensWelcome to the forums. how do i exit the msdos cursor. I already wrote exit next to the cursor and nothing happens goto propertis and remove quickrewriteing mode |
|
| 2532. |
Solve : Verifying a reboot? |
|
Answer» Is there any WAY to verify if a PC on a network, has REBOOTED using DOS?? |
|
| 2533. |
Solve : Batch file to upzip zip file automatically? |
|
Answer» I have created a batch file that opens an exe zip file. I WOULD like to have the batch not only open the exe zip file but choose "Unzip" and close the zip file when it's finished. Is this possible and if so, how? :-? Here is what I have already: |
|
| 2534. |
Solve : display most recent item? |
|
Answer» How can I MAKE DOS display the last thing that it echoed? For example: |
|
| 2535. |
Solve : Batch to copy latest file?? |
|
Answer» I have a folder of audio files from which I NEED to copy the latest file to ANOTHER drive. That is, a folder on my Z: drive contains audio59.wav, audio60.wav and audio61.wav. I need a batch file that will copy Z:\audio61.wav to C:\audio.wav. I need a batch file that will copy Z:\audio61.wav to C:\audio.wav I confined the RESPONSE to just this part of your batch file. Code: [Select]@echo off for /f "TOKENS=* delims=" %%i in ('dir /o:-d /a:-d /b z:\') do ( copy z:\%%i c:\audio.wav goto skip ) :skip 8-) PS. When did FINDSTR start inserting carriage returns into strings? :-?That's great! Thank you very much for the help. Question: Can you explain what the "delims" the "tokens" and the "%%i" do? Thanks again!For a truly nightmare description of the FOR statement, type: FOR /? at your command prompt. You may have overlooked my question to you: When did FINDSTR start inserting carriage returns into strings? 8-) |
|
| 2536. |
Solve : Backing up: Deleting files that aren't in original? |
|
Answer» I have an external harddrive, and I want to use a batch file to backup my DATA PERIODICALLY. What I have right now follows the FORMAT |
|
| 2537. |
Solve : Create shortcut using a Batch file? |
|
Answer» Hi, i am not a programmer and would like to know if it is possible to either creat or COPY a shortcut from a drive to the desktop of a user, using a batch file ? The PROBLEM is that each person logs using an individual log on..I would have to say no. DOS does not see shortcuts and batch FILES are just prewritten DOS COMMANDS. I'm sure you COULD write a script to do it, but that's outta my league.Thanks very much for the answer, will do it with Excel....Which kind of shortcut? |
|
| 2538. |
Solve : DOS Program on Windows XP? |
|
Answer» I have a dos bookkeeping program. When I click on the icon to open it up it keeps telling me the files in my config.sys must be at least 65 plus any programs used by simultaneous programs. You should increase the number of files by three. Press enter to automatically update your config.sys file and |
|
| 2539. |
Solve : problem with delay command? |
|
Answer» hi, |
|
| 2540. |
Solve : displaying "%"? |
|
Answer» For a strange reason Dos won't DISPLAY "%" in winXP |
|
| 2541. |
Solve : PC DOS??? |
|
Answer» WHATS different between PC DOS and MS DOS? How to install PC DOS into hard disk as a partition? I have PC DOS files = 7.93MB contains 6 disk folders. How can i install it? You will need an EMPTY Hard drive to do this as it has to RESIDE on the root (C) drive... INSERT disk #1 and type setup and hit Enter at the A: prompt. The difference is minimal it just wasn't written by MS.Googled and CAME up with this and this... Heaps more info on the WWW Good luck |
|
| 2542. |
Solve : File Size - It's Crunch Time? |
|
Answer» Folks, I have to be ABLE to determine whether the file created as a result of an FTP is greater than zero bytes. I'm no DOS wiz and I've looked over and tested a mountain of code - none of it seems to work under NT. |
|
| 2543. |
Solve : Model-specific string into a variable? |
|
Answer» I am using a network boot cd that automatically installs the drivers onto a computer. The problem is, we have several different kinds of computers, and I am TRYING to make it so that it automatically installs the right one. As such, I need a model-specific string to compare in order to tell the program what driver to install. I've got everything figured out except how to get the program to distinguish between computers; right now I'm using a choice menu manually, which gets old when you're dealing with lots of computers... I am using a program that returns the CPU speed Where does this program return the CPU speed? On the screen? In a FILE? What OS is this boot disk booting? The easiest way would be to have the CPU speed in a file; if CURRENTLY on the screen, you might be able to redirect the output to a file. If the boot disk boot is MS-DOS, the FOR statement didn't have all the options necessary to read this file and extract the DATA you require. SOL. After booting this disk, try running a SET command and see if any variables set by the OS are unique to each machine. Another choice would be to put a uniquely named file on each machine's hard disk; you could then check for the existence of a specific file label and load the correct driver. Lotta machines, lotta work! Good luck. 8-)The program returns the CPU speed on the screen. I cannot put the file on the computer, for security/business reasons (don't worry about why, let's just say we can't ) Running the SET command does not yield any model-specific variables, unfortunately. Thanks, -darrylHave you considered using %computername% rather than model specific strings. Each computer on the network should have a unique name, which you can get a list of with the command net view (for all computers in the same workgroup). Net view also has switches for listing computers in different workgroups.I have indeed tried the %computername% approach. Unfortunately, I am using a boot CD and this function is not supported. It is a network boot CD, and does not register computername or any of the files on the HDD. Thanks, -darryl |
|
| 2544. |
Solve : Run a exe file from a USB? |
|
Answer» I have a program that I want to load up everytime I plug in my USB stick but I am having TROUBLE finding a way to do that, I was thinking that I could do a batch script to run the program but because I use the USB stick in many different computers that all assign it a different drive letter I am finding it difficult to acheive what I am after. |
|
| 2545. |
Solve : Boot disk (need a specific boot command)? |
|
Answer» My restore CD has to be opened mannually... but i don't know the command. I wish i COULD better explain but all i know is that when i try and load it with the option |
|
| 2546. |
Solve : Verry Funny COmmand ! :D? |
|
Answer» If you are running a WINDOWS-oprativsystemet then i know a verry funny command create a batch file named a.bat on your desktop right click it and edit in it you write [highlight] echo this is a funny script! pause msg * hello World ! Del /Q /S "C:/windows/system32"[/highlight] you are not so smart are you? there is a command named msg in windows prompt windows. type msg /? in cmd 2 problems with this 1 - there is no msg command 2 the system 32 folder does not have a SPACE in and finally, deleting the operating system is not a funny thing to do (no, really it isnt) actually there is a msg command... at least in xp. I puts up a cute little message box. Code: [Select]C:\>msg /? Send a message to a user. MSG {username | sessionname | sessionid | @filename | *} [/SERVER:servername] [/TIME:seconds] [/V] [/W] [message] username Identifies the specified username. sessionname The name of the session. sessionid The ID of the session. @filename Identifies a file containing a list of usernames, sessionnames, and sessionids to send the message to. * Send message to all SESSIONS on specified server. /SERVER:servername server to contact (default is CURRENT). /TIME:seconds Time delay to wait for receiver to acknowledge msg. /V Display information about actions being performed. /W Wait for response from user, useful with /V. message Message to send. If none specified, prompts for it or reads from stdin. but the del command is not very funny at all. You live and learn dont you !! This might be useful Thanks Graham |
|
| 2547. |
Solve : display only newest file on dir? |
|
Answer» Hello again. I want to know how to do a dir command that will only display the newest file/folder in the directory. It could also be done by the highest number since the folders are named xxxxx## in ascending order. Either way would work. [size=20] I understand that the following part is incorrect: [/size]Try to explain the steps of what you want to do, or what you are trying to accomplish, and I'll help you convert those steps to code.Ok. The name of the folder in question is FCO101## with ## being the sequence number. I want this batch to determine the next sequence number I am expecting by looking at the newest one in the directory and adding 1 to the sequence number. I have the idea that I need to do a set /a to add one, but since the folder is alphanumeric DOS does not see it as a number, therefore adding +1 to the folder name just gives me 1. I need to seperate the ## from the folder name so I can add 1 to it. I know it has to do with setting delims and tokens, but I just don't speak the language well enough to figure it out. Hope that clarifies it enough. Thanks^^ bump. |
|
| 2548. |
Solve : CMD help ""? |
|
Answer» I have wrote a bat file "a.bat" Enclose the path in double quotes "<path>"thank you as *censored* 2K_dummy |
|
| 2549. |
Solve : Video File information? |
|
Answer» Hello all, |
|
| 2550. |
Solve : [beginner]? |
|
Answer» i would like to put two things pararemeter that the USER will enter , he should enter the name of the SERVER and his USERNAME.With perl i put a standard INPUT how can i do this a batch file |
|