Explore topic-wise InterviewSolutions in .

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.

4501.

Solve : Batch File Need Help?

Answer»

I have create this batch file:

@echo off
REM Print the welcome message
echo Hello, Welcome to MS-DOS batch file For question 2aii

REM pause the screen
pause

REM clear the screen
cls

REM notify to list the current folder list
echo Listing all text files in current directory...


REM Listing the content of the current directory
dir *.txt/a/ogn

REM Delete all the text file
del *.txt

REM To check if txt file exit or not

if exist patuh.txt del patuh.txt

pause


Actually I want this progam to:
-Display all file and subdirectories including hidden files in the floopy disk
-Then the program will delete all text files in floppy disk before clear the screen
-After that prog will check whether the any text files exist or not in current directory, if exist all the text files copy to floopy disk, else change the colour of the screen background and foreground to red or yellow

Quit tricky but i m still no idea to continue the prog. Anyone can help plz?homework?
a QUIZ from my FRIEND to beat me. Well i new here
But im still keep to find solution here
Anyone can help me?type DIR /? to find out all you need to know.

type DIR /? to find out all you need to know.

command dir/? is to list all files and subdirectories icluding hidden files?? Is it?he means find out yourself, no homeworking helping...

DIR /?
lists all the switches and parameters for DIR.
this is forum ... so i'm please to get the INFO or clue from all of you here. Dont get me wrong. But im still hope to find the solution from the expert outhere. Can expert help me?Quote from: myusri on March 12, 2009, 06:28:29 AM

this is forum ... so i'm please to get the info or clue from all of you here. Dont get me wrong. But im still hope to find the solution from the expert outhere. Can expert help me?

Expert already did. Read the posts.Have you gone to Command PROMPT and typed 'dir /?' yet?yup i already done dir /?

Quote from: myusri on March 12, 2009, 10:02:56 PM
yup i already done dir /?



And what did you LEARN?
4502.

Solve : Invalid Directory?

Answer»

Working on a Vista machine that won't boot. It just goes to the repair and eventually indicates that it cannot perform a repair. This PC came w/ Vista installed and no disc, and the owner never created any CDs for installation or setup.

But I figured I could get to DOS prompt with a Windows XP disc - which it did - to copy picture files to a flash drive. So I get to a DOS prompt, go to the directory that has the sub-directories w/ pictures. and try to copy them to the flash drive. But it seems that with the way I got the PC booted, wildcards are not allowed (I'm guessing that I'm only allowed to use INTERNAL DOS commands), so I have to copy the files individually, which does work, but is laborious. Is there a way around this? I used the SET command to AllowWildCards = TRUE, but it has no effect on copying files.

Secondly, this guy has a directory called "BEHAVE!!! =>" (at least that's what it looks like its called in DOS) that contains pictures he would like saved. I have no idea how he created this, but I can't seem to get to this directory. I get "the file name, directory name, or volume label syntax is incorrect" when I try to access it w/ the DOS command CD "BEHAVE!!! =>". And since I have no idea how to get around the 'wildcard' problem, I'm unable to access this directory.

Any thoughts on these two problems would be greatly appreciated. try the Move command:
Code: [SELECT]move C:\<whateverlocation> E:\<orwhateverdrivenameforyourjumpdrive>
Hope this Helps
,Nick(macdad-)

i think copy would be best here. but then again I'm probably wrong.just have to wait what he says, and besides Move is an internal command so it should work... trueQuote from: macdad- on March 11, 2009, 11:33:47 AM

try the Move command:
Code: [Select]move C:\<whateverlocation> E:\<orwhateverdrivenameforyourjumpdrive>
Hope this Helps

Thanks Nick, but it doesn't. Move is NOT an internal DOS command. When I use it I get 'The command is not recognized. Type HELP....blah, blah, blah' Quote from: squall_01 on March 11, 2009, 11:48:45 AM
i think copy would be best here. but then again I'm probably wrong.

Gee, I've already used COPY to move stuff to the flash drive. I just was hoping for a way to enable wilcards, so I could type 'copy c:\BEHAVE*\*.* e:'Quote from: macdad- on March 11, 2009, 11:51:02 AM
just have to wait what he says

I don't know what this (partial) sentence means...

Quote from: macdad- on March 11, 2009, 11:51:02 AM
and besides Move is an internal command so it should work...

MOVE is not an internal DOS command.Sounds like it's not the DOS prompt that the OP is in (not possible with an XP disk anyway) but the XP recovery console. This uses a limited set of commands, and, as has been noticed, does not support wildcards.

I don't know where this came from, it's not part of XP command prompt anyway.

Quote
I used the SET command to AllowWildCards = TRUE, but it has no effect on copying files.



Quote from: Dias de VERANO on March 11, 2009, 03:20:20 PM
I don't know where this came from, it's not part of XP command prompt anyway.

When I'm at a command prompt I can type HELP for a list of valid DOS commands. Set is one of them. If I type SET wihout any PARAMETERS, then it shows me various items that have been set. It originally showed SET AllowWildCards = FALSE. and I typed in SET AllowWildCards = TRUE. If I type in SET w/ no parameters it shows that SET AllowWildCards is EQUAL to True. But it makes no difference. I still cannot use * or ?...
Delete.Quote from: boweasel on March 11, 2009, 04:19:08 PM
When I'm at a command prompt I can type HELP for a list of valid DOS commands. Set is one of them. If I type SET wihout any parameters, then it shows me various items that have been set. It originally showed SET AllowWildCards = FALSE. and I typed in SET AllowWildCards = TRUE. If I type in SET w/ no parameters it shows that SET AllowWildCards is equal to True. But it makes no difference. I still cannot use * or ?...


Like I already said, you are not at a regular command prompt. You are in the "Recovery Console". Compared to the normal command prompt, the Recovery Console is very limited. It only uses certain commands, and they don't all accept wildcards when AllowWildCards is set to TRUE. Copy is one such.

http://support.microsoft.com/kb/314058

As you can see, the Recovery Console has very limited capabilities for copying files, mostly intended to manually restore a good copy of a system file to the Windows directory.

Instead, think about booting your PC by something other than XP. A good choice would be a KNOPPIX "live" CD, which is a free download as an ISO image. It is a large download, about 700 Meg for the CD and a few Gig for the DVD. The difference is that the DVD has more applications. The CD will suffice for rescuing data. KNOPPIX is a flavor of LINUX, with very good intrinsic support for much hardware, in fact, better than XP itself. "live" means that it runs from CD without installing on the hard drive. KNOPPIX has a windows-like file manager, supports USB and firewire, and version 5 can write to disks formatted as FAT32 or NTFS, among others.

Quote from: BatchRocks on March 11, 2009, 04:36:11 PM
Code: [Select]move C:\<blah> E:\<whateverdrive>
del C:\<blah>

Ignore this. No MOVE command in Recovery Console.Sorry.Quote from: BatchRocks on March 11, 2009, 04:42:29 PM
Sorry.

Never mind. At least you were trying to help. A better recovery console would be a great idea, but sadly we have to turn to other solutions.
4503.

Solve : start a certain folder?

Answer»

ok what i need now is to start every batch file in a pacific folder then move them to a differnt folder. the starting folder name is start the second one is done. this is for a network drive just so i can exucute commands i DONT need the results(last part i need)Code: [SELECT]CALL <batchfilename>.bat
Call <otherfile>.bat
Ect, but the file you call, must have your code, then a "move .bat

I THINK it should work.

4504.

Solve : Batch file: getting only the last 2 digits of the year?

Answer»

Like in: for /f "tokens=1-4 delims=/ " %%d in ("%date%") do @echo %%f%%e%%d
but I want only the 09 out of 2009I dont think its possible anyone correct me If im wrongTry this code, the output is dependent on the date format returned by %date%. The input date format to this code is 'day mm/dd/yyyy' and the date is ECHOED in the format mmddyy:

Code: [Select]@echo off
cls
setlocal

for /f "tokens=1-4 delims=/ " %%a in ("%date%") do (
set bc=%%b%%c
set d=%%d

)

echo %bc%%d:~2%

you actually dont need all that code:

Code: [Select]@echo off
set digit=%DATE:~12,2%
echo %digit%
pause
but if you have a DIFFERENT date format, then let me KNOW(this one is DDD MM/DD/YYYY, e.g. Thu 03/11/2009)

Hope this Helps
,Nick(macdad-)I think they want DD/MM/YYQuote from: computeruler on March 11, 2009, 01:30:44 PM

I think they want DD/MM/YY

Hey! I've GOT this radical new idea! Let's have a look at the thread title and the original post!

Thread title

Quote
getting only the last 2 digits of the year

Original post

Quote
I want only the 09 out of 2009
Wow! that is radical!Radical or not it seems to me to be a better assumption that, based on the OP's script, the OP wants to return the date in either ddmmyy or mmddyy format.

Quote from: Woodman on March 11, 2009, 04:24:15 PM
Radical or not it seems to me to be a better assumption that, based on the OP's script, the OP wants to return the date in either ddmmyy or mmddyy format.



You may be right, I think I had the sarcsam dial turned to 10 or 11.
It's going to be 09 for about... Another like 280 days.

Echo '09'

Heck, I won't keep a batch file for a date for 1 year. Works for me.He's right. This must be for some other reason !Iunno if it works

Code: [Select]if %date%==*/*/2009 echo 09
IDK if it does.It doesn't work. It gives me the statement after if and says this wasn't expected.
It appears that you are trying to abuse the use of wild cards. They can not always
be used in such a manner.Or even:

if %date:~-4% gtr 2008 if %date:~-4% LSS 2010 echo %date:~-2%

Someone will put us out of our misery shortly...(code deleted)

since some people(s) might get offended if code create a .com executable. please accept my apology for any inconvenience caused.
4505.

Solve : use PCMCIA card in DOS?

Answer»

I have an "elderly" notebook computer that does not have a built-in ethernet port. I'm using a TrendNet cardbus PCMCIA card instead. Works fine in Windows, but I'm trying to get it to load in DOS, with no luck so far. Not even lights on the card.

I am pretty sure that I need to configure my CONFIG.SYS file, but I am not entirely sure what changes I need to make. I have the correct NDIS driver for the card, but I do not know what the right driver is for the PCMCIA port. How do I find out what the right driver is? What is "card and socket services"?

This is all really confusing.

Oh, and my laptop is a Toshiba X305You didn't specify what Notebook this is so Here's a link to a bunch of them...Right, I understand that the drivers are out there. Problem is, even if I did somehow have the right driver (which is likely now, given the volume of drivers I have downloaded just for kicks) I don't know how to load it.Which Windows OS? how are you running DOS?


for a PCMCIA device you need two things- the PCMCIA BUS driver, and a driver for the PCMCIA device. In this case, you also need a driver for the ethernet card; I would also hazard a guess that you don't have any DOS-mode driver for the PCMCIA bus in the laptop either, since the lights don't flash.


What model of laptop do you have?


Driver works in Windows Vista.
I am running DOS from a boot-cd (autoexec, config.sys, etc.)
I do have the driver for the ethernet card.

If I understand correctly, I will need a TOTAL of 2 drivers: one for the PCMCIA bus and one for the PCMCIA device (ethernet cardbus card).

What I need to know is how to install/load the driver for the PCMCIA bus.a device= line.

you do have the DOS driver(s), right?YES.woopsee daisy forgot to say, the line goes in the Config.sys file. Would I load both the PCMCIA bus and card drivers there?
i.e.

device=C:\path\to\bus\driver
device=C:\path\to\card\driveryep. If you have problems I can dig out my old thinkpad and take a look at it's config.sys and see what it does.Jeez o pete,

I have been working on this for the last week, day and night, and I think I'm more confused now than when I started. I have downloaded tens of drivers for both the slot and the card, files called "cs.exe" "csxxx.exe" "csalloc.exe" and so on.

The literature I've pulled from the web has referenced these files particularly, and lots of sites seem to think that those .exe need to be loaded in config.sys

I am totally and absolutely lost. What kills me is that I have an older laptop (Toshiba Satellite 4600) and it's really easy to make things work there. I just go into the BIOS settings and change the network card from "auto-selected" to pci-compatible. Unfortunately, on the newer models (and Phoenix Bios) there is no such switch. This doesn't mean I'm out of luck does it?

Thanks,
-darrylI'm not sure but I don't think PCMCIA cards/drivers will work in a PC-Card slot- one would need PC-Card Bus drivers, and I doubt those are available for MS-DOS.This is my new favorite Thread....Quote from: BC_Programmer on March 10, 2009, 06:27:14 PM

I'm not sure but I don't think PCMCIA cards/drivers will work in a PC-Card slot- one would need PC-Card Bus drivers, and I doubt those are available for MS-DOS.

Alright, now I'm more confused. You gave me tips on how to do this, but now say you don't think it can be done? PCMCIA cards/drivers and PC-Card cards/drivers are one and the same: PCMCIA is the association that defines standards for PC-Cards/slots.

This must be able to work...you started saying you had an elderly laptop which now turns out to be a newer model.

the newer models use PC-card.

PC-Card can use PCMCIA cards. However-

a PC-card bus needs a driver. a PCMCIA driver probably won't work.

and DOS-based PC-card drivers likely don't exist for that particular laptop, if at all.

they aren't the same; although my use of terms wasn't quite accurate.
Major Features
No matter which type of laptop you have, you can be sure that it has a somewhat standard set of components. Later in this book we will discuss these components in more detail.

Processors
There has always been a range of processors available for laptops, but one rule has almost always applied: The fastest laptop is almost never as fast as the fastest desktop. The problem is one of power. Fast desktop processors run on AC power, of which there is a relatively limitless supply available. Portables in most cases at least occasionally must run on batteries, which have to be small enough so that the laptop can be lifted. Portable systems are also smaller than most desktops, and the tighter confines mean that the ability to run a high heat-producing processor is more limited. Therefore, a mobile processor in general has a more limited amount of electrical power available.

Intel has responded to the needs of mobile systems by offering low-power "M" versions of its most popular processors. Figure 2.1 shows the Pentium 4-M chip, the mobile version of the Pentium 4. These processors are generally similar to the desktop versions except they use lower voltages internally and can adjust their clock speeds depending on the user's requirements. By lowering their voltages and clock speeds, these chips can cut their power requirements and thus extend a notebook's battery endurance. Note also that the maximum clock speeds of these chips are almost always slower than those of desktop chips.


Figure 2.1. The Pentium 4 Processor-M chip from Intel. (Photo courtesy of www.intel.com.)





Table 2.3 shows a comparison of the clock speeds of various mobile processors from Intel.

Table 2.3. Clock Speeds (in GHz) Available for Intel's Mobile Processor Chips Intel Mobile Processor
Clock Speeds (GHz)

Pentium M
1.0 to 2.26

Mobile Pentium 4
1.4 to 3.46

Celeron M
0.8 to 1.5

Mobile Celeron
0.65 to 2.8





In March of 2003, Intel introduced its Pentium M chip for laptops, a part of its Centrino platform. The Celeron M followed as a low-cost version of the Pentium M. Unlike previous mobile processors from Intel, these chips are not a variation on a desktop chip, but a Pentium-compatible processor built from the ground up for mobile applications. Intel claims that laptop designers can achieve 1040% longer battery endurance if they use this chip.

In addition to the chips' energy conservation, Intel also claims that the Pentium M and Celeron M are faster than they may appear. Because they use a different internal architecture, they are able to squeeze out more effective work during each clock CYCLE. As a result, you cannot directly compare the clock speeds of Pentium M/Celeron M and other mobile Pentium chips. For example, Intel claims that a typical laptop running a 1.6GHz Pentium M chip will race through benchmark programs 15% faster than a Pentium 4-M running at 2.4GHz. Intel also claims that this same laptop's batteries last 78% longer on the Pentium M than on the Pentium 4-M.

Another processor specifically designed for portable applications is the Efficeon chip from Transmeta. This chip promises very low power consumption but at the expense of processing speed. The Efficeon has a different instruction set than Intel Pentium processors, requiring it to perform extra steps to translate the Pentium instructions into a form that the Efficeon can understand. Thus, although the Efficeon may have clock speeds comparable to Pentium M chips, its performance is considerably slower. Unfortunately, Transmeta has yet to capture much of the market and is concentrating more on licensing its power-saving technology rather than selling processors.

Some laptop manufacturers occasionally opt for the highest performance possible by using desktop processors. As can be expected, these power-hungry chips result in surprisingly short battery endurance. Note, however, that this quest for desktop performance is never completely successful. Overall system performance depends not merely on the processor but on several other components, and as a result these devices have yet to equal the performance of the fastest desktops.

You can find more information on mobile processors in Chapter 4.

Video Display Size and Resolution
Ever since the days of the luggables in the early 1980s, the design of portable computers has been highly dependent on the latest lightweight displays. When low-power LCDs became available, the development of the battery-powered laptop finally became possible. Today, the size of the display is the single most important determinant of the size of the laptop.

Currently, virtually all laptops use active-matrix color displays. These screens provide needle-sharp images of high contrast, in most cases better than the CRT displays that most desktops use. Indeed, many desktop users are now upgrading to flat panels. The prime impetus for this switch may be to save space, but the improved image quality is at least a partial factor.

There are, however, a few drawbacks to LCD displays. The first is that they have a fixed or native resolution. CRT displays can easily switch to higher or lower resolutions. When LCDs are moved above or below their native resolution, however, the image becomes decidedly blurry or even distorted.

The second drawback of LCDs is their limited field of view. These displays may present high-quality images, but only to viewers sitting directly in front of the screen. People who may be sitting a few feet to the right or left of that optimal position may see an image where the colors have been shifted and the contrast lowered. With the increasing popularity of LCD televisions, some LCD manufacturers are developing screens that are more suitable for wide-angle viewing. If you plan to use your laptop for informal presentations, you should take a look at laptops that advertise wide-angle capability. Of course, some people prefer a more limited viewing angle because it makes it harder for other people to read your screen when you are working in public.

One other downside of LCD screens is that they are considerably more expensive than CRTs. The good news here, however, is that the prices of LCDs have continually dropped over the years and will continue to do so. Indeed, the popularity of desktop LCD displays should lead to increased volumes and lower prices for both desktops and laptops.

Because the technologies used in today's LCDs are basically similar, the main differences among screens have to do with their sizes, their resolutions, and their aspect ratios. Chapter 11, "Graphics and Sound," includes more detailed information on displays.

Screen Size
Size is, of course, the most visually apparent property of an LCD screen. In general, as time progressed, screens became continually larger. There is, however, a size limit for laptops. As LCD screen sizes moved beyond 17 inches, measured diagonally, they became too large to be portable and were relegated to desktop use.

In today's laptops, screen sizes vary from 7.2 inches (measured diagonally) for the smallest systems to 17 inches for the largest. The most common size is now 14.1 inches, which represents a good compromise between size and portability.

In general, users are well advised to get the largest screen they can comfortably carry and afford. But note that for some screen sizes, there may be a choice of several different resolutions available. Choosing the wrong resolution may make the screen harder to read, or limit the amount of information that can be displayed.

Screen Resolution
The resolution of a screen depends somewhat on its size. As the size of the screen increases, it can comfortably accommodate more pixels, thus allowing for increased resolution.

For 14.1-inch screensthe most common varietymost laptop manufacturers offer two choices of resolution: XGA and SXGA+. A few vendors also offer SXGA, but the unique aspect ratio (5:4) makes that size and resolution somewhat rare. The increased resolution of SXGA+ over standard XGA enables users to display nearly 87% more onscreen information such as folders, documents, web pages, and so on, at the same time. Increased resolution also increases pixel density (the number of pixels per inch of screen size), which in turn increases the apparent sharpness of photographs and graphic images. Some people even maintain that increased pixel density increases the readability of text. On the downside, however, increased resolution also decreases the size of standard text and icons on the screen. As personal preference varies, users should personally examine several different size/resolution combinations to see which seems best to them.

Note that once you have chosen a resolution, it cannot be changed. A laptop's video circuitry can simulate a change in resolution, but the resulting image will be much less sharp than the image at the screen's original or native resolution.

Table 2.4 lists common LCD screen sizes and the resolution they support.

Table 2.4. Screen Size and Resolution: A Sampling of the Most Common Combinations Available for Laptops Screen Size (in.)
Resolution Type
Resolution
Aspect Ratio
Pixel Density (Pixels/in.)

12.1
SVGA
800x600
4:3
83

12.1
XGA
1024x768
4:3
106

13.3
XGA
1024x768
4:3
96

14.1
XGA
1024x768
4:3
91

14.1
SXGA
1280x1024
5:4
116

14.1
SXGA+
1400x1050
4:3
124

15.0
XGA
1024x768
4:3
85

15.0
WXGA
1280x800
8:5
101

15.0
SXGA+
1400x1050
4:3
117

15.0
UXGA
1600x1200
4:3
133

15.4
WXGA
1280x800
8:5
98

15.4
SXGA
1280x1024
4:3
106

15.4
WSXGA+
1680x1050
8:5
129

15.4
WUXGA
1920x1200
8:5
147

17.0
WXGA+
1440x900
8:5
100

17.0
UXGA
1600x1200
4:3
118

17.0
WUXGA
1920x1200
8:5
133





Screen Aspect Ratio
The aspect ratio for most laptop displays is the same as that for desktops and televisions: 4:3 (that is, the height of the screen is 3/4 the width). In the distant past, some laptops, such as the IBM PC Convertible and the Toshiba T1000, used wider display screens because that was all that was available. When 4:3 LCD screens came out, the public quickly gravitated toward this standard shape.

Now, however, with the popularity of DVDs and high-definition TV, many manufacturers are installing widescreen displays on their systems (see Figure 2.2). These displays have a wider aspect ratio of 8:5 (16:10). Note that although this is much wider than the standard computer display, it is not quite as wide as the 16:9 proportions of HDTV, but is able to accommodate a full 16:9 HDTV picture within a 16:10 display with only a small upper and/or lower border (often used by the DVD player controls). Widescreen laptops are usually sold as multimedia or desktop replacement systems, due to their larger (and clumsier to carry) sizes. As more people use their laptops in home entertainment systems or as personal DVD players, expect this number to grow.


Figure 2.2. The Dell Inspiron XPS Gen 2, with its 17-inch WUXGA display. (Photo courtesy of Dell Inc.)

[View full size image]





One interesting thing to note is that having a widescreen display doesn't necessarily mean you get more resolution or desktop screen real estate. For example, many so-called "widescreen" laptops have 15.4-inch WXGA (1280x800) displays. Personally, I would rather have a standard aspect ratio 15.1-inch SXGA+ (1400x1050) display because even though it doesn't have the "widescreen" aspect ratio, it actually offers an overall wider and deeper image in pixels than the so-called widescreen display. At the higher 1400x1050 pixel resolution, you'll actually be able to fit more open windows (web pages, applications, and so on) both in width and depth than you could on a WXGA screen. In fact, the SXGA+ screen has nearly 44% more overall resolution, MEANING you can fit that much more content on the screen. The primary advantage of using a widescreen on a laptop is that human vision sees more peripherally than vertically, making wider screens better suited to what you actually see on them.

Video Accelerators
A crucial and sometimes overlooked aspect of computer performance is the speed of its video accelerator. This chip, shown in Figure 2.3, speeds up the process of moving pixels around the screen. Computer game players have been especially sensitive to the speed of their video processors because this can greatly influence the quality of their entertainment. But business users should also be aware that a video accelerator can impact tasks such as sales presentations.


Figure 2.3. Video accelerator chips from NVIDIA. (Photo courtesy of www.nvidia.com.)





Currently, the best laptop video accelerators are from ATI and NVIDIA. Note that as in the case of processors, laptop video accelerators are usually not quite as fast as those in desktop models. Typical video accelerators are listed in Table 2.5.

Table 2.5. Typical Video Components and the Best Optical Drives Available for Different Laptop Types Laptop Type
Screen Size (in.)
Video Accelerator
Video Memory (MB)
Optical Drive

Desktop replacement
15.4/17
ATI Radeon X300/X600 NVIDIA GeForce Go 6800
128/256
DVD/CD-RW or DVD+/-RW

Mainstream
14.1/15
Intel Media Accelerator 900 ATI Radeon 9000 ATI Radeon X300/X600
64/128
DVD/CD-RW or DVD+/-RW

Value
14.1/15
Intel Media Accelerator 900
64/128
DVD/CD-RW

Thin & light
14.1
Intel Media Accelerator 900 ATI Radeon X300/X600
64/128
DVD/CD-RW

Ultralight
12.1
Intel Media Accelerator 900
64/128
None





In addition to the type of video accelerator used, laptop users should also pay attention to the amount of video memory installed. The amount of video memory used for laptop graphics chipsets currently varies from 64MB to 256MB. In most cases the video memory is dedicated memory (separate from main RAM) used to hold information that will eventually be displayed on the screen. However, systems with video accelerators built into the motherboard chipset (such as the Intel Media Accelerator 900) use shared memory, which means that the video accelerator borrows main system RAM for video use. Since there is no dedicated video RAM, this results in a less expensive design (which also uses less power), but sacrifices performance when compared to dedicated video memory designs. The more video memory available, the more colors the laptop can display and the faster the video accelerator can operate. Large amounts of video memory are also useful for 3D graphics such as in games.

Purchasers should be CAREFUL to note the type of video chipset and amount of video memory in a potential new notebook. Although there are a few select models with upgradeable graphics, in most cases the video accelerator components cannot be changed.

You'll find more detail about mobile video chipsets in Chapter 11.

Spindles (Storage)
The classic three-spindle laptop is disappearing. These systems generally had three forms of rotating memory: a hard drive, an optical drive, and a floppy drive. Now, because floppy disks are so rarely used, many laptop manufacturers have been leaving them off in order to save weight and lower costs. In some two-spindle systems, the floppy can be swapped into the storage bay normally occupied by the optical drive, but you can't run both simultaneously. In most cases, the floppy is relegated to being used as an external device that connects to the system via a USB cable. Since floppy drives aren't used much anymore, this doesn't seem to bother many people, which is one reason the three-spindle designs are fading. As average file sizes continue to grow well past the capacity of a floppy, this once familiar component may well disappear altogether. Currently, most vendors offer external USB floppy drives for laptops as a $50 option.

The most important drive in a laptop is its hard drive. Currently, drive sizes range from 20 to 160GB. Many experts suggest that users get as much hard drive storage space as they can afford. When users eventually purchase a digital camera or start storing audio and video on their hard drives, they will soon take advantage of all the storage space they have available. External USB drives can also be used to extend the storage of a laptop, and are actually quite excellent for backup, but when mobile, you generally have to rely on the drive that is installed internally in the system.

Some laptops have drives that rotate at higher speeds than other drives. The use of faster rotating drives will positively impact system performance by a significant amount. A faster-spinning drive enables the system to access information from the hard drive more quickly. Faster drives also have a major impact on startup (boot) times, as well as the time it takes to hibernate and resume from hibernation.

For some time there has been a variety of optical drives available for laptops. Most systems today include either a DVD-ROM drive, a combo DVD/CD-RW burner, or a DVD+/-RW drive, many of which can also handle DVD-RAM as well. In most cases these drives are not nearly as fast as their desktop counterparts, especially where DVD burning is concerned. In most cases if you plan on doing any significant DVD burning, I recommend attaching an external USB desktop DVD burner.

Chapters 9, "Hard Disk Storage," and 10, "Removable Storage," discuss storage options in more detail.

Expansion Options
Laptop components are so tightly crammed together that few expansion options are available. Often the only way to expand the capabilities of a laptop is to insert a PCMCIA (Personal Computer Memory Card International Association) card (see Figure 2.4). These cards, also known as PC Cards or CardBus Cards, were originally designed as memory cards but are now capable of providing a wealth of features. Almost any feature not provided on a laptop or not provided in sufficient quantity can be added via a PCMCIA card.


Figure 2.4. A diagram of the PCMCIA PC Card.


Note that there are two types of PCMCIA cards and three sizes. In addition to the older 16-bit PC Card, there is also a high-speed 32-bit CardBus Card that is required for high-speed wireless networking cards. The three sizes are Type I, Type II, and Type III, which mainly vary in thickness.

"Cardbus" is likely the bus used by the expansion slots on any motherboard newer then about 2000; Although its possible the Cardbus interface itself will run via a 16-bit DOS PCMCIA driver, I highly doubt that and am fairly sure that even in that unlikely case that the use of the bus will be limited to 16-bit cards, of which network cards are not- netowrk cards are built to the 32-bit Cardbus standard.

The fact that drivers for MS-DOS are not available for newer technology is not particularly surprising.

4506.

Solve : Extract?

Answer»

Hello

Can I Extract ZIP Files by DOS? If yes how?

Thank yougoogle for pkzip/pkunzip/pkware/. i think the PACKAGE was "pk250dos.exe" since v2.50 was the last version (shareware). there is also a freeware version called "info-zip".DOS? You mean extract files in Command Prompt?Quote from: Carbon Dudeoxide on March 10, 2009, 09:24:49 AM

DOS? You mean extract files in Command Prompt?
I think feras is trying to ask for a command that will zip/unzip files in DOS...probably to do it automatically in batch.7-Zip can do this.

http://www.codejacked.com/zip-up-files-from-the-command-line/Get Unzip.exe from http://stahlforce.com/dev/index.php?tool=zipunzip

Use the following command style:
Code: [SELECT]C:\unzip.exe -o -j C:\FILES\Downloaded*.zip -d C:\FILES\Hello

sorry M.r Carbon Dudeoxide the server here can't open the link you put

Thank you M.r Belgretor, but what if I don't want to install Unzip.exe

I mean that I want to use it in batch file and I don't know if the users have Unzip.exe

Thank you all tikbalang is right
Quote from: tikbalang on March 10, 2009, 08:59:54 AM
google for pkzip/pkunzip/pkware/. i think the package was "pk250dos.exe" since v2.50 was the last version (shareware). there is also a freeware version called "info-zip".
The Unzip.exe is a small file, and you don't have to install it, just keep it in the hard-drive somewhere.

There is no built-in SUPPORT in the command-line for extracting, as far as I know.

If you're distributing the batch file, you can include the unzip.exe file too. This is how I do it.Why extract from DOS?

http://articles.techrepublic.com.com/5100-10878_11-6134552.html

( All the following came from the above link. )
<<<"
Take advantage of Windows XP's compressed folders extraction wizard

Windows XP's compressed (zipped) folders work so much like folders that it is easy to forget that they are actually based on ZIP files. You may even remove files from a compressed folder by opening the folder and then copying and pasting the files to another folder. You may find it easier to use the compressed folders extraction wizard. Here's how:
Right-CLICK the compressed folder and select Extract All.
When you see the Welcome page of the extraction wizard, click Next.
Click the Browse button to choose a destination.
If necessary, create a new destination with the Make New Folder button. Click OK.
Click Next. This will extract the files in the compressed folder.
Select the Show Extracted Files check BOX and click the Finish button. the one billrich talking about is based on the dll that comes with windowsxp, zipfldr.dll

example usage in command prompt:
rundll32 zipfldr, RouteTheCall "test.zip"
but this only open the zip contents for viewing in windows explorer, and i couldn't find the entry point to automate the extraction of .zip files.
4507.

Solve : run css server in background?

Answer»

before you jump to a conclusion IM NOT MAKEING A VIRUS i have already been BANED from a site because some people don't think!!!

what I'm trying to do is run a simple COUNTER strike source server in the background of my home computer because everyone is always getting on and off that computer they sometimes close it WITHOUT THINKING and that makes me very angry . i have thought about create a VM but i don't know how to do that and seems like it might be more work to enter a command into the server. So if anyone knows a cmd command that i can use to run it in the background PLZ HELP

(at this point i think it may be just easier to run it on a VM )I don't think you can, but there might be a CSS dedicated server that runs as a service? (I dunno)

Another possibility is to use Fast user switching- create a NEW ACCOUNT for the CSS server, and then switch to another account.

The server will still be running- but on another users desktop, so you won't be able to see it. (and close it)OK thanks well i just did the thing with creating a new user on my computer. I can always just use rcon command and if I'm on a computer that doesn't have steam remote desktop all i have to do is find a way that the server start on that account ONLY when the computer is turned on so i wont have to loginto the user and start the server. (just in case)

4508.

Solve : Batch to run a python file?

Answer»

Hi,

I need some help constructing some code for a batchfile. The .bat should run a file called "worker.py" USING the python command "python" infront of it. Anyone know how to do this?

( it's a pain in the *censored* writing "cd c:\rendertester\" to navigate and then write "python worker.py 192.173.5.6:8080" all the time in the cmd )

so your TRYING to open a file with a batch right?

@ ECHO off
echo This will open a file
start (put the file location like C:/dir/dir/dir)
Quote from: KaizerKaizer on March 10, 2009, 05:30:46 PM

it's a pain in the *censored* writing "cd c:\rendertester\" to navigate and then write "python worker.py 192.173.5.6:8080" all the time in the cmd

Code: [Select]@echo off
cd c:\rendertester
python worker.py 192.173.5.6:8080
Nope already tried that. that only starts python.exe and not the file. If I do it manually there is no problem.
Quote from: KaizerKaizer on March 11, 2009, 02:10:47 AM
Nope already tried that. that only starts python.exe and not the file. If I do it manually there is no problem.


Try with full paths for both Python executable and script, using quotes if there are any spaces.

google.py is an example script included in the Python 2.6.1 download from python.org. It takes a search term as a PARAMETER and runs it on Google in the system default browser.

This works for me in a batch file (in the folder where google.py lives)...

Code: [Select]"c:\Program Files\Python\python.exe" google.py Britney Spears
...and this works anywhere on my system...

Code: [Select]"c:\Program Files\Python\python.exe" "C:\Program Files\Python\Tools\Scripts\google.py" Britney Spears
Your paths may be different...
well, that worked better...but still not as it should.

It works as long as I don't add the "http://192.ip-address" in the end.

I use python 2.5 with twisted
how is worker.py importing the command line argument?
4509.

Solve : Batch to create a backup.?

Answer»

I want to create a batch file to copy my email profile every time I boot up my PC.
I know the code to do the copying process.

I would like to keep the last 5 backups. So BackUp1, Backup2, BackUp3 and so on. These could be different folders.

If possible I would also like to just do one copy per day. In other words if the PC was rebooted many times in one day, I just want one copy for that day.

Any help you can provide me with would be great.
Cheers,
Code: [Select]@echo off

for /f "skip=1 tokens=2-4 delims=(./-)" %%a in ('echo.^|date') do (
for /f "tokens=1-3 delims=./- " %%A in ("%date:~-10%") do (
set %%a=%%A& set %%b=%%B& set %%c=%%C
))
echo Today Stamp is '%yy%%mm%%dd%'

md %yy%%mm%%dd%.bak && (
echo copy your files here to folder %yy%%mm%%dd%.bak
for /f "skip=5" %%a in ('dir/b/ad/o-n 20*.bak') do rd/s/q %%a
)
Thanks for the reply.
I have tried the code and it works do far. Thanks again.

Do i have to put my code where your line that contains the
'echo copy your files here to folder %dd%%mm%%yy%.bak' code is
Hence does the last line of code have to be
'for /f "skip=5" %%a in ('dir/b/ad/o-n 20*.bak') do rd/s/q %%a'

Or if you could step me through your code so I know what it doing I could work it out from there.

Cheers very much.

After further experimentation I think a better option would be to have five folders named 'Bak1' 'Bak2', 'Bak3', and so on.
The reason this is is that my email folder is quite big and with the existing code the whole folder will have to written every time the code is run.
Sicking with common folder names would mean the xcopy command would only have to up date files that are new or have been altered.

How could I ADJUST the code to take into account of this.
I would need the code to check or keep account of the last used directory/folder I guess.

Any help would be much appreciated.
Cheers,


Bak1-bak5 will result in longer code, i guess, as i havent tried it.
but as you only need to update existing files, faster execution is more important. i'll see what i can write after i go home, or if anyone else have some idea, dont hesitate to post it.
twosides, if you have partial code, please post it.

about the previous code, i am not good at explaining:
line 3-6 is to get datestamp as close as possible with the many dfferent of REGIONAL settings (ANOTHER way is
to use debug, windows scripting or regedit)
line 7 is screen output so i knew correct datestamp is obtained (this line can be commented)
line 9 create folder yyyymmdd.bak, if no error, execute line 10,11,12
line 10 you are supposed to replace the echo statement with the xcopy/copy statement
line 11 keep the last 5 folder, using dir as a sorter
for more information type for/?, dir/?, md/?, rd/? for help

Code: [Select][1]@echo off
[2]
[3]for /f "skip=1 tokens=2-4 delims=(./-)" %%a in ('echo.^|date') do (
[4] for /f "tokens=1-3 delims=./- " %%A in ("%date:~-10%") do (
[5] set %%a=%%A& set %%b=%%B& set %%c=%%C
[6]))
[7]echo Today Stamp is '%yy%%mm%%dd%'
[8]
[9]md %yy%%mm%%dd%.bak && (
[10] echo copy your files here to folder %yy%%mm%%dd%.bak
[11] for /f "skip=5" %%a in ('dir/b/ad/o-n 20*.bak') do rd/s/q %%a
[12])
haha, finally, after some mock-up on a few alternative, i think this is the best i can comeup with atm.
it use no temporary file and not involving with the cumbersome date math.

Code: [Select]@echo off & setlocal enabledelayedexpansion

for /l %%a in (5,-1,1) do set/a bak%%a=%%a%%5+1 & md bak%%a 2>nul

for /f %%a in ('dir/b/ad/tw/o-d bak?') do (
set d=%%~ta
if "!d:~0,-6!" NEQ "%date%" (
echo copy your files to folder bak!%%~na!
)
goto:eof
)

i havent test the code intensively, so let me know if it works or not.Many thanks for your help.
Your code creates the directories but does not echo the message.
I have added a line of code to do the copying.

It still does not do any copying.
Any ideas as this is nearly there, I just cant see how to do it.
Cheers.

Code: [Select]@echo off & setlocal enabledelayedexpansion

for /l %%a in (5,-1,1) do set/a bak%%a=%%a%%5+1 & md bak%%a 2>nul

for /f %%a in ('dir/b/ad/tw/o-d bak?') do (
set d=%%~ta
if "!d:~0,-6!" neq "%date%" (
echo copy your files to folder bak!%%~na!

)
goto:eof
)

xcopy /s /c /d /e /h /i /r /k /y c:\Gail c:\bak!%%~na!Code: [Select][1]@echo off & setlocal enabledelayedexpansion
[2]
[3]for /l %%a in (1,1,5) do set/a bak%%a=%%a%%5+1 & md bak%%a 2>nul
[4]::set bak&dir/ad/tw/o-d bak?
[5]for /f %%a in ('dir/b/ad/tw/o-d bak?') do (
[6] set d=%%~ta
[7] if "!d:~0,-6!" neq "%date%" (
[8] xcopy /s /c /d /e /h /i /r /k /y c:\Gail c:\bak!%%~na!
[9] )
[10] goto:eof
[11])

line 3: create variable array of bak1-bak5, teaching the computer to learn round-robin counting
4,5,1,2,3,4,5,1,... then create directory of bak1-bak5 supressing the error message if the folder exist
line 5: use dir as a sorter to list directory bak? with the newest (written date) on top
line 6: get the date last written of the directory, its necessary since it cannot be shorten to !%%~ta:~0,-6!
line 7: compare the date of directory against current date, if not the same do xcopy at line 8
line 10: terminate because we only need to process the first directory, note, anyline after this line is skipped.
**uncomment line 4 to undestand how things works within the batch code.

yeah, that's the drawback, the first time the bat run, it wont do the xcopy, because the date directory created is the same date as today, it will only do the xcopy tomorrow. so it need another variable to check if the directory is just created, its up to you to modify the code.

sidenote: the first time run, the directory chosen is random, and not always starting from bak1.So this is my code so far.
Using a little routine to rotate the directory names.
The only problem is that it always has to copy the files to BackUp_1 from the start.
I was hoping somehow to benefit from the files just been refreshed rather than a full copy but as the BackUp_1 directory is always new and hence empty then a full copy is always been writen to directory BackUp_1

I could do with trying to get the code to sequence or rotate the 'xcopy' command through the directories once they are made. This would just refresh after the initial 5 full copy processes and hence speed things up then.

I am struggling to see how I would do this though.

Any advice etc

Cheers,

Code: [Select]@echo off

if exist c:\BackUp_5 rd /s /q c:\BackUp_5
if exist c:\BackUp_4 ren c:\BackUp_4 BackUp_5
if exist c:\BackUp_3 ren c:\BackUp_3 BackUp_4
if exist c:\BackUp_2 ren c:\BackUp_2 BackUp_3
if exist c:\BackUp_1 ren c:\BackUp_1 BackUp_2

::Make dir
IF NOT EXIST C:\BackUp_1 MD C:\BackUp_1
IF exist c:\BackUp_1 xcopy /s /c /d /e /h /i /r /k /y c:\Gail c:\BackUp_1

exitnice one, i like your batch. here is my suggestion so you only refresh the existing folder.
use a temp folder when renaming as shown below:

if exist c:\BackUp_5 ren c:\BackUp_5 BackUp_6
if exist c:\BackUp_4 ren c:\BackUp_4 BackUp_5
if exist c:\BackUp_3 ren c:\BackUp_3 BackUp_4
if exist c:\BackUp_2 ren c:\BackUp_2 BackUp_3
if exist c:\BackUp_1 ren c:\BackUp_1 BackUp_2
if exist c:\BackUp_6 ren c:\BackUp_6 BackUp_1

Quote

If possible I would also like to just do one copy per day.
how about this?
4510.

Solve : How to make a Batch file to create a directory & copy files to it as an archive?

Answer»

How would you go about making a batch file ( I understand that I could open notepad and just type the commands in, the only problem is I do not understand all of the commands or know of them) What I want to do is create a batch file in notepad and save the file as a .BAT. What I want to do next or before I save the file as a .bat is tell it to create a directory ( any REALLY ) and have it copy files to it as an archive.

Could anyone help instruct me on the best way to create this. I am trying to get more familiar with .bat files or batch files. Thank you for your time.Also for what it's worth I use windows vista, it could be basic commands that could be used between both Vista and XP. I assume they are the same. I also have 32 bit vista and 64 bit if that makes a difference as well.What do you mean by this?

Quote

copy files to it as an archive.
I am ASSUMING it is in reference to making a backup or archive, I assume copy all of the files that are in the directory once the directory is created. I am assuming i would use the archive command after I created the directory correct? I am new at this and I am doing this for a class so I am asking for guidance and all that was included in the instructions was "Create a Batch file to create a directory and copy files to it as an archive. The file name should be Archiveit." It doesn't help that we girls are not computer as computer advanced as you guys, lolwould this work for making the directory?

md c:\directory1

And also do I have to write the echo off or on command prior to the md c: *******

And how would I copy files to it, would I just extract old files from another directory into it, and use the file attribute such as archive? Sorry this is a little confusingmaybe this will hep you understand it easier.

Instruct your employees to create a Batch file to create a directory and copy files to it as an archive. So, when they are about to repair something, they can back up the appropriate directory by typing “Archiveit” after they have edited the batch file to include the source file and the destination. Usually assignments in class are to test what you have been TAUGHT by the teacher. Hasn't he or she covered this?
Test the commands at the command prompt.

When the commands work, copy the the commands to notepad and save as a archiveit.bat


C:\>md archive

C:\>copy *.* archive\


C:\>rmdir archive

C:\>rmdir /?
Removes (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S

C:\>

C:\>md /?
Creates a directory.

MKDIR [drive:]path
MD [drive:]path

If Command Extensions are enabled MKDIR CHANGES as follows:

MKDIR creates any intermediate directories in the path, if needed.
For example, assume \a does not exist then:

mkdir \a\b\c\d

is the same as:

mkdir \a
chdir \a
mkdir b
chdir b
mkdir c
chdir c
mkdir d

which is what you would have to type if extensions were disabled.

C:\>copy /?
Copies one or more files to another location.

COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
[+ source [/A | /B] [+ ...]] [destination [/A | /B]]

source Specifies the file or files to be copied.
/A Indicates an ASCII text file.
/B Indicates a binary file.
/D Allow the destination file to be created decrypted
destination Specifies the directory and/or filename for the new file(s).
/V Verifies that new files are written correctly.
/N Uses short filename, if available, when copying a file with a
non-8dot3 name.
/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.
/Z Copies networked files in restartable mode.

The switch /Y may be preset in the COPYCMD environment variable.
This may be overridden with /-Y on the command line. Default is
to prompt on overwrites unless COPY command is being executed from
within a batch script.

To append files, specify a single file for destination, but multiple files
for source (using wildcards or file1+file2+file3 format).

C:\>copy *.* archive\

4511.

Solve : Concept of application port in networking?

Answer»

Hi all,

I know i know the basic concept of PORT. May anybody tell me how can it be viewed programatically.simple TCP/IP socket workflow programatically, here is how i am going to do it, putting into simple words:

Client:
1. create a socket and connect to server ip address at predefined port: eg. 192.168.1.1:8888 (LAN IP)
2. connection approved, ok, start HANDSHAKE process, client send "my NAME is client"
3. define your own protocol for sending/receiving packet

Server:
1. create a socket listening at certain port, eg. 8888
2. on event listener, hey, there is a client connection request, ok, so create a new socket for the connection.
3. Handshake protocol between client and server, server send "my name is server, who are you?"
4. define your own protocol for sending/receiving packet

on multiple client tcp/ip, server have to keep a list of connected client(s), and you should define you own protocol for broadcasting packet, and redirecting packet to certain client, so the diagram would look like this:

ClientC
^
|
|
Y
ClientB<--------> SERVER <---------> ClientA

ps: this is homework right?
**pssttt, just between you and me, the only subject i've ever failed is networking.This is way offtopic for this section of the forum. It belongs in "Networking".

Apratim Gupta, please STUDY the sections AVAILABLE before posting.

4512.

Solve : Please help on this For loops?

Answer»

I am having a Text file (Certs.txt) which has paths of files like the one below
Certs.txt
C:\j2sdk1.4.2_13\jre\javaws\cacerts
C:\j2sdk1.4.2_13\jre\lib\security\cacerts
C:\oracle\ora92\jdk\jre\lib\security\cacerts
C:\Program Files\Java\j2re1.4.2\javaws\cacerts

My current code reads the path and copies all contents to folder CER_PEM.I then rename it into format (example.. cacerts3)required by using DELIM=. option.
The problem i face is since all files are of same name only the last file is PRESENT and renamed in CER_PEM folder. Rest all files are overwritten.But same works good for files that are NAMED different. I know the FOR LOOP needs to re-written,but cant get a breakthrough on it. Please help

Code Below

mkdir CER_PEM
FOR /F "delims=" %%a in (certs.txt) do (copy "%%a" c:\CER_PEM || CALL:sample)

:sample
set counter=0
FOR /F "tokens=1-2 delims=." %%a in ('dir CER_PEM /b') do CALL:FLY %%a %%b
:FLY
set /A counter=%counter%+1
REM echo %~1%counter%.%~2
rename c:\CER_PEM\%~1.%~2 %~1%counter%.%~2Code: [Select]md c:\cer_pem 2&GT;nul
C:\batch>for /f "skip=2 tokens=1* delims=[]" %%a in ('find /v /n "" certs.txt') do copy "%%b" "c:\cer_pem\%%~nxb.%%a"

Quote

copy "%%a" c:\CER_PEM || CALL:sample
this line is if copy is unsuccessfull then call sample subroutine, you sure?

and you have to end every subroutine in the batch with this line "GOTO:eof", including your main sub. otherwise the code will just keep go on until end of line.
4513.

Solve : FTP and displaying a file?

Answer»

Hey guys! I need a script that can write to (and read from) a file on a ftp host. The ftp command in Command doesn't help at all. I tried doing "help ftp", doesn't work..."ftp /?" just says unknown host...

Can anyone help?

Also, I've been having trouble with this little code I found a while back.
Code: [Select]@echo off
setlocal
:loop
echo -----
set fname=testfilelines.txt

for /f "tokens=* delims=" %%x in (%fname%) do (
call set /a dx=%%dx%%+1
)

set /a last=%dx%-22
if %last% LSS 0 (
for /f "tokens=* delims=" %%x in (%fname%) do (
call set /a idx=%%idx%%+1
call set array.%%idx%%=%%x
)
) else (
for /f "skip=%last% tokens=* delims=" %%x in (%fname%) do (
call set /a idx=%%idx%%+1
call set array.%%idx%%=%%x
))

for /l %%x in (1,1,%idx%) do call echo %%array.%%x%%
echo -----
ping localhost -n 2 -w 1000 > nul
cls
goto loop
I'm trying to get it to only display 22 lines (which works fine) and also auto-update every second. The latter doesn't work...For some reason, if a file contains less than 22 lines, then it will just repeat the lines untill there are 22 in display...and if there are 22 or more, it doesn't auto update...

The type command is not what I'm looking for, as it is the MAIN reason why I wanted this code. Type will display ALL the contents, I found that when it loops, it gets jumpy on refreshing.


If you can help with one or more problems, that would be great!Quote

The ftp command in Command doesn't help at all. I tried doing "help ftp", doesn't work..."ftp /?" just says unknown host...

FTP is an environment. From command line type FTP, when the FTP> prompt appears, type help. Read is the get command, write is the put command.

Quote
I'm trying to get it to only display 22 lines (which works fine) and also auto-update every second. The latter doesn't work...For some reason, if a file contains less than 22 lines, then it will just repeat the lines untill there are 22 in display...and if there are 22 or more, it doesn't auto update...

Explain auto-update. How is the testfilelines.txt file getting updated? From what I can see, the code counts the records in the file and displays the last 22. If less than 23 records exist, all the records are displayed.

The file updates often (possibly less than a second per update), so I need to show the changes.

But how do I actually USE the FTP command to read and write to files?This simplified version of the code may help:

Code: [Select]@echo off
setlocal
:loop
echo -----
set dx=0
set fname=testfilelines.txt

for /f "tokens=* delims=" %%x in (%fname%) do (
call set /a dx=%%dx%%+1
)

set /a last=%dx%-22
if %last% LSS 0 (
for /f "tokens=* delims=" %%x in (%fname%) do echo %%x
) else (
for /f "skip=%last% tokens=* delims=" %%x in (%fname%) do echo %%x
)

echo -----
ping localhost -n 2 -w 1000 > nul
cls
goto loop

Concerning the other question, click in the left hand panel for the correct syntax of the FTP commands.Quote from: Sidewinder on February 04, 2009, 06:28:36 PM
This simplified version of the code may help:

Code: [Select]@echo off
setlocal
:loop
echo -----
set dx=0
set fname=testfilelines.txt

for /f "tokens=* delims=" %%x in (%fname%) do (
call set /a dx=%%dx%%+1
)

set /a last=%dx%-22
if %last% LSS 0 (
for /f "tokens=* delims=" %%x in (%fname%) do echo %%x
) else (
for /f "skip=%last% tokens=* delims=" %%x in (%fname%) do echo %%x
)

echo -----
ping localhost -n 2 -w 1000 > nul
cls
goto loop

Concerning the other question, click in the left hand panel for the correct syntax of the FTP commands.
Let's assume the following:
my username is: fakename
And my password is: notreal
And my ftp server is: ftp.fakesite.com

It doesn't say anything about AUTOMATICALLY LOGGING in to a FTP server and writing/reading a file.I always thought that forums are a vehicle for sharing information. I thought after you learned FTP, you would come back here and SHARE with us.

That FTP link was to give you all the tools you would need to write your own script. A little research on the FTP command line and you should have been good to go.

Code: [Select]ftp -s:myScript.txt ftp.fakesite.com

myScript.txt

Code: [Select]fakename
notreal
cd /files
put file.zip
bye

The above script uploads file.zip to the files directory on the remote site.

To answer the question not asked. I would not try to combine the ftp into the other script. Instead try running both simultaneously in different windows.
Quote from: Sidewinder on February 05, 2009, 05:00:01 AM
I always thought that forums are a vehicle for sharing information. I thought after you learned FTP, you would come back here and share with us.

That FTP link was to give you all the tools you would need to write your own script. A little research on the FTP command line and you should have been good to go. &LT;sigh>

Code: [Select]ftp -s:myScript.txt ftp.fakesite.com

myScript.txt

Code: [Select]fakename
notreal
cd /files
put file.zip
bye

The above script uploads file.zip to the files directory on the remote site.

To answer the question not asked. I would not try to combine the ftp into the other script. Instead try running both simultaneously in different windows.

Is it possible to append a line of text to the end of say file.txt using FTP?Quote
Is it possible to append a line of text to the end of say file.txt using FTP?


Apparently. This very topic is discussed on the very FIRST page of the FTP link I gave you. If you need help with specific commands, enter ? command at the FTP> prompt.

Unless you get very lucky, it's rare that your research will spell out exactly what you're looking for. More likely you can learn by example or gain enough knowledge to be able to proceed.

any way to read out the contents of a file too?Code: [Select]open you.yourdomain.com
username
password
get file.txt
bye

then in file.bat
Code: [Select]@echo off
type file.txt
pause >nul
That's sort of what I was thinking...Quote from: Sidewinder on February 05, 2009, 05:00:01 AM
I always thought that forums are a vehicle for sharing information. I thought after you learned FTP, you would come back here and share with us.

That FTP link was to give you all the tools you would need to write your own script. A little research on the FTP command line and you should have been good to go. <sigh>

Code: [Select]ftp -s:myScript.txt ftp.fakesite.com

myScript.txt

Code: [Select]fakename
notreal
cd /files
put file.zip
bye

The above script uploads file.zip to the files directory on the remote site.

To answer the question not asked. I would not try to combine the ftp into the other script. Instead try running both simultaneously in different windows.

Sorry this is an old thread...but I've run into another problem. How can I run multiple FTP commands in the script, as in not in a seperate file?
4514.

Solve : Wait for command to complete before contining batch file?

Answer»

I have created a batch file with the following syntax

call c:\maxl\batch\inflation.bat

@echo off

:begin
febootimail -FROM [emailprotected] -TO [emailprotected] -MSG "Inflation Cubes are complete. Please do not respond to this message as it is sent from an unmonitored account." -SUBJECT "Inflation Cubes complete" -SMTP THCNOTES

if not errorlevel 5 goto end
echo Couldn't connect to server. Trying again...
goto begin

:end
echo End of batch program.

the first line calls another batch file which runs an essbase maxl script in a dos window, the problem is that when it runs the script it calls the 2nd batch file and that closes as soon as it has called the maxl script, I need a way to make the called batch file wait until the maxl script has run its course , is there anyway to make it wait until the script has runIf you KNOW how long it takes for that process to complete you can use a number of ways to make it COUNT x number of seconds before continuing.

Would a preset time delay work for you?not really, I need to know the time it is complete and then an email sent, the process could take 30 minutes to an hour BASED on server usage
i tested the following code, and call statement does calling another batch, and return to the caller once finished.
Code: [Select]@echo off
(
echo echo inflation bat start
echo ping 127.0.0.1 ^>nul
echo echo inflation bat finish
)>#.bat

call #.bat
echo return from call statement

so i suspect "inflation.bat" contain some command that run windows program in its own thread/process. or it MIGHT contain nt dos command such as "start","%comspec%", or "cmd" which create a new instance.How about changing your CALL batch file command to:

Code: [Select]start /wait cmd /C "c:\maxl\batch\inflation.bat"
@echo off
(
echo echo inflation bat start
echo ping 127.0.0.1 ^>nul
echo echo inflation bat finish
)>#.bat

call #.bat
echo return from call statement

this command is rewriting the inflation.bat file to read

echo echo inflation bat start
echo ping 127.0.0.1 ^>nul
echo echo inflation bat finish
Quote from: nigelben on March 09, 2009, 09:16:56 AM

this command is rewriting the inflation.bat file to read



it's just an example to proof that call statement does wait for a batch file to finish EXECUTING before returning.
if you can post the code of inflation.bat, maybe someone can help you.I think the code in Reply #4 should work for any code in the "inflation.bat" file.
4515.

Solve : No activity monitor in a folder?

Answer»

Hi Guys
I am bit new in Bat scripts . I need a script which will monitor a folder and if there is no activity in that folder ( creation of file , delete of file) for about 10 mins it will show a message in the screen ...

Is that possible ?

Many thanks in Advance ..
Ashraf try:

Code: [Select]:loop
set timee=%time:~0,-3"%
set /a timee=%timee%-10
dir /tc | find "%date%" "%timee%"
dir /ta | find "%date%" "%timee%"
dir /tw | find "%date%" "%timee%"
pause
choice /m "continue?"
if errorlevel1 goto loop
if errorlevel0 goto EOF

FBThanks For a quick reply ..awsome ..
will you please spend some of ur time for me to explain that .....

Many Thanks mate ..Looking forward to the explanation too I am not aware that batch code can monitor events. You can use VBScript instead:

Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceOperationEvent WITHIN 3 WHERE " _
& "Targetinstance ISA 'CIM_Datafile' and " _
& "TargetInstance.Drive = 'c:' And "_
& "TargetInstance.Path= '\\scripts\\'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent()
'WScript.Echo objLatestEvent.Path_.Class & " " & objLatestEvent.TargetIn
stance.Name

Select Case objLatestEvent.Path_.Class
Case "__InstanceCreationEvent"
WScript.Echo "File Created: " & objLatestEvent.TargetInstance.Name
Case "__InstanceDeletionEvent"
WScript.Echo "File Deleted: " & objLatestEvent.TargetInstance.Name
Case "__InstanceModificationEvent"
WScript.Echo "File Modified: " & objLatestEvent.TargetInstance.Name
End Select
Loop

Save the script with a vbs extension. RUN from the command prompt as cscript scriptname.vbs The directory is set to c:\scripts. Change as necessary.

Good luck.

The choice utility did not ship with XP (the OP's OS) and early versions of choice do not have the /m switch.I was hoping for an explanation of how SET /A would deduct 10 (minutes) from %timee% which is in the format hh:mm:ss - I think all I got from that line of the bat script was "missing operand"

set /a r=%time:~3,1%-1yup sorry i was drunk when i wrote it. It is possible to do it...

Code: [Select]:loop
set timee=%time:~0,-6"%
for /f "tokens=1-2 delims=:" %%A in ("%timee%") do (
set /a B=%%B-10
set timee=%%A:%%B
)
dir /tc | find "%date%" "%timee%"
dir /ta | find "%date%" "%timee%"
dir /tw | find "%date%" "%timee%"
pause
choice /m "continue?"
if errorlevel1 goto loop
if errorlevel0 goto EOF
unfortunately this too has it's drawback, it won;t work at times under ten past the hour and even if you put in a clause for that you'd have to put in another for times under ten past midnight. it's just better to use VBA

sorry

FBOr in fact as diablo says:
Quote from: diablo416 on September 10, 2008, 04:28:39 PM

set /a r=%time:~3,1%-1

FBThanks for the all the reply .
I was trying to do the VB script as sidewinder says and got the folloing error :

C:\>cscript no.vbs
C:\no.vbs(12, 1) Microsoft VBScript runtime error: Object required: 'stance'

Is taht make any sence ?

Sorry about that. The line in question was a comment.

Code: [Select]strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceOperationEvent WITHIN 3 WHERE " _
& "Targetinstance ISA 'CIM_Datafile' and " _
& "TargetInstance.Drive = 'c:' And "_
& "TargetInstance.Path= '\\scripts\\'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent()
Select Case objLatestEvent.Path_.Class
Case "__InstanceCreationEvent"
WScript.Echo "File Created: " & objLatestEvent.TargetInstance.Name
Case "__InstanceDeletionEvent"
WScript.Echo "File Deleted: " & objLatestEvent.TargetInstance.Name
Case "__InstanceModificationEvent"
WScript.Echo "File Modified: " & objLatestEvent.TargetInstance.Name
End Select
Loop

This script was designed to issue a message whenever an event occurred in the c:\script directory.

You will need to modify the script to monitor no events happening. One way would be to note the times any events OCCUR. When the time difference between two events exceeds 10 minutes, you'll have your period of inactivity.

Mostly, monitor scripts (you can monitor most anything) are used to trigger another event or to create documentation of some activity. Hmmm, a new concept, a monitor script to monitor non-events.

Thanks Sidewinder

I am not that smart to do what you are saying as I am not from a computer background ...Is it possible to implement by you , what you are saying (One way would be to note the times any events occur. When the time difference between two events exceeds 10 minutes, you'll have your period of inactivity.) ..It might be very easy code for you and will take 5 mins but to me ..it seems very complex ..

Thanks for helping me so far Hi Sidewinder

Also with my other script I have ..I use bmail (which is command line mail ) to send me a email then exceed the thresold .I have used that in batch script before and working good .(Dont know how you can use that in VB Script)

Is it also possible to send email using bmail program when there is no activity in the folder for 10 mins ...?

This script will be very help full for me ...of what I am doing right the moment ...

Sorry to be a pain for asking you so many things .

Many Thanks in advance ...
A monitor script is designed to wait for an event to occur and then do some work. In no event occurs, no work is performed. You can see the dilemma of monitoring non-events.

I was able to get these two scripts to work in a controlled environment. The first script monitors and times stamps directory activity. The second script calculates the time difference between the last event and the CURRENT time. When the difference gets to ten, we have liftoff


Script 1

Code: [Select]Const ForWriting = 2

strComputer = "."

Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM __InstanceOperationEvent WITHIN 3 WHERE " _
& "Targetinstance ISA 'CIM_Datafile' and " _
& "TargetInstance.Drive = 'c:' And "_
& "TargetInstance.Path= '\\scripts\\'")
Do
Set objLatestEvent = colMonitoredEvents.NextEvent()
Set f = fso.OpenTextFile("c:\temp\Timer.txt", ForWriting, True)
Select Case objLatestEvent.Path_.Class
Case "__InstanceCreationEvent"
f.WriteLine Now
Case "__InstanceDeletionEvent"
f.WriteLine Now
Case "__InstanceModificationEvent"
f.WriteLine Now
End Select
f.Close
Loop

Script 2
Code: [Select]Const ForReading = 1
Set WshShell = CreateObject("Wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

Do
Set f = fso.OpenTextFile("c:\temp\Timer.txt", ForReading)
strTime = f.ReadLine
If DateDiff("n", CDate(strTime), Now) > 10 Then
WshShell.Run "bmail ........",,True
Exit Do
End If
f.Close
WScript.Sleep 30000
Loop

I'm not familiar with bmail so you need to fill in the dotted line.

Good luck.

Do not put the scripts in the directory being monitored.Thanks a Lot sidewinder ..
My problem has been FIXED ..

Thanks to all for putting suggestion and help me out ..
This was my first post on the forum and I have started like this forum already , because of u all helping ppl over there ..

Thanks again
4516.

Solve : Need help extracting file in DOS?

Answer»

Hi,

I have a system with Windows 98 SE and the
Shell32.dll file is corrupted.

I tried replacing it with ONE on my hard drive
(extracted through system file checker)
and now the computer will only start to
DOS Command Prompt??

I am working off of my LAPTOP using XP and
downloaded Shell32.dll onto a floppy which
I need to extract into my 98 SE desktop.

I have no idea how to do this in DOS and have
been looking for the codes to type in.

Also, I'm not sure if there are different versions
of Shell32.dll??

I do have a 98 se boot flopy and also the original
98 and 98 se upgrade cd's, if that will help. They
don't seem to do anything though when I have
them in on startup??

I need some serious help and would appreciate
any suggestions.

I'm hoping I don't have to do a complete reinstall???

Thanks in advance!!!QUOTE from: thinkbig

I am working off of my laptop using XP and
downloaded Shell32.dll onto a floppy which
I need to extract into my 98 SE desktop.

Won't WORK. XP uses version 6.0. See below

Quote from: thinkbig
Also, I'm not sure if there are different versions
of Shell32.dll??

There are a number of different versions of shell32.dll. All Windows 98 systems have version 4.72.

Shell32.dll is located in BASE4.CAB on the Win98 INSTALL CD.




Thanks for responding!!

So if I put the Windows 98 Install CD in the computer,
do you know what I would need to type in to extract the file?

Thanks again!

Hi,

I figured it out (-: What an ordeal!!

I used the boot disk with cd rom support and
was able to find the code to extract the file
from the Win 98 CD.

Thanks again for your help!!!
4517.

Solve : Creating separate error files in Batch?

Answer»

I need to create error FILES from running a batch file for each of the command used.I need the error file NAME same as that of the "*.sql" name but with extn "*.err".
How do I proceed with this?
This is the existing code

FOR %%i IN ("*.sql") DO (
echo :r "%%i" >> run.txt)

I need to send the errors that arise on running the run.txt into the appropriate filesnames from where the error has generated.
Not really understanding. As written, you will end up with run.txt looking something like this:

:r 1.sql
:r 2.sql
:r 3.sql

Please explain what result your looking for. Are you looking to pass a error file label as a command line argument?, redirect output to an error file?, or use the stderr data stream?.



Note: run.txt is not an executable file.


I basically want to create batch files to run sql scripts from command promt using sqlcmd. The inputs to the sqlcmd will be from a text file.Whenever an error is ENCOUNTERED on running the script, the errors alone should be logged in the error file which is in the executed script name extn alone as .err.

The input text file to the sqlcmd will be dynamically created using a batch file.
FOR %%i IN ("..\dir1\dir2\*.sql") DO (
echo :r "%%i" >> run.txt)

I need to also include the : error command in the above code with the filename from %%i.Currently if I use
FOR %%i IN ("..\dir1\dir2\*.sql") DO (
echo : error %%i.err >>run.txt
echo :r "%%i" >> run.txt)

the file name with the FULL path and extn .sql.err is printed in run.txt where in :error doesnt accept it in this format.
Please help to proceed.


I think this is what you're looking for:

Code: [Select]FOR %%i IN ("..\dir1\dir2\*.sql") DO (
echo :error %%~ni.err >>run.txt
echo :r "%%i" >> run.txt)

Good luck.

4518.

Solve : check if a "." is in a variable?

Answer»

I know a similar question was ask but I did not understand the code nor did it work when I tried to modified it.

I would like my batch file to check if a period is in a variable. If "yes" then it does this otherwise it does something else. THis is all I have so far. This does NOT work. I'm using windows XP.

SET /p str=Enter a string:
for . IN %str% do echo got it
pause

Any comment or suggestion are always welcome.

thanks
C:\>found
88800004
88800004
88800004
88800004
88800004
88800004
8880000.4
[7]8880000.4
0
Found period
88800004
88800004
88800004
88800004
88800004
88800004
1
no period
BYE
C:\>type found.bat
@ECHO OFF

type period.txt
type period.txt | find /N "."
echo %ERRORLEVEL%

if %ERRORLEVEL%==1 GOTO NOPERIOD

if %ERRORLEVEL%==0 GOTO Found

:Found
echo Found period
type noperiod.txt
type noperiod.txt | find /N "."
echo %ERRORLEVEL%
if %ERRORLEVEL%==1 GOTO NOPERIOD

if %ERRORLEVEL%==0 GOTO Found

Goto END

:NOPERIOD
echo no period

:END
echo BYE

C:\>




http://www.dostips.com/DtTipsStringManipulation.php#Snippets_LeftString


<<"Mid String - Extract a Substring by Position
Description: Similar to the Mid function in VB a batch script can return a specified number of characters from any position inside a string by specifying a substring for an expansion given a position and length using :~ while expanding a variable CONTENT. The example here shows how to extract the parts of a date. ">> see below ***

Rem run period.bat
C:\>period
20:18:18.78
20:18:18.78
extract "." from string. Find "." and replace with nothing "."=
20:18:1878

C:\>type period.bat
@echo OFF
echo %TIME%
set str=%TIME%
echo.%str%
echo extract "." from string Find "." and replace with nothing "."=%.
set str=%str:.=%
echo.%str%


Script
echo.Date : %date%
echo.Weekday: %date:~0,3%
echo.Month : %date:~4,2%
echo.Day : %date:~7,2%
echo.Year : %date:~10,4%

***Script Output: Script Ouput
Date : Sat 03/11/2006
Weekday: Sat
Month : 03
Day : 11
Year : 2006



Code: [Select]@echo off
set/p s=enter string:

echo -=EXAMPLE WITH FOR LOOP=-
for %%a in (%s%) do if not "%%~xa"=="" (echo dot exist) else echo dot not exists

echo -=EXAMPLE WITH FIND=-
echo %s%|find "." >nul 2>&1 && (echo dot exist)||echo dot not exist
Thank you RENO. It works perfectly...Quote from: Reno on March 06, 2009, 10:14:20 PM

for %%a in (%s%) do if not "%%~xa"=="" (echo dot exist) else echo dot not exists

I like that lateral thinking, Reno, where you consider the string as a "filename" and see if it has an "extension".
Dias de verano wrote:

" . . .the string as a "filename" and see if it has an "extension"

Don't all file names on XP have an ".ext" .txt , .wpd . doc , .pps . . .?Quote from: billrich on March 07, 2009, 12:49:18 PM
Don't all file names on XP have an ".ext" .txt , .wpd . doc , .pps . . .?

An extension is not mandatory in MS-DOS or any VERSION of Windows. Extensions are used by Windows to implement file "types", but it is perfectly possible to have filenames without an extension. The Hosts file is a WELL known example. Others include ntldr and cmldr.
Quote from: Reno on March 06, 2009, 10:14:20 PM
Code: [Select]for %%a in (%s%) do if not "%%~xa"=="" (echo dot exist) else echo dot not exists

The code works great but I do not understand the code for the for loop one. Can you or anyone explain please.

Where in the code does it say that you check for the "." Also, what does "%%~xa"=="" mean?

thanksQuote from: locbtran on March 07, 2009, 06:15:59 PM
Quote from: Reno on March 06, 2009, 10:14:20 PM
Code: [Select]for %%a in (%s%) do if not "%%~xa"=="" (echo dot exist) else echo dot not exists

The code works great but I do not understand the code for the for loop one. Can you or anyone explain please.

Where in the code does it say that you check for the "." Also, what does "%%~xa"=="" mean?

thanks

I hope I am not pre-empting Reno by explaining his or her excellent ingenious [see below*] piece of scripting.

1. By typing FOR /? at the prompt you will see the help text which includes information about the "variable modifiers".

2. These consist of a tilde character ( ~ ) followed by one or more letters.

3. They allow the extraction of information from a string of text considered to be a filename.

4. Examples: If %%A [in a batch] is a filename, [or %A at the prompt] then %%~dA returns the drive letter and colon (e.g. "C:"), %%~pA returns the path, %%~nA returns the name, and %%~xA returns the extension if there is one, and an empty string if there is not. An extension is defined as a dot and at least one following character.*

5. The filename does not have to refer to any existing file.

6. Thus:

Code: [Select]C:\>for /f "delims==" %A in ("hello.kitty") do @echo Result: "%~xA"
Result: ".kitty"

C:\>for /f "delims==" %A in ("hello.kitty.today") do @echo Result: "%~xA"
Result: ".today"

C:\>for /f "delims==" %A in ("hello.k") do @echo Result: "%~xA"
Result: ".k"

C:\>for /f "delims==" %A in (".k") do @echo Result: "%~xA"
Result: ".k"
BUT...

Code: [Select]C:\>for /f "delims==" %A in ("hello.") do @echo Result: "%~xA"
Result: ""

C:\>for /f "delims==" %A in (".") do @echo Result: "%~xA"
Result: ""

C:\>for /f "delims==" %A in ("......") do @echo Result: "%~xA"
Result: ""
* We see by experiment that the method will not INFALLIBLY detect the presence of a dot in a string, since if the string contains a dot only in the last position, or if all characters are dots, then a false report is given.

So to answer your questions

Quote
Where in the code does it say that you check for the "."

It doesn't, as explained above, explicitly search for a dot. It attempts to exploit a feature of cmd.exe intended for another purpose. And will succeed in some, but not all cases. Thus I cannot recommend it.

Quote
Also, what does "%%~xa"=="" mean?

It is part of an IF expression...

Code: [Select]if not "%%~xa"==""

... which tests the following:

is the string formed by expanding "%%~xa" NOT equal to two quote marks? (i.e. is it NOT empty?)


If the user enters the string, the user already knows the string has a "." The source of the string could be the file names on the
computer. Do not list all the file names but instead provide a count of the file names. Also provide a count of the filenames without a "." Reno suggested the source of the string be filenames on the computer
dir /s * | find /c "."
30353

dir /s * | find /v /c "."
13003Quote from: billrich on March 08, 2009, 06:18:28 AM

C:\>dir /s | find "." | wc -l


wc is not a standard Windows command, it is a Unix utility that needs to be downloaded. You should have made that clear.

Also, it doesn't answer the OP's question.



dias, that's too much, its just an ordinary script, and worse its buggy code.
you have done a good job at explaining. if i had to do the explaining part, i am going to reply type for /? for more info

i also just realized it wont work when the string contain space, so here is the fix:
Code: [Select]for %%a in ("%s%-") do if not "%%~xa"=="" (echo dot exist) else echo dot not exist
still the above code can't handle wildcard characters such as "*, ?", but the find example can with some fix.
Code: [Select]echo "%s%"|find "." >nul 2>&1 && (echo dot exist)||echo dot not exist
Quote from: Reno on March 08, 2009, 06:38:42 AM
dias, that's too much, its just an ordinary script, and worse its buggy code.

Scripts, whether ordinary or special, should be as error free as we can make them. My turn to roll eyes



ahh....

sometimes I can bask in the glory of having Instr and InstrRev at my disposal...dir /s | find "." | wc -l
dir /s * | find /c "."
Number of strings with "." = 30362
dir /s * | find /v /c "."
Number of strings without "." = 13003


Dias de verano wrote:
"Wc is not a standard Windows command, it is a Unix utility that needs to be downloaded. You should have made that clear.
Also, it doesn't answer the OP's question."

The Original Poster ask us to find a "." in a string. All the file names on the computer are a string. ( When the user enters the string, the user already knows the string has a ".") We answered the question very well. find /c can find the count. wc -l is not needed.
4519.

Solve : Need help loading old dbase applications program to newer platform with DOS.?

Answer»

I have an old applications program written in dbase that is installed on an old Compaq Contura laptop with a DOS based system--the monitor on it is giving up the ghost and I need to continue to use this program (at least in the short term) for a customized list management program.
I tried to load it on an older (but not as old) Compaq 386 based system that uses Windows 95 and first received the message that there was an FCB problem and I think I fixed this by editing the CONFIG.SYS to fcbs= 32.
The error message I am now getting is OVERLAY FILE (DBASEOVR.COM) CANNOT BE OPENED.

Can anyone suggest how to deal with this message or other advice on how to get this applications program loaded to a more current platform? It will not work on any current Windows system so what I did was to back up the files on diskette using PKZIP and have unzipped it onto this other platform but can't get the program to work.

Thank you for your suggestions.

I would think that the problem lies in the 32-bit (&GUI) OS you are TRYING to use, instead of the older 16-bit one - I wonder if the disk / cluster size is a problem for the overlay manager .. or long FILENAMES ?. Did the install set up a dbase overlay path variable to point to the overlay file ?

If it is only short-term, why not stick a REPLACEMENT monitor on the laptop, most have an external monitor socket ... I am assuming its an ega one - it shouldnt be too hard to dig one up.

If not, have you a sacrificial pc to hand ? wipe it and install DOS 6.22 on it (and dbase), that should work

Failing that, upgrade the dbase to a 32 bit one ... my KNOWLEDGE of dbase is a bit rusty (I think dbase III was my last contact) - Foxbase or Foxpro should do it, I dont know if Clipper (a dbase compiler) is STILL around.

Good luck with this
Graham

4520.

Solve : Wildcard query.?

Answer»

Okay, lets SAY I'm looking for files that start with ZZ, and in the middle, it can be anything, but then after that, I want it to end in 123. The extension would be anything that starts with the letter 'P'. Would it be this?

Code: [Select]Zz*123.p*That should be correct. If it allows that kind of use with Wild Cards. Quote from: BatchRocks on March 07, 2009, 08:32:54 PM

Okay, lets say I'm looking for files that start with Zz, and in the middle, it can be anything, but then after that, I want it to end in 123. The extension would be anything that starts with the letter 'P'. Would it be this?

Code: [Select]Zz*123.p*

Why don't you just try it out? Not meaning to be critical, but experiments are a good way of learning.
I can say it won't WORK that way on pure DOS, since the Asterisk will match to the end of the name or extension- for example, *a.* would be the same as *.*, *a.txt would be the same as *.txt, and file.t*t would be the same as file.t*.

I BELIEVE this "rectified" in CMD, though.

4521.

Solve : Extracting FileName in Batch File?

Answer»

How to extract FILENAME without extension from the absolute path in a BATCH file
You can use the FOR command to strip out bits of a name, CHECK out FOR /?
Graham

4522.

Solve : batch file that lists folders that are NOT in a text file?

Answer»

Hi everyone,

I'm new to this forum. Glad I found it...

I was looking all over internet for some help with batch file. I'm pretty new to the batch file writing.

Was wondering if anyone can help me with this question for my computer.

I have a folder and inside this folder there are A LOT of folders.

(e.g C:\pics has folder1, folder2, folder3 ...)

I have a text file with folders that I want to keep in a LIST.

textfile:

folder2838
folder 1211
...
...
...

I WANTED to make a batch file so that when i run it in C:\pics, it makes a list of all the folders that are not in my text file and output to another text file.

Thank you in advanced for everyones help.




Code: [Select]@echo off>newfile.txt

echo -=for loop with findstr, oneliner but slow=-
for /r %%a in (.) do findstr/x /c:"%%~na" scan.txt>nul||echo %%~dpna

echo -=double for loop, longer code but faster=-
for /r %%a in (.) do (
SET found=
for /f %%B in (scan.txt) do if "%%~na"=="%%b" set found=x
if not defined found echo %%~dpna
)
::)>>newfile.txt
Thank you for looking into this. I tried doing a test and my newfile.txt output file was empty. Im looking at the code now...Reno,

Did it work for you?

that's why i commented the last line of the code, to output/append to a file, you use the double greater sign (">>"). example:
Code: [Select]echo sometexthere>>newfile.txt
>>newfile.txt echo sometexthereeither syntax will append "sometexthere" to newfile.txt

the first line @echo off>newfile.txt, mean create/overwrite newfile.txt everytime the batch start.


Code: [Select]@echo off>newfile.txt

echo -=for loop with findstr, oneliner but slow=-
for /r %%a in (.) do findstr/x /c:"%%~na" scan.txt>nul||(echo %%~dpna)>>newfile.txt

echo -=double for loop, longer code but faster=-
for /r %%a in (.) do (
set found=
for /f %%b in (scan.txt) do if "%%~na"=="%%b" set found=x
if not defined found echo %%~dpna
)>>newfile.txt

there is two methods i can think of ATM, so after you test it out, you can pick one of the method to your preference.

4523.

Solve : Looking for help with the > switch?

Answer»

Looking for a bit of help trying to set up a batch file, where I can PING VARIOUS servers in the company I work for . We have approx 20 we ping every morning and I can write a batch file to ping them.

What I would like to do to to direct the output of the ping to a text file so we can review and save the results of the ping of the 20 servers

What happens is the output is outputted to kr.txt file but it includes only the output from the last server on the list, in this case the output of 10.9.10.16. I could output the results of the ping to 20 different text files, but would prefer to have the output in one txt file

ping 10.9.10.1 > C:\kr.txt
ping 10.9.10.16 > C:\kr.txt

Any ideas ?

ThanksWelcome to the CH forums.

Use

Code: [Select]ping 10.9.10.1 > C:\kr.txt
ping 10.9.10.16 >> C:\kr.txt

> starts writing the file >> appends further data to the end of the file.

If you don't want to overwrite the file each day use

Code: [Select]ping 10.9.10.1 >> C:\kr.txt
ping 10.9.10.16 >> C:\kr.txt

Good luckThanks for the quick reply !!.

Was thinking of outputting the text file to a file based on the date using the var %dat%, not EXACTLY sure how to do this, so we would have a txt file called Sept 18, tomo called Sept 19 etc Following seems to do what you want if the %date% environment variable returns the date in yyyy-mm-dd format. You may have to make changes if your %date% format differs. Also you'll have to change path(s) to suit. I ran it with the Ping commands just for a trial.

Good luck.

Code: [Select]@echo off
cls

set /a mm=1%date:~5,2%-100
set /a dd=1%date:~-2%-100

for /F "tokens=%mm%" %%b in ("Jan Feb Mar Apl May Jun Jul Aug SEP Oct Nov Dec") do (
set month=%%b.txt
)

set logfile=c:\%dd%-%month%

ping -n 5 -w 100 10.9.10.1 > %logfile%
ping -n 5 -w 100 10.9.10.16 >> %logfile%
:: etc....

type c:\19-Sep.txt


4524.

Solve : Redirect the output of command line into trsh.?

Answer»

I want to redirect the output of call command into trash i dont want to make any file and write output in that .

Can anyone help me .
thanks for any help.What you call "trash" is called "the null device", and in code is written as NUL or nul.

call whatever>nulYou can redirect to NUL.
Code: [Select]call whatever >NULwill redirect everything on STDIO to NUL which does not go ANYWHERE, like /dev/null OK thanks

it WORKS

4525.

Solve : Regedit & CMD Variables?

Answer»

Hi all

you know that we use the command REG QUERY to get the data of a value in the registry

How can I make a variable take the data of a value OR value under a key as a value of it

Thanks if you want a single key to variable try this:

Code: [Select]@echo off
Reg Query <the key name> > <temporary file>
set /p return=<<same temporary file>

example:
@echo off
reg query EXAMPLEKEY > return.tmp
set /p return=
Hope this helps
,Nick(macdad-)Hello

This is the contene of my BATCH file

it is simple locker of files

so user can lock his files by a password

you can read it in know how it doesn,t work ( when it unlocks the folder

P.S : I want to convert it to exe file

Code: [Select]cls
@ECHO OFF
title Folder Locker BY: Feras Jubeir --- E-mail: [emailprotected]
mode 70,18
color 12
if EXIST "Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}" goto UNLOCK
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
cls
echo.
echo Are you sure you want to Lock the folder (Y/N)
echo.
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
goto CONFIRM
:LOCK
cls
echo.
echo Enter your password please
echo.
set/p "pass1=>"
cls
echo.
echo Re enter your password please
echo.
set/p "pass2=>"
if NOT %pass1%==%pass2% goto relock
ren Locker "Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}"
attrib +h +s "Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}"
goto End
:relock
cls
echo.
echo Sorry, The entered passwords do not match
echo.
echo Enter your password please
echo.
set/p "pass3=>"
cls
echo.
echo Re enter your password please
echo.
set/p "pass4=>"
if NOT %pass3%==%pass4% goto relock
ren Locker "Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}"
attrib +h +s "Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}"
echo Folder locked
goto End
:UNLOCK
cls
echo.
echo Enter your password please
echo.
set/p "unlockpass=>"
if %unlockpass%==%pass1% goto unlocked
if %unlockpass%==%pass3% goto unlocked
goto FAIL
:unlocked
cls
attrib -h -s "Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}"
ren "Control Panel.{21EC2020- 3AEA-1069- A2DD-08002B30309 D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo WRONG Password
echo.
echo.
echo.
echo.
pause
exit
:MDLOCKER
md Locker
goto End
:End
exit

thank you
i can tell you that the variables that HOLD the password are deleted after the batch program closes. this happens to all variables in batch.

try storing the password in a registry key.

and for turning this into a EXE, try here: http://www.download.com/Bat-To-Exe-Converter/3000-2069_4-10555897.htmlhello

I have bat to exe converter

*I stored the password in reg key, please write here the complete code

Thank you could just use REG Query again to load up the password into a variable once the batch program starts..like i showed you before.this is a script i wrote few months ago when i learn "reg query". this will set the autorun status of drive type.
autorun.bat purpose: example when you plug in a USB flashdisk, if autorun for removable is on, then it will automatically execute the "autorun.inf" in the flashdisk. if flashdisk contain virus, then your computer will be infected.

you can learn how to read and write to registry from below batch, you are free to modify and use it to suit your need.

Code: [Select]::AutoRun.bat DriveType as %1 [On|Off as %2]
@echo off&setlocal enabledelayedexpansion

set 0=BACKUPREG
set 1=UNKNOWNDRIVE
set 2=NOROOTDIR
set 4=REMOVABLE
set 8=HDD
set 16=NETWORK
set 32=CDROM
set 64=RAMDISK
set 128=RESERVE
set 255=ALL

echo.%*|find "?">nul && goto :SYNTAX || if "%~1"=="" %0 ALL

set TYPE=
for %%i in (1 2 4 8 16 32 64 128 255) do if /i !%%i!==%~1 set TYPE=%%i
if not defined TYPE goto :SYNTAX

set QUERY=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer /v NoDriveTypeAutorun
%3 cls
%3 reg query %QUERY%
%3 if ERRORLEVEL 1 reg add %QUERY% /t REG_DWORD /d 0 & %0 %*
echo ------------------------------------------------------------------------

::Display Current Status
for /f "skip=4 tokens=3 delims= " %%a in ('reg query %QUERY%') do set /a VALUE=%%a
echo ^>^>AutoRun Status:
for %%i in (1 2 4 8 16 32 64 128) do (
set /a CMP=%TYPE%^&%%i
if not !CMP!==0 (
set /a CMP=%VALUE%^&%%i
if !CMP!==0 (echo !%%i! = ON) ELSE echo !%%i! = OFF
)
)

::Toggle Drive Type to On or Off
if NOT "%~2"=="" (
if /i "%~2"=="ON" set /a CMP=%TYPE%^^0xFF & set /a VALUE=!VALUE!^&!CMP!
if /i "%~2"=="OFF" set /a VALUE=!VALUE!^|!TYPE!
reg add %QUERY% /t REG_DWORD /d !VALUE! /f
if not errorlevel 1 %0 ALL "" ::
)
%3 echo. & echo Type %0 /? For Help

pause & endlocal & exit /b 0

:BACKUPREG
for %%i in (HKLM
:SYNTAX
echo Check Autorun Status Base On DriveType & echo.
echo Usage: %0 DriveType [ON^|OFF] & echo.
echo DriveType:
for %%i in (1 2 4 8 16 32 64 128 255) do echo !%%i!
echo. & echo [ON^|OFF]: Optional - Toggle AutoRun to ON or OFF
endlocal & exit /b 1

WARNING: i am not responsible for any damage that might be cause by the above script.
though its unlikely that it can cause damage, put the warning just in case mm

good

thanks

4526.

Solve : Need help to create batch files?

Answer»

Hello..I just want to ask you all how to make batch files for this:
C:\putty\psftp stork
login as:ODBMS
password:******
LCD a:\
cd /u02/app/tsm/tsmdbbk
get dsmserv.dsk
get dsmserv.opt
get devconfig.out
get volhist.out
bye

Please help me..i NEED you all help..Thanks what exactly do you want it to do?It seems some of those commands can be passed on the command line while others can come from a script.

Code: [Select]C:\putty\psftp -l odbms -pw ****** -B script.txt

script.txt
Code: [Select]cd a:\
cd /u02/app/tsm/tsmdbbk
get dsmserv.dsk
get dsmserv.opt
get devconfig.out
get volhist.out
quit

For more details check out: PSFTP

Good luck.

Couldn't figure what stork meant.Quote from: Sidewinder

Couldn't figure what stork meant.

Well, Ahli Baru might know...

Check out that line starting "password"...

Code: [Select]macam mana nak buat batch files(FTP) untuk ni:

start MENU > run > type: c:\putty\psftp stork

login: odbms
password: 7bAHy8XB
lcd a:\
cd /u02/app/tsm/tsmdbbk
get dsmserv.dsk
get dsmserv.opt
get devconfig.out
get volhist.out
bye
4527.

Solve : Making a list.txt of files.?

Answer»

I am trying to get a list to come out in notepad or word. I have files that I need to print out lists of but there are over 40 FOLDERS and 200 plus files in each. I have tried a batch file but I can not get it to work.

I know you first get the directory and then a command that gets the list to form from the directory you just selected. I am trying to get to C:\documents and setting\bm9327\my documents\11. That is just an example.

I have also heard that DOS does not recognize more than 7 character files. Is that true. Could someone please help me with this? BEN,

REM test at the command prompt before a batch
REM
REMC:\>set /a 200 * 40
REM 8000
REM C:\>set /a 8000 / 20
REM 400
Rem It will take at least 400 pages to print

C:\>

C:\>dir /s *.* > showall.txt

C:\>wc -l showall.txt
43335 showall.txt

C:\>set /a 43335 / 30
1444
REM It will take at least 1444 pages of paper to print

C:\> type showall.txt | more



Directory of C:\AHCache\All Users\Microsoft.Net.Client.3.5

12/24/2008 07:30 PM .
12/24/2008 07:30 PM ..


Directory of C:\c3747b98c371675968434467\amd64

12/24/2008 07:50 PM .
12/24/2008 07:50 PM ..
07/06/2008 06:06 AM 147,456 filterpipelineprintproc.dll
07/06/2008 06:06 AM 10,929 msxpsdrv.cat
06/18/2008 11:33 PM 2,204 msxpsdrv.inf
06/19/2008 11:03 AM 73 msxpsinc.gpd
06/18/2008 11:33 PM 72 msxpsinc.ppd
07/06/2008 06:06 AM 748,032 mxdwdrv.dll
07/06/2008 05:36 PM 2,936,832 xpssvcs.dll
7 File(s) 3,845,598 bytes

Directory of C:\c3747b98c371675968434467\i386

12/24/2008 07:50 PM .
12/24/2008 07:50 PM ..
07/06/2008 06:06 AM 89,088 filterpipelineprintproc.dll
07/06/2008 06:06 AM 10,929 msxpsdrv.cat
06/18/2008 11:33 PM 2,204 msxpsdrv.inf
06/19/2008 11:03 AM 73 msxpsinc.gpd
06/18/2008 11:33 PM 72 msxpsinc.ppd
07/06/2008 06:06 AM 765,440 mxdwdrv.dll
07/06/2008 06:06 AM 1,676,288 xpssvcs.dll
7 File(s) 2,544,094 bytes

Directory of C:\Config.Msi

02/27/2009 09:26 PM .
02/27/2009 09:26 PM ..
0 File(s) 0 bytes

Directory of C:\DECCHECK

06/20/2008 10:38 PM .
06/20/2008 10:38 PM ..
09/10/2004 12:40 PM 5,970 eula.txt
1 File(s) 5,970 bytes

Directory of C:\Documents and Settings

01/17/2009 05:17 PM .
01/17/2009 05:17 PM ..
09/27/2008 11:42 AM Administrator
12/11/2008 08:57 PM Administrator.BILLSCOMPUTER
01/17/2009 05:17 PM Administrator.BILLSCOMPUTER.000
11/15/2008 07:37 AM All Users
03/02/2009 07:38 PM BILL Richardson


Directory of C:\Documents and Settings\Administrator

09/27/2008 11:42 AM .
09/27/2008 11:42 AM ..
01/21/2008 01:52 PM Desktop
11/14/2007 12:36 PM Favorites
11/14/2007 12:36 PM My Documents
11/14/2007 12:36 PM Start Menu


Directory of C:\Documents and Settings\Administrator\Application Data

01/21/2008 01:53 PM IDENTITIES


Directory of C:\Documents and Settings\Administrator\Application Data\Identities

01/21/2008 01:53 PM .
01/21/2008 01:53 PM ..
01/21/2008 01:53 PM {880D9259-98A5-4C94-9673-F92898F0B5EC}


Directory of C:\Documents and Settings\Administrator\Application Data\Identities\{880D9259-98A5-4C94-
9673-F92898F0B5EC}

01/21/2008 01:53 PM .
01/21/2008 01:53 PM ..


Directory of C:\Documents and Settings\Administrator\Application Data\Microsoft

01/21/2008 01:53 PM Address Book
11/14/2007 09:05 PM Internet Explorer
11/14/2007 09:06 PM Media Player
02/25/2008 07:13 PM MMC


Directory of C:\Documents and Settings\Administrator\Application Data\Microsoft\Address Book

01/21/2008 01:53 PM .
01/21/2008 01:53 PM ..
01/21/2008 01:54 PM 176,594 Administrator.wab
01/21/2008 01:54 PM 176,594 Administrator.wab~
2 File(s) 353,188 bytes

Directory of C:\Documents and Settings\Administrator\Application Data\Microsoft\Internet Explorer

11/14/2007 09:05 PM .
11/14/2007 09:05 PM ..
11/14/2007 09:04 PM 113 brndlog.bak
11/14/2007 09:05 PM 141 brndlog.txt
2 File(s) 254 bytes

Directory of C:\Documents and Settings\Administrator\Application Data\Microsoft\Media Player

11/14/2007 09:06 PM .
11/14/2007 09:06 PM ..


Directory of C:\Documents and Settings\Administrator\Application Data\Microsoft\MMC


C:\>
.
.
.
etc

4528.

Solve : Filename into variable?

Answer»

I am setting up a batch file that (hopefully) will echo the NAME of ANOTHER file in the same directory. In the directory, there will be one (and ONLY one) file of the type .tlc

This is a "custom" filetype, it's not a STANDARD .tlc (whatever that might be, not REALLY sure). What I want the .bat file to do is echo the name of the .tlc file. There will be other files in this directory.

In other words, my folder would look like

File01.fle
File02.fle
File03.fle
File04.fle
Displaythisfile.tlc

I want the bat file to do this:

[code and whatnot]
echo %file%

and that would return
Displaythisfile.tlc

thanks,
-darrylCode: [Select]for /f "delims==" %%F in ('dir /b *.tlc') do set file=%%F
echo %file%
perfect.

dias i love youQuote from: dworley on MARCH 06, 2009, 11:26:27 AM

perfect.

dias i love you

You can have my baby
4529.

Solve : add files to 7z?

Answer»

Hello,

I have the following structure: folder (level 1), contains many subfolders (level 2), each contains 3 sub folders (level 3) having names (fol1, fol2 and fol3), each folder in level 3 contains files.

structure:
Main folder ---> contains folders (sub1, sub2, sub3, sub4.......) ------> each sub contains (fol1, fol2 and fol3)

What I want to do is: compress all files (to 7z) in fol1 from each folder in level 2.

I tried the following code:

@echo off
setlocal enabledelayedexpansion

cd "C:\MainFolder"
for /f "delims==" %%l in ('dir /b /ad') do ((pushd %%l\fol1) && (for /f "delims==" %%b in ('dir /b /a-d') do ((pushd "c:\program files\7-zip") && (7z a -t7z "%%l\fol1\%%b.7z" -ssw "%%l\fol1\%%b" -m0=LZMA:d=64m:mt=2:fb=64 -mx=9 -ms=4g)) && (popd)) && (popd))

but it doesn't work, can any one HELP me?




Why all those && symbols?
After CLIMBING through all the smoke and dust, It seems to look like this:

@echo off
setlocal enabledelayedexpansion

cd "C:\MainFolder"
for /f "delims==" %%l in ('dir /b /ad') do (
pushd %%l\fol1
for /f "delims==" %%b in ('dir /b /a-d') do (
pushd "c:\program files\7-zip"
7z a -t7z "%%l\fol1\%%b.7z" -ssw "%%l\fol1\%%b" -m0=LZMA:d=64m:mt=2:fb=64 -mx=9 -ms=4g
popd
popd
)
)

What does that red "a" represent? Is that a switch? a typo?



PS. When writing batch code readability counts for more than saving space.OP seems confused about the difference between & and &&.Hello,

These symbols && mean (and) , and the red a in "7z a -t7z "%%l\fol1\%%b.7z" -ssw "%%l\fol1\%%b" -m0=LZMA:d=64m:mt=2:fb=64 -mx=9 -ms=4g" mean (add) to 7z, others in yellow are the parameters that 7z take;

I test the same function on echo (not on add to 7z) as the following:

@echo off
setlocal enabledelayedexpansion

cd "C:\MainFolder"
for /f "delims==" %%l in ('dir /b /ad') do ((pushd %%l\fol1) && (echo %cd%>>C:\test.txt) && (popd))


Result, If we have 2 folders in the main folder, test.txt will be as the following

C:\MainFolder
C:\MainFolder

It should be:

C:\MainFolder\sub1\fol1
C:\MainFolder\sub2\fol1


I will appreciate any help,

for 7z parameters, you can visit 7z help if you install it on your PC
1. && symbols represent the BOOLEAN AND. That is, in this statement:

Operation1 && Operation2

Operation2 will be executed only if Operation1 completed successfully

The SINGLE & is a command continuation character. In this statement:

Operation1 & Operation2

Operation1 will always execute, and when it has completed, Operation2 will always be executed.

2. I see that delayed expansion is enabled, yet nowhere is it used!

3. I think you are trying to be too clever with too many things all at once. Keep it simple and readable, as SIDEWINDER suggests.
Hello,

It works now,

all what I did: add the full path (i.e. add (pushd MainFolder\%%l\fol1) instead of (pushd %%l\fol1))

Thanks

4530.

Solve : Letting a bat file show how many times it has been used?

Answer» HI,

i want a bat FILE to show how many times it has been used,
is this possible?

PLEASE post a sample! correction:

CODE: [Select]set var=0
if exist TMP (
for /f "tokens=1 delims= " %%a in (TMP) do (
echo Times used: %%a
set var=%%a
)
)
set /a var+=1
echo %var% >TMPHow does that work exactly, macdad?alright im out. forget it. Yea it was a failure yea it was crappy yea im crappy so im out. i didnt take the time to WRITE it and debug it correctly ok dias. i deleted it. devcom is better at it then.chill, man!!!tyvm! sorry dias ive been kinda annoyed recently at school. but im really sorry for the yelling.No worries m8 hope you feel better soon
4531.

Solve : Find and Move a File?

Answer»

Hi

I want to create a bat file to do the FOLLOWING:

Firstly - Search a location C:/Folder1 for a file prefixed with letters eg CH12345

Possilbly using FIND, but I,m not familar with that command

Secondly - Send that file to another location ie C:/Folder2 and remove it from orignal location.

Not sure if the next step can be done, but it not totally required
Create an email and/or attach the file to the email?
Quote

Firstly - Search a location C:/Folder1 for a file prefixed with letters eg CH12345

So you're searching inside folder1 for any file that begins with CH ?


Quote
Secondly - Send that file to another location ie C:/Folder2 and remove it from orignal location.

for this you would do:


Code: [Select]move /-y C:/Folder1\Ch12345 C:\Folder2

That's how it works if I'm not mistaken.

You can't send an email using plain batch file. Use Blat.

If you don't want to download blat do:

Code: [Select]start mailto:[emailprotected]



Which will open up the email window. But the user must attach the file himself and click send. Thanks


So you're searching inside folder1 for any file that begins with CH ? Yesalso start mailto: works but opens OUTLOOK, how can i get to open lotus notes Quote
how can i get to open lotus notes


Well if this is a program, you just WRITE the path to lotus notes instead of writing start mailto:.
If it is a web program, using start type the url (link, found in address bar), then it will open the default browser.


Quote
So you're searching inside folder1 for any file that begins with CH ? Yes.



In that case, do this:

Code: [Select]move /-y C:\Folder1\CH* C:\Folder2

Which the * represents a wild card. If I'm not mistaken, the wild card will represent... Anything really.
Hope that helped. C:/ should be C:\ above.I always forget which way the slashes go.Hi Folks

Thanks for the help.

However

How can I move Multiple Files to one location;


Move all files prefixed with TE to new location
move "C:\Admin\Test Process Batch Files\Source\TE*.zip"

C:\Admin\Test Process Batch Files\Destination

ERROR is: Cannot Move Multiple Files to Single File

How can I work around this, as I will always have multiple files prefixed the same that need moving to same locationQuote from: petreli on March 03, 2009, 08:47:18 AM
Hi Folks

Thanks for the help.

However

How can I move Multiple Files to one location;


Move all files prefixed with TE to new location
move "C:\Admin\Test Process Batch Files\Source\TE*.zip"

C:\Admin\Test Process Batch Files\Destination

Error is: Cannot Move Multiple Files to Single File

How can I work around this, as I will always have multiple files prefixed the same that need moving to same location

this way how you want to move files
Code: [Select]C:\Admin\Test Process Batch Files\Destinationmeans that they will copy to file Destination but with no extension
so you must show that you want copy to dictory
Code: [Select]C:\Admin\Test Process Batch Files\Destination\Quote from: petreli on March 03, 2009, 08:47:18 AM
Hi Folks

Thanks for the help.

However

How can I move Multiple Files to one location;


Move all files prefixed with TE to new location
move "C:\Admin\Test Process Batch Files\Source\TE*.zip"

C:\Admin\Test Process Batch Files\Destination

Error is: Cannot Move Multiple Files to Single File

How can I work around this, as I will always have multiple files prefixed the same that need moving to same location

the basic syntax of move is

move filespec destination

So you do
Code: [Select]move "C:\Admin\Test Process Batch Files\Source\TE*.zip" "C:\Admin\Test Process Batch Files\Destination"Hi

I have tried this, I think the error I am receiving is means I cannot move files of the same prefix to the same location?

"Cannot move Multiple files to a Single file" is the error

What i'm trying to do is move multiple files to the same location not fileHmmm Me thinks that Copy is a better option, SEEMS to work better, but have to delete the files from source folder, but is safer if theres a problemQuote from: petreli on March 05, 2009, 05:39:20 AM
Hi

I have tried this, I think the error I am receiving is means I cannot move files of the same prefix to the same location?

"Cannot move Multiple files to a Single file" is the error

What i'm trying to do is move multiple files to the same location not file

Does the folder called Destination exist?
Hi Dias de verano

Yes destination file existsQuote from: petreli on March 06, 2009, 05:29:29 AM
Hi Dias de verano

Yes destination file exists

That is not what I asked. Read my question again.
4532.

Solve : Monitoring a program??

Answer»

Hey, I was just wondering if it's possible to open a program from DOS, then wait until it's closed. I use Vista Sidebar, and when I play Starcraft it seems to change my resolution then mess up my apps. So, I was wondering if it's possible to kill the task, then open Starcraft (keeping the dos open) then once the program is done it reopens Vista Sidebar.

Example:

KILL SIDEBAR
OPEN STARCRAFT
WAIT STARCRAFT
ONCE CLOSED STARTCRAFT
OPEN SIDEBAR

I hope you UNDERSTAND, THANKS!in batch:
taskkill sidebar
start/wait starcraft.exe
do
tasklist|find "starcraft.exe"
sleep 5sec
loop until starcraft not found
start sidebar

i dont like loop part, not sure how much cpu resource it GOING to eat. if start/wait works, then it's BETTER solution.

in vbs:
terminate process sidebar
monitor for wmi deletionevent of starcraft process id.
create process sidebarCode: [Select]taskkill /F /IM sidebar.exe
start /wait C:\path\to\starcraft\starcraft.exe
start sidebar.exe
@Reno
there are no do loop in batch and if you use start /wait you dont have to check if it is running cos start /wait does itof course there is no do loop syntax in batch, it's just pseudocode.
i put the loop there in case start/wait is not working as it should be with starcraft.exe
the batch code:
:doloop
ping -n 5 localhost>nul
tasklist|find/i "starcraft.exe" && goto:doloop

is taskkilling a running process a good way?
how to send WM_CLOSE msg to an application?Quote from: devcom on April 05, 2009, 02:50:58 AM

Code: [Select]taskkill /F /IM sidebar.exe
start /wait C:\path\to\starcraft\starcraft.exe
start sidebar.exe
@Reno
there are no do loop in batch and if you use start /wait you dont have to check if it is running cos start /wait does it

Thank you very much, this worked perfectly! Thanks to you to Reno.np
4533.

Solve : MS-DOS Verify command?

Answer»

I am creating a batch file to copy files from one DRIVE to another. I want to verify that the files are copied correctly. My question is what happens if I set Verify ON and there is a problem with a file? Does DOS just GENERATE a message or does it recopy the file until it gets it right? Or something else? Are messages/error codes generated that I can trap and use to control logic flow in the batch file?

Thanks,
Terryyou can ALWAYS CHECK with %errorlevel%THE "VERIFY" config.sys command is pretty pointless, actually. It was mostly used for unreliable floppy drives- EVERY time DOS copies data to the floppy, it reads it and makes sure it's the same, and if not it writes it again.Quote

It was mostly used for unreliable floppy drives
Good point.
Modern HDD has built-in features to insure proper write operation. If the HDD can not correct a problem in the background, you will get an error message even if verify is off.
4534.

Solve : Renaming program files folder?

Answer»

Hello,

I am trying to rename program files folder in the command prompt, but what i am entering is not the CORRECT syntax, according to the dos prompt window.

I have looked at the rename articles on this site, but i still get error that i have entered the incorrect syntax.

The renaming is:

D:\Program Files

to be changed to

D:\Old

I have tried:

rename D:\Program Files Old

ren d:\Program Files d:\Old

ren d:\Program Files

rename d:\Program Files

ren Program Files Old


Thanks

NickYou need to quote any FILE or path with spaces, or else the command interpreter get's confused.

Code: [Select]ren "D:\Program Files" D:\old
thanks for the quick reply. i just tried it and still get incorrect syntax message. BC_Programmer,
Why didn't you tell him?

If he don't know much about the syntax, he may not know that he should not rename the Program Files folder.
And why at the command line?
Or was this just another home work assignment from that goofy professor that only knows DOS? not quite,

i've partitioned the hard drive into LABELS, boot and program files. i want to shift the program files from boot to the partition, program files. if i did a copy and paste i thought that some programs might not work because they have registry entries pointing to their original location. therefore i have downloaded an app CALLED robocopy.exe, copied it to system32 folder and trying to rename pf folder to 'old', then using the app to move the files, then deleting the 'old' when all transferred across.

capiche ??

nickcapiche !does this make sense ??

i've partitioned the hard drive into labels, boot and program files. i want to shift the program files from boot to the partition, program files. if i did a copy and paste i thought that some programs might not work because they have registry entries pointing to their original location. therefore i have downloaded an app called robocopy.exe, copied it to system32 folder and trying to rename pf folder to 'old', then using the app to move the files, then deleting the 'old' when all transferred across.


cheers

nickWindows Server 2003 Resource Kit Tools

rktools.exe

http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en

4535.

Solve : need modification?

Answer»

@ECHO off
start "" "C:\Program Files\windows media Player\wmplayer.exe" /prefetch:6 /Open "C:\abc.mp3"
start "" "c:\abc.mp3"

ping localhost -n (60) -w 1000 > nul

@echo off
cd C:\
taskkill /IM wmplayer.exe
This program can not play the song abc.mp3. PLEASE modify what is needed. THANKS from devduttaDevdutta- please go make duplicate queries three times a week at another forum. I for one am TIRED of you asking the same question over and over again and insisting somebody provide some full-source solution.

use /PLAY instead of /OPEN.

4536.

Solve : Wrapping a For command string. (Resolved)?

Answer»

Win XP Home.

Is it possible to WRAP a string in a For command so that the entire contents of the string can be displayed on a standard 80-column screen when using Edit.com? I've tried the caret which gives an invalid SYNTAX.

Example - December") do ( is offscreen.

Code: [Select]
@echo off
cls

for /f "tokens=%1" %%1 in (
"January February March April May June July August September October November December") do (
echo %%1 is month number %1
)
for /f "tokens=%1" %%1 in (
"January February March April May June July"
"August September October November December"
) do (
echo %%1 is month number %1
)

no, i don't think it's possible.
command line interpreterA parenthetical structure like the dataset of a FOR construct cannot be broken e.g. with carets but other lines can, and long strings can be put in variables and expanded by cmd.exe at run TIME.

Code: [Select]@echo off
set Months=January February March April
set Months=%Months% May June July August
set Months=%Months% September October November December
for /f "tokens=%1" %%1 in ("%Months%") do (
echo %%1 is month number %1
)

or...

Code: [Select]@echo off
set Months=January February March April ^
May June July August ^
September October November December
for /f "tokens=%1" %%1 in ("%Months%") do (
echo %%1 is month number %1
)

Thank you both for the very quick responses.

Not strictly answering the question, but I couldn't resist this, using my trusty Evaluate script

Code: [Select]@echo off
echo Wscript.echo eval(WScript.Arguments(0))>Evaluate.vbs
For /f %%A in ( ' cscript //nologo Evaluate.vbs "MonthName(%1)" ' ) do (
echo %%A is month number %1
)


Plus, if you

1. Just put the script somewhere on your PATH

Evaluate.vbs

Code: [Select]Wscript.echo eval(WScript.Arguments(0))
2. Set the default script engine to Cscript.exe (it sticks till you change it)

Code: [Select]cscript //H:CScript
3. Set the default cscript behaviour to nologo (again, sticks until you save the opposite option)

Code: [Select]cscript //Nologo /S
... if you do these things the FOR line contracts down to


Code: [Select]For /f %%A in ( ' Evaluate "MonthName(%1)" ' ) do (
and

Code: [Select]evaluate "expression"
gives you all kinds of goodies (consult VBS documentation, not everything works, but a handy subset does)

USE quotes if there are spaces in the expression

like

Code: [Select]
C:\>evaluate weekdayname(weekday(date),0)
Friday

C:\>evaluate weekdayname(weekday(date),1)
Fri

C:\>evaluate 5/2
2.5

C:\>evaluate (date-1)
02/04/2009

C:\>evaluate (date+1)
04/04/2009

C:\>evaluate day(date)
3

C:\>evaluate month(date)
4

C:\>evaluate sqr(25)
5

C:\>evaluate sqr(26)
5.09901951359278

C:\>evaluate formatnumber(sqr(2),1)
1.4

C:\>evaluate formatnumber(sqr(2),2)
1.41

C:\>evaluate formatnumber(sqr(2),3)
1.414

C:\>evaluate formatnumber(sqr(2),4)
1.4142

C:\>evaluate formatnumber(sqr(2),5)
1.41421

C:\>evaluate Monthname(1,0)
January

C:\>evaluate Monthname(1,1)
Jan

C:\>evaluate FormatDateTime(date(),0)
4/3/2009

C:\>evaluate FormatDateTime(date(),1)
Friday, April 03, 2009

C:\>evaluate FormatDateTime(time(),3)
10:34:17 AM

C:\>evaluate FormatDateTime(time(),4)
10:34

C:\>evaluate timer
38112.15

And then, for a heavyweight experience, we have the virtually unusable and wholly undocumented (and thus useless) BCScript and BCEval:


Code: [Select]D:\VBPROJ\VB\BASeParser\bceval>bceval Sqr(12-14*2)+23
parsed Expression Sqr(12-14*2)+23
result:
23 + 4i

D:\VBPROJ\VB\BASeParser\bceval>BCeval {1,2,3}*{4,5,6}
parsed Expression {1,2,3}*{4,5,6}
result:
{{4,5,6},{8,10,12},{12,15,18}}

D:\VBPROJ\VB\BASeParser\bceval>BCeval ({1,2,3}*{4,5,6})*2
parsed Expression ({1,2,3}*{4,5,6})*2
result:
{{8,10,12},{16,20,24},{24,30,36}}

D:\VBPROJ\VB\BASeParser\bceval>BCeval ({1,2,3}*{4,5,6})*i
parsed Expression ({1,2,3}*{4,5,6})*i
result:
!Error #438("Object doesn't support this property or method in op *")!

D:\VBPROJ\VB\BASeParser\bceval>


Note that the last one, multiplying an Array (list) by imaginary number i fails. I thought about it and it's because I didn't implement that yet.

I also need to make it's output batch-friendly. I've only reaffirmed to myself that I NEED documentation on the functions and operators and so forth in the Evaluator. I forgot the syntax for my SEQ() and SEQEX() functions...

4537.

Solve : need a help to create a batch file?

Answer»

Hi folks,
I am newbie to MS-Dos.

Can you please help me out in creating a batch file to read a data from each listing CSV files as follows:

1.to list a all the CSV files.
2.read the data from each CSV file one by one.



it's urgent.
Dir *.csv

will list all your csv files

Dir /s *.csv

will list all csv files in the current directory and in sub directories

What do you MEAN by read ? youcan display them to the screen and view them if thats what you meanEach CSV file contains many column.
I want to read column 2nd and 3rd and store the value in some variable.

And i think we need to put the CSV file listing in a loop and read the 2nd and 3rd column value of every CSV file and store it in a some variable.


Hope you gotta know what i mean to say.

Thanks for ur reply


in batch, you can use a for loop, put delimiter as comma and then go on from there. Read for /? from the command LINE to know more, or search the forum for example CODE. there's lots.
however if you are not restrained to use batch, you can use text processing tools like gawk, for example

Code: [Select]gawk "{print $2,$5}" file

or if you want something native, with vbscript
Code: [Select]Set objFS = CreateObject("Scripting.FileSystemObject")
strFile= "C:\test\file.txt"
Set objFile = objFS.OpenTextFile(strFile,1)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
splitted = Split(strLine,",")
WScript.Echo splitted(2) , splitted(4)
Loop

the above solutions are not working.

Can anyone help me out with batch fileQuote from: chandrakala on March 20, 2009, 03:57:27 AM

Each CSV file contains many column.
I want to read column 2nd and 3rd and store the value in some variable.
Quote from: chandrakala on March 23, 2009, 02:41:22 AM
the above solutions are not working.

Can anyone help me out with batch file
huh? where is ghostdog?

the vbs solution is working. except to read column 2 and 3, you change the echo line to this:
Code: [Select]WScript.Echo splitted(1) , splitted(2)Quote from: Reno link=topic=79348.msg525766#msg525766 date=1237970543where is ghostdog?
[/quote
still here. just not going to waste my time asking back what's not working.
Study this, and hopefully all will become clear

Code: [Select]@echo off
echo column 1, column 2, column 3, column 4, column 5> test.csv
echo cat, dog, 12.445, Monday January 1st 2009, Zaragoza>> test.csv
echo Ant, Bear, "Chicken", "Diana Smith", Egg Sandwich>> test.csv

set filename=test.csv
for /f "tokens=1-5 delims=," %%A in ( ' type "%filename%" ' ) do (
echo %%B,%%C
)


Code: [Select]column 2, column 3
dog, 12.445
Bear, "Chicken"
Hi ghostdog,
The code is working fine.Thanks for you help.
Sorry could not reply you early due to some reason.sorry again.

Thank you for your help and time
4538.

Solve : Printing PDF files from DOS batch file?

Answer»

We have been trying to use the same commands we use for PCL FILES (PRINT, NPRINT, COPY) to print our new PDF files and all we get is garbage.

Now I understand the difference between the PCL print stream type files and the PDF image type files, but have not been able to find the BATCH command to print the later.

Details - PC OS is Windows XP on a Novell network
PDF created out of Oracle DocuCreate batch forms processing system
Need to print multiple files out of a batch job on a daily basis

Can anyone help?Are you using a PDF to PCL converter?
You can GOOGLE PDF to PCL and find some free downloads, otherwise the server software is about $300.

You may wish to read this:
http://en.wikipedia.org/wiki/Category:PDF_readers


Is it necessity to do it room the command line in a batch?
Look here: http://www.robvanderwoude.com/printfiles.php
About half way down the page find PrintPdf.bat and see a rather INVOLVED batch file the invokes the adobe reader from the command line. But it has a catch. Somebody has to close the reader when done.


Hope this is of some help.

4539.

Solve : variables?

Answer»

hello

How can I get the name of a file or a folder as a VALUE to a variable?

* Give me other examples please

thanks Code: [Select]set variable=C:\PROGRAM Files\Adobe
echo %variable%
DIR "%variable%"
That is ok

Thank you M.r Dias de verano

4540.

Solve : How to configure the DOS language from GERMAN to ENGLISH.?

Answer»

Hi Everone,

I would like to configure DOS language to English version instead of German without reinstall or reformat.
Is there any method to resolve this problem?Can anyone suggest me the simplest way?

Your feedback will be much much appreciate.

Many Thanks!is this pure DOS?There's a joke here somewhere, (at least to Brits of a certain age), but it would bad taste to look for it I feel.

Wir fahren gegen England...

joedavis answered a completely different question from the one the OP asked... is he a friend of billrich? They have a lot in common!Code: [Select]C:\>dir
Datenträger in Laufwerk C: ist WinXP
Volumeseriennummer: FC8E-1A32

Verzeichnis von C:\

18/12/2008 09:25 <DIR> Kontiki
26/04/2007 14:05 <DIR> basic
31/03/2009 09:14 <DIR> batch
26/03/2009 14:50 <DIR> utils
03/12/2008 08:58 <DIR> stylexp visual styles
01/04/2009 17:06 <DIR> Program Files
25/03/2009 21:47 <DIR> Documents and Settings
01/04/2009 18:17 <DIR> WINDOWS
13/03/2009 19:54 <DIR> downloads
26/10/2008 08:36 42 Drive-error.au3
16/09/2008 16:59 38 Drive-found.au3
14/02/2008 12:26 176 en-dma.reg
07/03/2009 21:59 8 hello
07/07/2003 18:58 34,074 jinglesncf.wav
20/03/2009 08:43 837 download.cmd
03/03/2007 17:44 15,658 mike.jpg
11/03/2009 12:44 1,672 neroerr.txt
08/06/2006 18:34 191 no-capslock.reg
03/08/2004 23:38 47,564 NTDETECT.COM
23/06/2008 18:47 250,048 ntldr
19/08/2008 18:24 2,322 OpenClose.vbs
19/12/2008 20:58 100 dlbt.log
26/03/2009 15:02 12 seeme.txt
12/10/2007 09:59 2,917 Settings.ini
12/10/2007 09:59 16,494 Commands.cfg
09/07/2005 18:49 395 sysvol.bat
02/09/2008 21:04 188 boot.ini
20/03/2009 10:59 7,755 wget.txt
03/03/2007 17:44 10,448 barbie.jpg
20 Datei(en) 390,939 Bytes
9 Verzeichnis(se), 6,994,604,032 Bytes frei

Wanna know how I did it?
Dear BC_Programmer

Yes, it is using Dos 6.22 as the OS.Dias de verano, can i know how u did that?? That was in Windows XP, this will not help you in MS-DOS 6.22

Code: [Select]C:\>date
Aktuelles Datum: 02/04/2009
Geben Sie das neue Datum ein: (TT-MM-JJ)
This is fun!

I don't believe you can change the actual language used by the OS... thankfully I still have my DOS 6.22 manuals, so let me just take a gander here *adjusts monocle*


...

Well, it would appear that that particular manual was useless ("Here is how you copy peach.exe and peach.hlp") But my old "Running MS-DOS" book if I recall was a bit more FLESHED out in that regard.


Hmm, from my readings it would appear that you require a special german version of DOS; however you can get the german keyboard layout using code pages.

http://books.google.ca/books?id=u7oN-5y7nGsC&pg=PA354&lpg=PA354&dq=MS-DOS+german+language+version&source=bl&ots=j3lb2PQxqX&sig=k2YF39_9lItgqwzBuP4UiPtL7kI&hl=en&ei=DdXUSf3ADpCKtAPhhvCtCg&sa=X&oi=book_result&ct=result&resnum=6#PPA354,M1To change the language used in Windows XP command prompt, what I did was download German SP3 and extract (it is an archive) cmd.ex_ Then I used expand.exe to expand that compressed file to German-cmd.exe.
Quote

To change the language used in Windows XP command prompt, what I did was download German SP3 and extract (it is an archive) cmd.ex_ Then I used expand.exe to expand that compressed file to German-cmd.exe.

So then you could do it by replacing are PROGRAMS that have any German text, but keep the originals is that do not have German. The ones that are just pure binary with no ASCII in them. Like...er..uh IO.SYS and maybe one other?I think IO.SYS/IBMBIO.COM had STRINGS, but I'm not sure.
4541.

Solve : 16 bit ms-dos subsystem?

Answer»

Hi all, im a newbie here, this is my first post.
My problem is to do with an ms-dos application that goes by the name of lynybudija. I have searched the web for such an application, but have come up with nothing.
It comes up with the message, the ntvdm cpu has encountered an ILLEGAL instruction. cs: 0725 IP: 011a OP:0f 02 09 0c oc choose close to terminate the application. I have run avg, super antispyware, malwarebytes, and none of them can find anything. The computer takes ages to shut down, and when starting up seems to take just as long, sometimes it looks as though its opening the web page twice, but is in FACT only opening it the once.
Any help will be greatly APPRECIATED, i have windows xp home edition, service pack 2.You got some ANSWERS on vunet, did you see them?
If you are referring to where i think you are, then yes i have seen them, but at the moment there is no clear solution to my problem.You gave more information on the other forums. The only Google search results for that name are your posts on other forums.

what the heck is "lynybudija"

if it's DOS program, why not you install ms-dos, or dos-box?you could try Dosbox.

4542.

Solve : Newbie?

Answer»

Ok BC that was something else... No idea what you were saying.. break it down for me?I posted the big batch file that I did to show how the Windows (in fact, any) command language is mighty useful for automating simple TASKS that you do a lot. In this case it is because I download lots of tv programme FLV files from a TV station website and I need to convert them into either mpg or divx avi files so I can watch them on TV using my DVD player. The SCRIPT I posted will convert all or a subset of the video files in a folder. I feel this is a VALID answer to the question, "What is "DOS" (CMD) useful for?"
IE, automating tiresome tasks.


This applies to file management as I said sort of, because sometimes the cute metaphor of dragging and moving files about becomes a bit old- you just want to move the file not see cutesy animations of little pieces of paper being moved that make you want to *censored* your head sideways and say, "awww"....

Additionally the Windows Explorer Copy kind of SUCKS.

4543.

Solve : n00b need help . . . on converting *.ASK file format?

Answer»

this is shame to tell that during college time, lecture told me to study and i skipped

my programming class.

what i need is a batch file to CONVERT following files:-

example 1:- 42 digits data.
Code: [Select]005974e21c

00175002152F416B5604FF78AD18A7EBFEA6DF897E

example 2:- 84 digits data
Code: [Select]005974e21c

00079001179ACB015460056A55ADCCEFA83FC835E40129899427274E1BF4C440EA3B11F1B016E1F80616

output format:-

Code: [Select][CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=
APE_PUBLIC_ID=

For 42 digits data, first 2 digits always are "00" and to be omitted.

Output for example 1:-
Code: [Select][CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=175002152F416B5604FF78AD18A7EBFEA6DF897E
APE_PUBLIC_ID=

For 84 digits data, first 2 digits always are "00" and "01" on 43th & 44TH digits to be omitted.

Output for example 2:-
Code: [Select][CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=079001179ACB015460056A55ADCCEFA83FC835E4
APE_PUBLIC_ID=29899427274E1BF4C440EA3B11F1B016E1F80616

File extension is *.ask or *.ASK and can be opened with notepad.

The 42 digits and 84 digits are random characters with combination of numeric and alphabets.

First 2 digits always are "00" while "01" on 43th & 44th digits.

Please help me build a batch file to do conversion. Thanks in advance.Sorry we can't help with homework.

In the rules.sorry for my bad english.

i think you got me wrong.

what i meant in my first post . . . i wasnt study / attend my programming class (that was long ago) and i am a working man now.

i am lack of batch programming knowlegde, thats why i need help / ASSISTANT from you all.

hope to get solution right in this great place . . . use set to get substring of string. set/? for more explanation.
use for loop to enumerate *.ASK file inside a folder

is your ASK file contents always 3 LINES?thanks for reply.

ASK content always 3 lines. this is an alternative, if you are not restricted at all from downloading gawk for windows.
Code: [Select]BEGIN{print "[CERT_PROG_DATA_IN]"}
NR==3 && length==42{ rap=substr($0,3); ape=""}
NR==3 && length==84{ rap=substr($0,3,40); ape=substr($0,45)}
END{
print "RAP_PUBLIC_ID=" rap
print "APE_PUBLIC_ID=" ape
}
save the above as script.awk and on command line
Code: [Select]C:\test>more file.txt
005974e21c

00175002152F416B5604FF78AD18A7EBFEA6DF897E

C:\test>gawk -f script.awk file.txt
[CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=175002152F416B5604FF78AD18A7EBFEA6DF897E
APE_PUBLIC_ID=

C:\test>more file.txt
005974e21c

00079001179ACB015460056A55ADCCEFA83FC835E40129899427274E1BF4C440EA3B11F1B016E1F80616

C:\test>gawk -f script.awk file.txt
[CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=079001179ACB015460056A55ADCCEFA83FC835E4
APE_PUBLIC_ID=29899427274E1BF4C440EA3B11F1B016E1F80616
or as one liner
Code: [Select]C:\test>gawk "NR==3{ printf \"[CERT_PROG_DATA_IN]\nRAP_PUBLIC_ID=%s\nAPE_PUBLIC_ID=%s\n\",substr($0,3,40),substr($0,45)}" file.txt
[CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=079001179ACB015460056A55ADCCEFA83FC835E4
APE_PUBLIC_ID=29899427274E1BF4C440EA3B11F1B016E1F80616
batch version:
Code: [Select]@echo off & setlocal

for /f "usebackq skip=2 delims=" %%a in ("%~1") do set s=%%a
echo [CERT_PROG_DATA_IN]
echo RAP_PUBLIC_ID=%s:~2,40%
echo APE_PUBLIC_ID=%s:~44%
output:
Code: [Select]C:\>ask data42.txt
[CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=175002152F416B5604FF78AD18A7EBFEA6DF897E
APE_PUBLIC_ID=

C:\>ask data84.txt
[CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=079001179ACB015460056A55ADCCEFA83FC835E4
APE_PUBLIC_ID=29899427274E1BF4C440EA3B11F1B016E1F80616
thanks for reply guys....

@Reno,

i created bat file and run it, but it didnt converting the ASK file. Any idea ?

@ghostdog74,

thanks for reply . . . i have no idea how to operate gawk . .Quote from: kent_lkc on April 02, 2009, 04:22:01 AM

thanks for reply guys....

@Reno,

i created bat file and run it, but it didnt converting the ASK file. Any idea ?
most probably you did not redirect to new file.

Quote
@ghostdog74,

thanks for reply . . . i have no idea how to operate gawk . .
too bad.yup, as ghostdog suggest, redirect it to new file, example as below.
Code: [Select]C:\>ask data42.txt>result.txt

C:\>type result.txt
[CERT_PROG_DATA_IN]
RAP_PUBLIC_ID=175002152F416B5604FF78AD18A7EBFEA6DF897E
APE_PUBLIC_ID=
or if you want to create the new file from inside batch, you could modify the code.
eg.
>>result.txt echo [CERT_PROG_DATA_IN]
4544.

Solve : waiting?

Answer»

Shall I not get any hope to get a code to close windows media player
window? No hope. None whatsoever.

umm I have an idea...just came to me now.

Code: [Select]@echo off
wmplayer SONG
ping localhost -n (length of song in seconds) -w 1000 > nul
tskill wmplayer

That should work...Quote from: Helpmeh on APRIL 01, 2009, 03:40:10 PM

That should work...

If you know in advance how long the song is.
Quote from: Dias de VERANO on April 01, 2009, 03:43:27 PM
If you know in advance how long the song is.


Yeah...but most likely you know the song beforehand.could add:
Code: [Select]@echo off
set /p length=What is the length of the song?
wmplayer SONG
ping localhost -n %length% -w 1000 > nul
tskill wmplayer
Quote from: macdad- on April 01, 2009, 04:58:44 PM
could add:
Code: [Select]@echo off
set /p length=What is the length of the song?
wmplayer SONG
ping localhost -n %length% -w 1000 > nul
tskill wmplayer


If you're playing the same song over and over again, then you won't want to ask for user input, just run it.But to use sleep you need to download extra stuff, and ping requires you to do none of that.I haven't tried starting WMP in command line, but I think you need to do the FULL file NAME (INCLUDING extension and path).heres the command line parameters and such for WMP:
http://support.microsoft.com/kb/241422Quote from: joedavis on April 01, 2009, 08:51:56 PM
That was the solution for about six threads on this subject

So, alright- let's send the message, "remember, if you REALLY want something solved, start 6 TOPICS about it"Well it get's the message across faster I guess...
4545.

Solve : How can I stop for a specific time?

Answer»

How can I STOP the execution of the next commands for a specific time using
SLEEP or any other command if there is?

THANKS
devduttaaWell, you can use sleep. But if you don't want to DOWNLOAD anything, use PING!

ping LOCALHOST -n (seconds) -w 1000 > nul

4546.

Solve : Batch with greater than sign?

Answer»

OK so I need to create a line of text in a new or existing file with a GREATER than sign

what I tried was

echo 1st line of text >newfile.txt
echo 2nd line of text >>newfile.txt
echo 3rd line with a greater than sign > >>newfile.txt
echo 4th line of text >>newfile.txt

the resulting text file will show

1st line of text
2nd line of text

and that's it

any suggestions

If you want something to be treated as plain text, use a ^ (caret).
The following should work:


Code: [Select]echo 1st line of text >newfile.txt
echo 2nd line of text >>newfile.txt
echo 3rd line with a greater than sign ^> >>newfile.txt
echo 4th line of text >>newfile.txt
exit
Some confusion here

This is a carrot This is a caret ^excellent that worked great

its amazing how one little carrot solves all my issues with this batchDias posted over Innerchaos Dias, do you have some powers we should know about? Can you move THINGS without touching them? Do you hear PEOPLE when they don't say anything?


lol my cousin Melvin has an "Apple" key AND a carrot key. I lied and said I had a grape key.Quote from: Helpmeh on March 29, 2009, 04:39:40 PM

Dias, do you have some powers we should know about?

Beware my powers....



Quote from: Dias de verano on March 30, 2009, 12:18:21 AM
Beware my powers....





Please...Please don't hurt me! You can have my watch, but just leave us alone!I have a wife and kids- eat them, mr.bear.

oh- we aren't talking about a bear. Off topicness!
The Thread!
Presented and produced by - Helpmeh
Co-Producer - Dias De Verano
Star of the thread - BCprogrammer


"Please enjoy this thread"
------------------------------------
Remember:
|
"Ignorance is Bliss"the thread concluded with the original poster's concluding statement:

Quote from: Innerchaos on March 20, 2009, 02:12:14 PM
excellent that worked great

its amazing how one little carrot solves all my issues with this batch

After that the TOPIC is either forgotten or off-topic banter ensues. this is an example of the SECOND case.Quote from: BatchFileCommand on March 30, 2009, 06:18:09 PM
Off topicness!
The Thread!
Presented and produced by - Helpmeh
Co-Producer - Dias De Verano
Star of the thread - BCprogrammer


"Please enjoy this thread"
------------------------------------
Remember:
|
"Ignorance is Bliss"

Lol...
4547.

Solve : what is the format to close the window?

Answer»

Thanks. I can play the song. But after the song is over the media player
window is not closing.
Please let me KNOW the format to close the media player window. I will be very happy.
THANKS
devduttaaI think what devduttaa means is that he wants windows media player to automatically close when it's finished playing the music. I'm fairly sure this was brought up before...Quote from: Helpmeh on March 30, 2009, 02:16:47 PM

I'm fairly sure this was brought up before...

Twice
Quote from: joedavis on March 30, 2009, 05:50:25 PM
Devduttaa,
Output:
.

C:\>type playsong.bat
Code: [Select]Rem @echo off
REM COMMAND line argument for sleep
REM playsong.bat 60
REM ARGUMENTS are: Sleep <SECONDS>

REM www.tricerat.com

C:\>
cd C:\Program Files\Windows Media Player\

start wmplayer.exe Highway Blues

cd \


Sleep %1

For /F "tokens=2" %%n in ('tasklist ^| Find "wmplayer.exe"') Do Set Task=%%n

echo %Task%


taskkill /PID %Task%

C:\>

Couldn't you just REPLACE sleep with ping? Some people don't have sleep.
4548.

Solve : bat file error issue with programs?

Answer»

Is this the silence that ends a thread that means "I've realised what a *censored* I've been"?no i had to do other things. sorry. but I wont say anything about what you said I'll keep that to myself. well then, see- we just wanted a conversation. Just reminding ourselves what we WOULD do in particular situations that just happened to coincide with yours is all.So did you make the defrag work?
do i need to check my paths on my trs-80 to run defrag? they should be the same right?I havent done it yet doing it know.the second works right offQuote from: BC_Programmer on March 25, 2009, 02:11:17 PM

do i need to check my paths on my trs-80 to run defrag? they should be the same right?

Halouk says they should.
Quote from: squall_01 on March 25, 2009, 02:14:49 PM
the second works right off

But your PATH variable is screwed. So NONE of the Windows utils that you see below will work from the prompt like they should.

Code: [Select] actmovie.exe ahui.exe alg.exe
append.exe arp.exe asr_fmt.exe asr_ldm.exe
asr_pfu.exe asuninst.exe at.exe ati2evxx.exe
Ati2mdxx.exe atmadm.exe attrib.exe auditusr.exe
autochk.exe autoconv.exe autofmt.exe autolfn.exe
blastcln.exe bootcfg.exe bootok.exe bootvrfy.exe
cacls.exe calc.exe certreq.exe certutil.exe
charmap.exe ChCfg.exe chkdsk.exe chkntfs.exe
cidaemon.exe cipher.exe cisvc.exe ckcnv.exe
cleanmgr.exe cliconfg.exe clipbrd.exe clipsrv.exe
clspack.exe cluster.exe cmd.exe cmdl32.exe
cmmon32.exe cmstp.exe CNAB4RPK.EXE CNMCP6e.exe
CNMCP78.exe comp.exe compact.exe comsdupd.exe
conime.exe control.exe convert.exe cscript.exe
csrss.exe ctfmon.exe dcomcnfg.exe ddeshare.exe
debug.exe defrag.exe dfrgfat.exe dfrgntfs.exe
dfscmd.exe diantz.exe diskpart.exe diskperf.exe
DivXCodecVersionChecker.exe DivXsm.exe dllhost.exe dllhst3g.exe
dmadmin.exe dmremote.exe doskey.exe dosx.exe
dplaysvr.exe dpnsvr.exe dpvsetup.exe driverquery.exe
drwatson.exe drwtsn32.exe dsadd.exe dsget.exe
dsmod.exe dsmove.exe dsquery.exe dsrm.exe
dumprep.exe dvdplay.exe dvdupgrd.exe dwwin.exe
dxdiag.exe edlin.exe esentutl.exe eudcedit.exe
eventcreate.exe eventtriggers.exe eventvwr.exe exe2bin.exe
expand.exe extrac32.exe fastopen.exe faxpatch.exe
fc.exe find.exe findstr.exe finger.exe
Firefox Setup 2.0.exe fixmapi.exe flac.exe accwiz.exe
fltmc.exe fontview.exe forcedos.exe freecell.exe
fsquirt.exe fsutil.exe ftp.exe gdi.exe
getmac.exe GkSui18.EXE gpresult.exe gpupdate.exe
grpconv.exe HELP.exe hostname.exe ie4uinit.exe
ieudinit.exe iexpress.exe imapi.exe imdisk.exe
imdsksvc.exe ipconfig.exe ipsec6.exe ipv6.exe
ipxroute.exe java.exe javaw.exe javaws.exe
jdbgmgr.exe jview.exe krnl386.exe label.exe
licmgr.exe lights.exe lnkstub.exe locator.exe
lodctr.exe logagent.exe logman.exe logoff.exe
logonui.exe lpq.exe lpr.exe lsass.exe
magnify.exe makecab.exe MAPISRVR.EXE mdm.exe
mem.exe metaflac.exe migpwd.exe mmc.exe
mmcperf.exe mnmsrvc.exe mobsync.exe mountvol.exe
mplay32.exe mpnotify.exe mqbkup.exe mqsvc.exe
mqtgsvc.exe mrinfo.exe MRT.exe mscdexnt.exe
msdtc.exe msfeedssync.exe msg.exe mshearts.exe
mshta.exe msiexec.exe mspaint.exe MsPMSPSv.exe
msswchx.exe mstinit.exe mstsc.exe napstat.exe
narrator.exe nbtstat.exe nddeapir.exe net.exe
net1.exe netdde.exe netsetup.exe netsh.exe
netstat.exe NICFIND.EXE nlbmgr.exe nlsfunc.exe
notepad.exe nslookup.exe ntbackup.exe ntdsutil.exe
ntkrnlpa.exe ntoskrnl.exe ntsd.exe ntvdm.exe
nw16.exe nwscript.exe odbcad32.exe odbcconf.exe
OggDSuninst.exe openfiles.exe osk.exe osuninst.exe
packager.exe pathping.exe PDBoot.exe pentnt.exe
perfmon.exe pgdfgsvc.exe ping.exe ping6.exe
PMounter.exe PowerCalc.exe powercfg.exe print.exe
progman.exe proquota.exe proxycfg.exe pxcpya64.exe
pxcpyi64.exe pxhpinst.exe pxinsa64.exe pxinsi64.exe
qappsrv.exe qprocess.exe QuickEdCleanReg.exe qwinsta.exe
rasautou.exe rasdial.exe rasphone.exe rcimlby.exe
rcp.exe rdpclip.exe rdsaddin.exe rdshost.exe
recover.exe redir.exe reg.exe regedt32.exe
regini.exe regsvr32.exe regwiz.exe relog.exe
replace.exe reset.exe rexec.exe route.exe
routemon.exe rsh.exe rsm.exe rsmsink.exe
rsmui.exe rsnotify.exe rsopprov.exe rsvp.exe
rtcshare.exe RTLCPL.exe runas.exe rundll32.exe
runonce.exe rwinsta.exe savedump.exe sc.exe
scardsvr.exe schtasks.exe sdbinst.exe secedit.exe
services.exe sessmgr.exe sethc.exe setup.exe
setupn.exe setver.exe sfc.exe shadow.exe
share.exe shmgrate.exe shrpubw.exe shutdown.exe
sigverif.exe skeys.exe slrundll.exe slserv.exe
smbinst.exe smlogsvc.exe smss.exe sndrec32.exe
sndvol32.exe sol.exe sort.exe spdwnwxp.exe
spider.exe spiisupd.exe spnpinst.exe spoolsv.exe
SpoonUninstall.exe sprestrt.exe spupdsvc.exe spupdwxp.exe
stimon.exe subst.exe svchost.exe SymTdiRg.exe
syncapp.exe sysedit.exe syskey.exe sysocmgr.exe
systeminfo.exe systray.exe taskkill.exe tasklist.exe
taskman.exe taskmgr.exe TaskSwitch.exe tcmsetup.exe
tcpsvcs.exe telnet.exe tftp.exe tlntadmn.exe
tlntsess.exe tlntsvr.exe tourstart.exe tracerpt.exe
tracert.exe tracert6.exe tsadmin.exe tscon.exe
tscupgrd.exe tsdiscon.exe tskill.exe tsshutdn.exe
TweakUI.exe typeperf.exe tzchange.exe unins000.exe
unlodctr.exe upnpcont.exe ups.exe user.exe
userinit.exe usrmlnka.exe usrprbda.exe usrshuta.exe
utilman.exe uwdf.exe verclsid.exe verifier.exe
vmnat.exe vmnetdhcp.exe vssadmin.exe vssvc.exe
vwipxspx.exe w32tm.exe wdfmgr.exe wextract.exe
wiaacmgr.exe winchat.exe WinFXDocObj.exe winhlp32.exe
winlogon.exe winmine.exe winmsd.exe winspool.exe
winver.exe WISPTIS.EXE wjview.exe wowdeb.exe
wowexec.exe wpabaln.exe wpnpinst.exe write.exe
wscntfy.exe wscript.exe wuauclt.exe wuauclt1.exe
wupdmgr.exe xcopy.exe XX293116.EXE XX2953.EXE
XXCOPY.EXE XXCOPY16.EXE XXPBAR.EXE
I'm on a network which mite be why with limitations.Quote from: squall_01 on March 25, 2009, 02:24:38 PM
I'm on a network which mite be why with limitations.

So this isn't your own computer?
noQuote from: squall_01 on March 25, 2009, 03:12:23 PM
no

Duh! Like "Read this first!" "GIVE all information!" Now he tells us! Probably the admin has disabled users from starting defrags.
yes, didn't expect it too..... was thinking of home but doing it here so its like ONE of those duh moments.Surpriseingly I got it work and it looks just like what you have posted. I kind of want it to be gui use. The help isnt all that helpful and I tried running it to no avial. Also, I want to know add avast and spybot but not sure what I have to point tooo..... I looked for an exe but its not anything that I can see right off that would lanuch the programs.
4549.

Solve : Need Help: How to replace Text string on File?

Answer»

Hi,

I need to Replace a TEXT on file and save it to another FILENAME. I know this can be done in the aplication it self "Replace". But ex. if you need 100 same file just different filename and you will just need to replace a text or "name" in a file.

ex. Need to replace "1" with "A"

Filename "1.txt"
2 3 4 1 2 3 1
1 2 3 4 5 6 7 8 9 1

and save this to diffrent filename "A.txt"
Quote from: jik on April 01, 2009, 05:37:19 AM

Hi,

I need to Replace a text on file and save it to another filename. I know this can be done in the aplication it self "Replace". But ex. if you need 100 same file just different filename and you will just need to replace a text or "name" in a file.

ex. Need to replace "1" with "A"

Filename "1.txt"
2 3 4 1 2 3 1
1 2 3 4 5 6 7 8 9 1

and save this to diffrent filename "A.txt"


if you are able to download stuffs, you can use SED (check my sig for link).
Example for 1 file
Code: [Select]c:\test> sed -i "s/1/A/g" file
2 3 4 A 2 3 A
A 2 3 4 5 6 7 8 9 A
example file multiple files
Code: [Select]c:\test> sed -i "s/1/A/g" file*.txt


what is "sed"?Quote from: jik on April 01, 2009, 06:50:14 AM
what is "sed"?
doesn't take much time to look it upQuote from: ghostdog74 on April 01, 2009, 06:54:03 AM
doesn't take much time to look it up

What he sed

4550.

Solve : How Do i open miscrosoft word??

Answer»

Ok i using windows xp and one my college assignments is based around using MS DOS, for the final part of the assignment it says
Quote

Open up MS Word using both interfaces.

well oviously a 2 year old can do this in xp lol but i need the DOS command... i am trying to open microsoft word 2003 btw im struggling so much on this because i looked all over net but cnt find a useful sorce, alot of things say to enter *** (whatever) then the program name but it dont work. so can somone just give me the exact thing so its as simple as typing it stright in. its annoying cause i asked my tutor but he says look on the net, urgh i on the net for 3 hours for him in my night, it got annoying so found a forum and HOPING u guys can help me plz
thanx people example open .doc file with default shell in windows nt cmd:
c:\filename.doc

i dont know how to open MS WORD in MS DOS, let me know if you somehow successfully install ms word in DOS.if you are using XP, then you are using DOS as in cmd.exe. the command line for opening word document is winword.exe "mydoc.doc".
"winword" is the command to open microsoft word.

of course it GOES without saying word must be installed.Quote from: Reno on March 31, 2009, 04:50:01 AM
i dont know how to open MS WORD in MS DOS, let me know if you somehow successfully install ms word in DOS.

Depends which version you mean... I used it for years. I preferred WordPerfect, but Word was OK. Microsoft Word 5.5 for DOS is still available, and it's free. (Legally). Microsoft is giving it away. Turns out Microsoft released a Y2K patch for Word back in 1999, and rather than try to sell it, they just posted the whole program on the web for anyone to take. It can run in real MS-DOS, in a DOS box under Windows, or in DOSBox under OSX or Linux.

http://download.microsoft.com/download/word97win/Wd55_be/97/WIN98/EN-US/Wd55_ben.exe


interesting, there is actually ms word for ms dos.

back in ms-dos era, i remember using a word processor, forgot what it's called, only remember the interface is all in blue color.
mostly use the 286 to play games, and using infinity.exe & norton to hack save game. the ol good days.

as for windows version of ms word & nt cmd.exe
Code: [Select]C:\>winword.exe
'winword.exe' is not recognized as an internal or external command,
operable program or batch file.have to specify full path to it, or add it in %PATH%.

but if you already have association of .doc file to winword, just typing the document name will launch winword.
Code: [Select]C:\>assoc .doc
.doc=Word.Document.8

C:\>ftype word.document.8
word.document.8="C:\Program Files\Microsoft Office\Office12\WINWORD.EXE" /n /dde

C:\>test.doc
Cheers guys
i will try it wen i get to college 2morrow
only problem is i gotta do it through there "H" drive cause there C drive is useless cause it got Congic on it ^^Quote from: Reno on March 31, 2009, 07:31:28 AM
back in ms-dos era, i remember using a word processor, forgot what it's called, only remember the interface is all in blue color.
mostly use the 286 to play games, and using infinity.exe & norton to hack save game. the ol good days.
Blue background was in a lot of word processors- including the built-in EDIT, as well as Microsoft Works. I think word had a blue background, but I never used it.


Quote
as for windows version of ms word & nt cmd.exe
Code: [Select]C:\>winword.exe
'winword.exe' is not recognized as an internal or external command,
operable program or batch file.have to specify full path to it, or add it in %PATH%.

or:

Code: [Select]Start winword

Quote
but if you already have association of .doc file to winword, just typing the document name will launch winword.
Code: [Select]C:\>assoc .doc
.doc=Word.Document.8

C:\>ftype word.document.8
word.document.8="C:\Program Files\Microsoft Office\Office12\WINWORD.EXE" /n /dde

C:\>test.doc

true, but I myself have gotten into the habit of using START to explicitly state what I want done. They both end up calling ShellExecute() or ShellExecuteEx(), but for some reason I feel the semantics are different.When you go to C:\ just write those commands
cd program files and press Enter you get
C:\Program Files>
cd microsoft office and press Enter you get
C:\Program Files\Microsoft Office>
cd office11 and press Enter you get
C:\Program Files\Microsoft Office\Office11>
now at the end of this just write WINWORD and press Enter The Microsoft Word will start.
I tested this and worked to me.
Cheers.I wonder why this doesn't work for me..

Oh I KNOW! I have word installed in my program files directory, which is on D:\.


Start winword works regardless of the installed location because the winword is a registered ActiveX Server application.

In fact, the logic above is as flawed as this:

Code: [Select]public FUNCTION UPPERCASE(BYval strUpper as STRING) as String
If strUpper="string" then
uppercase = "STRING"
else
err.raise 13,"could not ucase, unrecognized value!"
end if
which is completely useless and stupid. it "works" but only with a very specific set of circumstances, namely, that the parameter is "string". This is a protracted version of your example, which assumes that everybody has their "program files" folder on their C: drive. this can differ based on roaming profile settings and also on the Windows install drive, not to mention, in my case, the use of TweakUI to change the folder to a larger drive.Quote from: dr_iton on March 31, 2009, 02:12:58 PM
When you go to C:\ just write those commands
cd program files and press Enter you get
C:\Program Files>
cd microsoft office and press Enter you get
C:\Program Files\Microsoft Office>
cd office11 and press Enter you get
C:\Program Files\Microsoft Office\Office11>
now at the end of this just write WINWORD and press Enter The Microsoft Word will start.
I tested this and worked to me.
Cheers.

tested and worked so easily thankyou
haha i dunno if we was supposed to do it this way but if not me is awsome for smarter ^^ lmao nah really thankyou though. really good and easyit's NOT a good way of doing it. I already explained that. It only works in the default case. Not everybody has it installed in that specific location.

another way could be through script, which completely side-steps any path issues whatsoever.

Code: [Select]'in openword.vbs
set word = GetObject("","Word.Application")
Word.Visible=true
Set Word=Nothing