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.

501.

Solve : Copy with Omissions?

Answer»

Does anyone know how to omit certain files from a list of files?  For example, say you want to copy all files, EXCEPT those that start with the letter "S", something like  *.* omit S*.*  this is a VERY CLUNKY reply.

first of all, i have been using DOS for a number of years and i have never SEEN an omit SORT of thing.

if what you are doing is a standard operation for you

i WOULD  (CLUNKY)
write a batch file that would call 9 other batch files
the ninth one calling another batch file calling 9 others.

something like this
copeea
copeeb
copeed

where
copeea.bat    
   this would say copy  c:\subdir\a*.*  c:\other\

it would take about ten MINUTES to set it all up, but it would work

502.

Solve : ^Z in batch file?

Answer»

my problem:

if you type at the prompt:

copy con <'filename'>
<'command'>

if writes a file with that command.
BUT
i want to MAKE a batch file that can do that..
FOR EXAMPLE:
say i want to make a SIMPLE batch file that will create another batchfile on the desktop with the 'dir' command.
if i was at the prompt i would type:

copy con C:\Windows\Desktop\filename.bat
dir

but when you type ^z (F6 cheractor) into a batch file it doesnt work...

please give me the exact syntax for the above project.There is no reason to insert a ^z into a batch file except when you use copy con to create it. That is nothing more than an end of file marker that tells DOS you are finished entering the file and to WRITE the file to disk.Ctrl-Z is ASCII 1A (26 decimal) EOF character, and is used in terminal communications to end a file create with COPY command. To create a text file in a batch like that, simply use

echo dir /a > c:\filename.bati do not to correct but

echo  dir  /c is the wrong switch

if anything  use
  echo  dir  c:\   > dirc.bat

or
   echo dir c:\subdirec >subdir.bat

503.

Solve : Play movie from bat file that can't be turned off?

Answer»

Does ANYONE KNOW what command I can use in a batch file to play a movie with Windows MEDIA Player (when a COMPUTER starts)  so the person cannot turn off media player and has to watch the whole video. Can anyone help?LOL, funny problem..  Try playing a more interesting video..  or disconnect the keyboard and mouse.your question reminds of of how the teachers went on and on in elementary school.

good grief!

504.

Solve : building complex cmd on one line?

Answer»

I want to build then execute a command in one LINE at a DOS prompt (i.e. storing in doskey, not a batch file).
The command will take a parameter from the command-line (i.e. %1).
The command will use the current directory (i.e. %CD%).

Here is what I want to do in multiple lines:
set varA=%CD:src=bin%
REM varA might now contain something like \usr\ms\devel\bin-test\com\cleancode\jdbc
rem Not sure about the next step. I want to truncate varA from \com onward,
where the stuff following \com may vary. Effectively:
set varB=\usr\ms\devel\bin-test
rem Then finally invoke this command:
javac -d %varB% %1
http://www.ss64.com/nt/doskey.htmlThank you for your reply. I will infer from your terse reply that you are SUGGESTING Doskey as an answer. It is not. I already use Doskey EXTENSIVELY. Doskey is useful once one has the command sequence in hand, which I do not.
Including your prompt, you can make a command line of up to 255 characters, I think the limit is.

You may wish to build a batch file with replaceable parameters (%1, %2, %3, %4, %5) and issue that instead.Let me restate the key points that have been missed by replies so far:
First, I want to create a one-line command (see subject line:-) using PIPES, etc. -- not a batch file (reason: I want to ultimately just create a doskey definition).
Second, I need to know how to set the value for varB from varA as discussed in my example, using some combination of DOS commands.

if %vara% == "string1" set varb = string2

You may end up needing to set the command up with both a DOSKEY macro and an associated batch file...I repeat my original requirement:
"varA might now contain something like \usr\ms\devel\bin-test\com\cleancode\jdbc. I then want to truncate varA from '\com' onward,
where the stuff following \com may vary [and put into varB]..."

So can this be done in DOS batch language or not?

505.

Solve : COMMAND NET USE?

Answer»

I USED the COMMAND NET USE LPT1: \\XXXXX to ASSIGN the port to a network PRINTER and It work succesfully but the PROBLEM is I dont Know how to cancel it and restart to print to another printer conectec directly in my Port LPT1 (locally) that is not a NETWORK PRINTER.net logoff should do it

506.

Solve : mysqld.exe does not run for me?

Answer»

Ok so I install the server for wow following DEVS guide and I GOT everything going right.. I even had the ENTIRE database extracted perfectly... But then I got a new database and wanted to redo the batch file.

So I go into Navicat and have to turn on mysqld.exe to logon to the Connection. I TRY and it does not work. The command prombt comes on and goes off quickly..., I also had this problem on my friends computer to install the server. Now it use to work but doesnt.. The only way to get mysql runnning is to use mysqlwinadmin but then once I try to do the batch file I get that error max packets. The only way to fix it I can see is too do run>c:\mysql\bin\mysqld --set_variable=max_allowed_packet=32M

Ive tried setting the variable to winmysqladmin but I dont think its working since the batch file got an error again when I tried to batch it. Ive also tried reinstalling mysql which in doing so ERASE my db so now I NEED to redo the batch file.

I need to be able to run mysqld.exe properly which is in the mysql folder under bin. Pls help.

"The command prombt comes on and goes off quickly" is the general problem.info>http://www.adventnet.com/products/simulator/help/getting_started/faq_general.html

507.

Solve : Where do i find ms-dos in windows 2000 Prof ??

Answer»

Hi

I am a bit of a newbie with COMPUTER and i am struggling to find MS-DOS on my computer, my pc runs on windows 2000 PROFESSIONAL and i have just installed a new Maxtor 120 gb hard drive into my computer and i want to transfer my full O.S system onto my new hard drive, i have already install the new hard drive, and when i am in windows and go to explore my computer, my new hard drive is not there, or there is no reference to it at all, i have downloaded a copy of norton ghost, and i was hoping to transfer my O.S onto the new hard drive as well as to partition the new drive into two SIXTY gb drives (whcih would i think make defragging a little easier as well) but i am struggling because i cannot find ms-dos please can anyone help me ??There is no longer an MS-DOS on Win2k or WinXP, that's why you can't find it.  Create a Win98 floppy boot disk, ADD Ghost and run from the FD.
http://www.bootdisk.com/

Does BIOS recognize new hard drive?  Did you remember to SET jumpers on old hard drive and new hard drive (master, slave).

Did you read the instructions that came with your new Maxtor hard drive?

508.

Solve : Changing from A:\ to C:\ after bootdisk?

Answer»

How do I Change from A:\ to C:\ when CD C:\   or CHDIR doesn't work?Typing:
a:
will change to a:\ and
c:
GETS back to c:\

HTH,
DEREK.

509.

Solve : Umm.. Copy..??

Answer»

I Seem to not be doig something right..?... hmmm
1. I am trying to copy a simple .BAT FILE to my desktop
2. that didn't work .. so i tryed copying it to any other place... But that didn't work either, I displyed the correct path and everything.. It must be something simple... HELP me if you COULD.. Thanks alot...copy "C:\directorytree\file.bat" "c:\windows\desktop"

The "quotes" are needed if your file path is not 8.3 compatible, and the file name(s) must be specified in the source parameter.

510.

Solve : For loop for running a batch file?

Answer»

Hiya. I'm running a script to automatically CREATE directories. The script so far looks like this:


***************************************
mkdir companies
mkdir candidates
cd companies

cat ../companies.cfg | perl -e "while (<>) {chomp;mkdir($_)}"

cd..
cd candidates

cat ../candidates.cfg | perl -e "while (<>) {chomp;mkdir($_)}"

cd..


*****************************

The candidates.cfg and companies.cfg simply contain the directory names to be CREATED in each of those to sub directories.

Anyway, this script needs to be run so the same directory structure appears in all the parent folders. For example

1/companies/directory 1
1/companies/directory 2
1/candidates/directory 1
1/candidates/directory 2

2/companies/directory 1
2/companies/directory 2
2/candidates/directory 1
2/candidates/directory 2

and so forth.

The parent directories (i.e. 1, 2, etc) have already been created. There are around 5000 of them.

What I need to know is how to autotmatically change to the different directories, run the script I have so far, then cd.. back to the parent and move onto the next directory.

Any ideas how?

JonYou're going to have fun using a for-in-do loop with EITHER a generic LIST of directories or the output of a dir command as its parameters. If you have previously made some of the directories, change all

MD TARGET

commands to

if not exist target\nul: md target

to prevent errors when creating directories.

511.

Solve : how to jump to a new line??

Answer»

i want to Verify and CHANGE the MSDE SYSTEM ADMINISTRATOR Password, so on windows support i found this:

Type the following COMMANDS, on separate lines, and then press ENTER:
  sp_password old = null, new = 'complexpwd',  loginame ='sa'
  GO
     
where i should replace "complexpwd" with the new strong password. but i don't know how to jump to a new line without pressing ENTER.....can you please help me

512.

Solve : Help on IF Command in Windows?

Answer»

Hello , I have a requirement whereby I am supposed to convert one unix script into NT.

The script is as follows:

Contents of zyx001f_touch.sh (Unix)

# ***********************************************************
# * script zyx001f_touch.sh                                 *
# ***********************************************************
test ! -f /usr/ftp/TD1/ftpwde/ZYX001F && touch /usr/ftp/TD1/ftpwde/ZYX001F
pwd

As PER this script this will check if there EXISTS a file ZYX001F , if the file does not EXIST then it will create the file in this directory.

Can anyone convert this unix script into NT for me .

Any help will be appreciated.

Thanks and Regards

Arigato.http://ourworld.compuserve.com/homepages/efjohnson/perlwin.htmHello ,

          I could not find out the solution to my problem on the site mentioned by you.

Can anyone translate the script for me in the WINDOWS nt environment.

The script SIMPLY wants to check if t he file ZYX001F exists and if does not exist then it creates new file.


Any help will be appreciated.

Thanks and Regards

Hitesh Desai
Try this:





ECHO OFF
:PROCESS_0
CLS
MD c:\ZYX001F\
if ERRORLEVEL=1 GOTO PROCESS_1
if ERRORLEVEL=0 GOTO PROCESS_2

:PROCESS_1
CLS
ECHO.
ECHO                HotShot - 2004
ECHO   ------------------------------------------
ECHO.
ECHO          The folder "c:\ZYX001F\"
ECHO            was ALREADY created
ECHO.
ECHO   ------------------------------------------
ECHO.
PAUSE
GOTO END

:PROCESS_2
CLS
ECHO.
ECHO                HotShot - 2004
ECHO   ------------------------------------------
ECHO.
ECHO            The folder "c:\ZYX001F\"
ECHO               was created - NEW
ECHO          as it did NOT exist previously
ECHO.
ECHO   ------------------------------------------
ECHO.
PAUSE
GOTO END

:END
EXIT
if exist c:\usr\ftp\td1\ftpwde\zyx001f.* goto present
echo Starting new file > c:\usr\ftp\td1\ftpwde\zyx001f.
echo New file created
pause
goto end
:present
echo File already present
pause
:end


Like this?

513.

Solve : telnet from a batch file?

Answer»

I was able to set up a batch file to open a telnet session, but I still have to type in my username and password for the session to actually start. Is there any way to set up the batch file to automatically enter my username and password?

any ideas or solutions are welcome.

Thanks.you can solve this problem by writing a seperate SCRIPT(not  a batch file) i.e a simple text file which contains your username/pwd and any other automated steps and referencing this script from your batch file.

here is  an example i used to FTP files to another server

ftps -c:600 -t:600 -s:PutNewFiles.txt
DEL *.txt
del *.blk
del *.mpg


In the above example, "PutNewFiles.txt" is a txt file that  has the following information

open 192.168.2.xxx
username
password
bin
ls
mput st*.zip

when the batch file is run and the ftp starts, SINCE the batch file gives CONTROL to the ftp PROGRAM, the script is used to carry out ftp functions and control is passed back to the batch file once the ftp  is complete

514.

Solve : Batch or Command to set computer time remotely...?

Answer»

I'm working on a small network (~8 computers) that is not connected to the internet. We are developing this network with two servers and a datalog computer. Recently I've been working on ensuring the time on all the computers is synchronized.

I have all the computers now synching together at 4am everyday via Microsoft Scheduler that simply runs a batch file on every computer that contains the command:

Code:
 
net time \\datalogcomputer /set /ysimple enough and works.

But now I want to create a file that can sych all of the computers manually. So that from any computer I can run the batch and have them all sync up. I've been looking around and can't seem to find anything that can push the time onto networked computers. Even trying to run the "net time" file simply syncs your time with the datalogcomputer not the remote one.

Does anyone have any suggestions as to how I can accomplish this?

Please help.
THANKS. Have you already looked at the MS KB? This kind of thing was resolved some time ago. Is there some reason you can not use the RECOMMENDED solution?
Article ID: 307897 - Last Review: October 18, 2007 - Revision: 1.10
How to synchronize the time with the Windows Time service in Windows XP

Quote

If the computers belong to an Active Directory domain, the Windows Time service configures itself automatically by USING the Windows Time service that is available on domain controllers. The Windows Time service configures a domain controller in its domain as a reliable time source and synchronizes itself periodically with this source. You can modify or overwrite these settings, depending on your specific needs.
After reading you post again and again, It seems you want to set the time on all computers from none console. There requires a remote execution program. For XP  you could use:
Rexec
Runs commands on remote computers running the Rexec service (daemon). The rexec command authenticates the user name on the remote computer before executing the SPECIFIED command. Windows XP and Windows 2000 do not provide the Rexec service. Used without parameters, rexec displays help.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rexec.mspx?mfr=true

You will have to find it and install it on .your computers.
http://www.theether.org/rexec/
Sorry I can not help you with using Rexec. Please read the links abut. It is said to work onX P, but is not part of the regular XP tools. You have to download it and install it.
Alternate:
http://www.codeproject.com/KB/system/remoteexec.aspx
515.

Solve : Network Access?

Answer»

Hey All

I am new to MS DOS so this question may not have an answer or is just a stupidly straight forward.

My current ISSUE is that I am running a 80 machine windows render FARM.

The task of copying new Plug ins on to the farm is now becoming very laborious.

Are there any commands available with in the DOS prompt that will allow me to access the render farm MACHINES via a dos prompt.

I am unable to map all farm machine drive to my work station, so the hope is to be able to access these machines via UNC or by another approach.

Adam

516.

Solve : MS dos commands, deltree ??????

Answer»

Is there a dos command that I can PUT in a batch file to do the following?

Delete a directory and all its subs by only indicating part of the directory name.
Ex- C:\cisg_proc_041904 (created USING xxcopy)
The example has a different date (041904) each time it is created. Want to be able to automatically delete the directory with the OLD date.deltree "C:\cisg_proc_???"

if the above does work you might look for an old version of norton utilities for dos..  I believe it provided a means to delete a directory using wildcard characters.  sorry forgot to TURN the tennis ball faces off.

deltree "C:\cisg_proc_??????"you might be having trouble with the long DOS names

i believe you can

look at           deltree C:\cisg_pr*.*
and i believe that  it will work for you I think scruge has the correct syntax, but a word of caution. Make SURE the new directory is not created BEFORE the deltree command. Do not allow the batch file to recurse, and build in some error checking so that the new directory will not be accidentally deleted. Also, make sure you do not have other directories with similar names - beginning with C:\cisg_proc_The deltree command is absent from stock NT/2K/XP DOS emulator. In Win9x, it is available.

Use "quotes" if your file names are not 8.3 valid ones.

deltree "c:\cisg_proc_*.*"

The command creating the current directory should follow this.

517.

Solve : need help coping directory?

Answer»

I'm trying to copy full DIRECTORIES from DOS but it will only copy the files in the directory and not the subdirectories.  

copy *.* (destination)
doesn't WORK.  I also tried the full path name.

If ANYONE can help thanks a lot.use xcopy instead. at the dos PROMPT type xcopy/? for options.xcopy *.*/s    C:\whatever

will copy all the files plus the subdirectories.

518.

Solve : exiting dos?

Answer»

i have a DOS program that will exit back to windows on one pc (a compaq) but on my dell pc it will not exit back out . It goes to a black screen and then i have to shut down the pc.......can any one tell me how to fix this.

I tried changing config/autoexec
tried writing a diff batch file

nothing worked please help
Do you have a DOS prompt (like C:\>) in the 'black WINDOW'? If so, type exit to return to Windows.

c:\>exit (enter key)

Try a key combination like Control-W to force screen refresh. And go into your video PROPERTIES, Screen Saver tab, and disable all 'screen saver' functions, and see if that changes anything.

You may have to set properties of your graphic or display adaptor in Device MANAGER to reset the display on mode changes.

519.

Solve : Creating within a Batch File?

Answer»

In order to help do some error trapping I require the ability to create a file from within a .BAT file.

Tried looking at the usual DOS commands and cannot FIND one that allows you to create a file.

Any ideas would be Great.

Thx.take a look at ">" and "copy" for file creations.
this will work for what I think you want to do
make a batch file CALLED,  makefile.bat

echo off
cls

echo  HIT the enter key when you are finished
echo  then hit the f6 function key
echo  then enter
echo   the file formed here is called   myfile
echo  you might want to RENAME it  or else next time
echo you RUN this it will be overwritten

copy con  myfile

520.

Solve : How can i run a batch file minimized in xp?

Answer»

HI all
How can i run a batch FILE minimized in XP??
any help WOULD be appreciated.
ThanksI think that XP will still generate a PIF when you right click the BAT file and set the PROPERTIES. There will be an option to run MINIMISED. Then KEEP the PIF with the BAT...

521.

Solve : .PIF HELP?

Answer»

How would I go about opening a .pif in DOS .pif FILES are not intended to be opened or used in DOS. They would serve no useful purpose. PIF means program information file, and is intended to pass information to windows about DOS programs how they should be run. To run a DOS program under DOS, navigate to its directory, type the name of its startup command, and press enter.Is there a way to create a file that I COULD open in DOS that would act like a shortcut so that I do not have to navigate to the desired FOLDER to open the exe?The closest THING to a shortcut in DOS is to create a batch file and save it in the root directory. The batch file can change directories and launch the program for you by entering the batch files name at the DOS prompt.Actually, that DOS batch file can be in any directory in PATH. It doesn't have to be in the root.

Type SET to see what your ENVIRONMENT is in DOS, including PATH.

522.

Solve : Hidedos.exe?

Answer» HI there,

How do I use the Hidedos.exe command in a BATCH file so I can run the file on a PC without a DOS screen popping up?

Cheers!maybe adding this to the bat file will do it

SET DIRCMD=0http://www.networkd.com/newsjune.htm

This showed up when I used a (gasp)search tool, specifically www.alltheweb.com. Google also works.
523.

Solve : Re: start-up in DOS?

Answer»

There is no DOS on Win2k.If you are using FAT32 FILESYSTEM, USE a Win98SE boot disk (www.bootdisk.com). If you are using NTFS, burn a KNOPPIX LiveCD, as there is no DOS mode in NTFS.

524.

Solve : errorlevel in windows ???

Answer»

Hi all, i WANT to KNOW if when i call an APPLICATION with start /wait "appname", and "appname" is a WINDOWS app, it sets errorlevel to 0 if it finish sucefully an other value if it fails ??It should... but you'll have a time TRYING to do anything with errorlevel from Windows... You would have to make test statements in DOS and use them to build a file for Windows to respond to.

525.

Solve : Renaming a file to today's date?

Answer»

I am trying to rename a file to include the current date.  So I want to rename the file myfile.txt to myfile08262004.txt.  I am writing this program that will create this file every month and put it out in a DIRECTORY.  Once it is there I am using DOS to rename the file to the current date and then FTP to a server. I can't find a way to rename my file to the current system date..can anyone help??

Thanks in advance!check the thread "whos an expert with dos?" ... same issueHave a look at this
rem *** Moves JFMOVE to E:\JFBACKUP\Raw_Data and renames it as the System Date and Time ***
----------------------------------------------------------------------
Move E:\JFBACKUP\JFMOVE "E:\JFBACKUP\Raw_Data\%date:~4,2%%date:~7,2%%date:~-2,2%%time:~0,2%%time:~3,2%"
------------------------------------------------------------------------
Have study of this lines I used in my Batch. That's the working format for me.

Cheers!
Willzuse the copy command (many parts to this powerful command)

copy oldfile +,,


thats it!  you may be prompted to overwrite the oldfile.
say yes.  if your anxious about it copy it to a DIFFERENT directory
and try it thereWell I live the UK and all my system dates are in UK format, so for those of you (like me) who NEED it simple:

Code: [Select]MOVE "c:\myfile.txt" "c:\myfile_%date:~0,2%-%date:~3,2%-%date:~6,4%_%time:~0,2%-%time:~3,2%-%time:~6,2%-%time:~9,2%.txt"

The line above will RENAME "c:\myfile.txt" to "myfile_24-11-2004_12-48-04-39.txt"

HOPE this helps SOMEONE else.

PS -  can't find the old thread, mentioned above.


526.

Solve : Using IF in a batch file?

Answer»

I want to create a batch file that starts out by CHECKING if a certain file exists. If the file exists then the rest of the batch file will run, if not it will exit: Like this

If file exists
do CODE
Else
Exit

Can anyone tell me what syntax I would need for this ?

thanks in advance

DanIf not EXIST <path><filename> goto :none
[code to executed]
goto :END
:none
echo File does not exist - no action taken
:end

If you want to GET fancy, you can keep the message on screen for x number of seconds and exit automatically. For immediate termination, simply type exit following :end

527.

Solve : Is this Possible....?..??

Answer»

I have a good question... I HOPE...
OK...
Is It possible to activate a batch FILE from a different computer.. In anyway..?..?...?...?

Thanks For your help...remote access....like radmin...WAIT.. what..?.. U''ll have to explain it to me...http://www.famatech.com/

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

528.

Solve : Formating?

Answer»

Now me using window ME
1. How can i get in to Ms Dos?
2. How can i format without using cd-rom and floppy?
got any choice?the f8 on boot will take you to the the command PROMPT...but have you the install disks?and what make is this pc...some have RECOVERY disks?

529.

Solve : Remote open of cd-rom, how??

Answer»

Does ANYONE KNOW how to remotly OPEN a cd-rom through ms-dos?http://www.zarr.net/vb/download/codedetail.asp?code=26

530.

Solve : Help, How to make a new folder with batch file?

Answer»

Well im new to dos, and im trying to make an bach file for a auto start cd, that im working on.  when the auto cd opens up it first opens the bach file.  

I cant seem to figure out how to make a new folder (called ranger) APPEAR on the C:/ drive.  

Then i need to transfer a folder and all of its contents to c:/.(called ranger1)  from the CD.

I was able to GET all the files to transfer from the CD to the C:/ but not in the folder(ranger1)

Can anyone help


While editing your batch file:

MD Ranger (makes a directory called ranger)

Copy D:\Directory\filename C:\ (Where D:\ is your Disk Drive and C:\ is the root of your HD)

HOPE that helped.

Jif you are operating from a CD in drive D and you want to copy files from it  use this as an example

say the folder you want to copy is called copythis

and the folder you want to copy it to on the c drive is called. tohere

you cannot just put the command  MD, but rather

md  c:\tohere

you do not see anything at that point

then it would be visually logical to you, although not necessary to change the directory on your D drive by

cd \copythis

then ISSUE the command  copy  *.* c:\tohere

if there are subdirectories in copythis
use the command  xcopy *.*/s   c:\tohere and all the subdirectories will be copied with all their contents

531.

Solve : how to send messeges...?

Answer»

hey, I open comand prompt and type in

net send

but then it says, ERROR!

network allias not found.

please TELL me how to send messeges throught this, im hopeless, as shown by my name really.Ok. I take it that you're on a network with other computers... lol. Have you asked your Network ADMINISTRATOR? Did you type in the correct IP address? (They change very often)

[glb]Flame[/glb]no im at home no link to other comps thats why im confused,So you are NOT connected to any other computers..... If you are then your home network is not setup properly....


[glb]Flame[/glb]Ok. I just thought more about it, and I don't think it's possible for you to send a message to someone ELSE unless you are in a netowork with them. If you want to chat with someone from another computer (not connected to yours), then use AIM, or Yahoo! Messanger. Both are FREE, and easy to use. ( I use 'em)

[glb]Flame[/glb]yah ive used the net send at college using user names, i wanted to send over the net too bad.

i was told its possible, *censored*.

i just want to send to an ip to mess with ppl

and secure messege.kool. lol. Maybe the person using that IP address has a firewall on...

Good Luck!
[glb]Flame[/glb]You and your friends would benefit from LEARNING about and using IRC clients.

If you want to use those soggy 'instant message' clients, Yahoo and MSN are the least obnoxious. Avoid AOL Idiot Messenger.

532.

Solve : executable bat file?

Answer»

I'm trying to map a DRIVE and then execute a file in that drive using a batch file.  I'm SURE it's relatively simple but I can't figure it out.  Suggestions anyone?

Thanks
BruceECHO Trying to open an .exe
Pause

net use *\\UNC\sharename
Call C:\path\file.exe

533.

Solve : Running Dos On XP?

Answer»

I know that Dos can't run on xp but there is ways you can. Simply get a boot disk for 98, and you can run dos programs on xp with a full fledged msdos. But my question is, I have a program that accesses a .exe that runs in msdos. Now you have to run one program in windows and when you HIT start it runs the other .exe in msdos. You CANT access the .exe by itself because it needs the windows program to drive it. So what I want is the ability to run the one program in windows but when I hit start I want that .exe to run from the boot disk with msdos on it. Any info is super greatly appreciated. and if its not POSSIBLE please say so. Thanks ALOT

Lenny Quote

I know that Dos can't run on xp...


Not true anymore.  See this.
I want to running DOS on XP
Quote

Not true anymore.  See this.

DOSBOX works on Windows.

And Computer Commando, did you get that link from me? I have been digging around on the dosbox link, I have been there before and downloaded it.   But it seams to be all in outerspace with no identity.  For Windows XP ?Try and prey ?  Did you read its instructions on how to set it up? You need to do a little work to set it up... it doesn't just MAGICALLY click into work, unfortunatly.
534.

Solve : Upgrading MS-DOS?

Answer»

Hi

I am pretty new to ms-dos, so don't shoot me if this question sounds rather stupid

but is it possible to upgrade MS-DOS (prompt) or even install a new version

You see, I have a LAPTOP with Xp and a DESKTOP with Me and the dos VERSIONS aren't the same, so every batch file I MAKE is useless on the other computer.

Thanks
-xxx-jes
Svetlana


Hi Svetlana.

Win.XP does not "have" Dos just a Dos emulator so not all of the batch programming commands are AVAILABLE or work in the same manner as other Win versions which are fully Dos supported.  This is a problem for all batch programmers.

I think that if you write your batch script in XP there is a chance it will perform in ME but no guarantees

D...

535.

Solve : Copy files in order by size?

Answer» HELLO!

I'm using the dos FOR command to copy some files from one directory to another. This files are being copied by directory order, but I'd like to copy the files in order by size or in order by name...

I've tried to use dircmd=/os variable, but it doesn't work.

Anyone knows how to do it?

Thanks,

W Fischeryou might try sorting the files before you copy.. some of the old norton utilities could sort a directory by file, type ,size, attribute.
i daily use a file i got once in a MAGAZINE called pc computing, called  'dirmagic.com'

it is extremely small but can do  many not so simple things.

i sort my directories by size or extension or date after i create a directory to store the sorted files.

then i either highlight specific ones or the whole direction and copy those files to the new directory.

the author of the file   Michael J. Medford.

thank you , Michael for the hundreds of hours of joy you have afforded me.

i do not know what the rules are for sending this file. i cannot find a reference to it on the internet,; was freeware and if some knowledgeable PERSON can tell me about the legalities, i WOULD be HAPPY to send it out. the file was written in 1988

I have a similar thing called PFM (Personal File Manager) and an accompanying text edittor called E88 that I have been using as DOS add-ons since the mid-80s. There are probably later versions out, but these are minuscule EXEs and were nice because they fit easily on a floppy. They have been serving reasonably well into Win9x...
536.

Solve : delete by file size only?

Answer»

is there a way to delete files by size

ie:
delete *.zip   /size=34kb
or /size/between=(33000 and 35000)No.yeah you CANT, you have to remove individuali use dirmagic.com

it was created in 1988

i STILL use it daily

it is a DOS program, written by Michael J. Medford
for PC Computing magazine.

i simply call up the DIRECTORY and hit the F9 key. the files are sorted by size. i individually mark the ones i wan to delete and hit the f2 key...all gone

wincmd ALSO does the same THING

537.

Solve : Dos 7.10?

Answer»

I printed out history of dos.
It shows last ver was ms-dos 6.22 released April, 1994.

My question what is Dos ver 7.10
When was it released.

Please help me to understand this. Is this a possible phony version.

Thank you Ed miller > [email protected]It's legit.  It's DOS from Win95/Win98.
http://www.mwpms.uklinux.net/page1.htmMS.Dos.7.10 is alive & kicking and is no phoney version. Look here.

http://newdos.yginfo.net/msdos71/index.htm

and/or here

http://scp.gmxhome.de/msdos71/index.htmStill-breathing, major commercial DOSes (not freeware).
MS-DOS is no longer sold by MS. Also, MS has apparently shut down its FTP site, once a source for FREE v6.22 updates, supplements, etc. Some files are still AVAILABLE online at other ftp sites - try a search for anything you need.
IBM PC DOS 2000 (PC DOS 7.0 with Y2K fix). If you are WILLING to pay for a DOS, this one is still available and worth considering. Have a look at its feature set, at IBM's PC DOS page. If you already have v7.0, get the free Y2K fix, in 14 LANGUAGES, at the Y2K Fixpak page.

538.

Solve : Trouble with DOS Boot Disk from Win 98 SE?

Answer»

Sorry, I posted this in the Windows Forum as well, as I wasn't sure which was most appropriate.

I've been attempting to create a BOOT disk to DOS in order to play my old DOS games.  I think that I have most of it figured out, but for some reason it will only recognize the floppy and CD drives, but not the hard drive, which means that I don't have access to the games themselves.  I've put most of the essentials on the boot disk itself, such as EMM386 and HIMEM because my computer won't recognize them on the C: drive.

When the disk first starts to load on restart it will say "Loading Win 98" or something to that effect, and then proceed to load my commands from the Autoexec.bat and Config.sys and then remain in DOS, with only the A:, D: and E: drives available.  The boot files are as follows:

Auotexec.bat:
PATH=C:\WINDOWS
SET BLASTER=A220 I5 D1 H5 P330 T6
REM LH A:\SBEINIT.COM
LH C:\PROGRA~1\CREATIVE\SBLIVE\DOSDRV\SBEINIT.COM
LH A:\MSCDEX.EXE /D:12345678 /L: D
LH A:\MOUSE.COM

Config.sys:
REM DEVICE=A:\HIMEM.SYS
DEVICE=C:\WINDOWS\HIMEM.SYS
DOS=HIGH,UMB
REM DEVICE=A:\EMM386.EXE RAM 3072 I=B700-B7FF
REM DEVICE=A:\EMM386.EXE NOEMS
DEVICE=C:\WINDOWS\EMM386.EXE NOEMS
FILES=30
BUFFERS=30
DEVICEHIGH=A:\OAKCDROM.SYS /D:12345678  

I've REMmed out most of the A:\ commands in order to try accessing them from the Hard Drive, but that's exactly my problem - it doesn't see it.  Is there any way that I can Dos to recognize my hard disk in order to boot using those files, and so I can actually access the games and my soundcard?

Any help would be much appreciated.  Thanks!forget the bat files just load the floppy disk..and run it..and if you want to be  flash drag the CONTENTS of the floppy to the c:\drive..or dir call it  dos game or WHATEVER you want to call [email protected]Look here:  http://dos.rsvs.net/DOSPAGE/CONFMENU.HTM
http://www.shiningstar.net/geek/html/multiconfig.html

BTW, with Win98, do you know how to boot to DOS on computer STARTUP?

Choose a Forum to continue.
I would use F8 (tap the F8 key as the system starts up) and boot using the Command Prompt option. To recognise CDROMs, you may need to add the OAKCDROM.SYS line to CONFIG.SYS and the MSCDEX.EXE line to AUTOEXEC.BAT, but otherwise it should work fine with the existing files on your C drive.

If you have DRIVER contentions when you try to do this, make up a couple of batch files to swap MSDOS.SYS, AUTOEXEC.BAT, and CONFIG.SYS to allow you to swap these files in and out at shutdown. You would have a couple of subfolders C:\Restart\DOS and C:\Restart\WIN with each having the appropriate trio of files in it, and the batch files would be DOSSTART.BAT on the desktop to issue 'copy c:\restart\dos\*.* c:\' and a restart script, and WINSTART.BAT in the C:\ (root) directory to issue 'copy c:\restart\win\*.* c:\' and a utility like WARMBOOT.COM. Don't forget to remove the write protect, hidden, and system bits on the three files in the root directory.

Setting the MSDOS.SYS line BootGUI=0 will cause the machine to boot to DOS 7.1 command line. Setting BootGUI=1 allows Windows to boot. This way you don't have to use F8...

539.

Solve : Opening Files [advanced]?

Answer»

Okay, i'm making a bat file and I need to open two .txt files at once INSIDE windows XP, is there an arguement that I can pass such as Bash's '&AMP;' character? Thanks for any help. Also, below is my batchfile, any suggestions for additions would be appriciated. Specifically, i'm trying to open pid.txt and netstat.txt at the same time so the user can compair the files and find out which program is involved with which PID.

echo off
title Net Diagnostic
cls
echo Running.....
echo }---------------------------------------IPConfig----------------------------------------------{ > "%windir%\netstat.txt"
echo     ....ipconfig
ipconfig >> "%windir%\netstat.txt"
echo. >> "%windir%\netstat.txt"
echo }----------------------------------------Netstat-----------------------------------------------{ >> "%windir%\netstat.txt"
echo     ....netstat -ano
netstat -ano >> "%windir%\netstat.txt"
echo. >> "%windir%\netstat.txt"
echo ------DONE!------
echo This window will close when
echo you close the txt file. Please
echo do not MANUALLY close this
echo window as it has several
echo other FUNCTIONS to perform.
echo. >> "%windir%\netstat.txt"
echo }--------------------------------------------------------------------------------------------------{ >> "%windir%\netstat.txt"
echo }----------------------------------------PID-List-----------------------------------------------{ > "%windir%\pid.txt"
tasklist >> "%windir%\pid.txt"
"%windir%\netstat.txt" %
"%windir%\pid.txt"
del "%windir%\pid.txt"
del "%windir%\netstat.txt"
cls
exitthis may seem a bit primitive but i think it will solve your problem

i just tried it on my win98 platform

i have two txt files,    file1.txt     and   file2.txt

i use the echo command to create the bat by using two  >

here is how
echo  notepad  file1.txt  >> showtwo.bat
then
echo  notepad  file2.txt  >> showtwo.bat

your batch file will now look like

                notepad file1.txt
                notepad file2.txt

then just  type and enter   showtwo
and you will get both files to open in notepad

   
I use Rogsoft Notepad+ and can simply open two TXTs in the Notepad+ session on my Win98 box. (Notepad+ is a freeware replacement for Windows Notepad on Win9x machines).not so primitive if you want your user to be ALLOWED two input files, say input1.txt and input2.txt

make a batch file with the following two lines


notepad %1.txt
notepad %2.txt

name the batchfile    open2.bat

then say the user wants to open  mildew.txt and  yooo.txt

the use simply types

open2   mildew   yooo  
(mind the spacing)

540.

Solve : Checking if files are non contiguous?

Answer»

Hi Friends ,

Can SOMEBODY please help me to know How can I CHECK if the any files are non contiguous(fratmented) on a DISK through batch file commands

I will be very thankfull. Quote

Hi Friends :),

Can somebody please help me to know How can I check if the any files are non contiguous(fratmented) on a disk through batch file commands

I will be very thankfull.

Hi!

By using the command CHKDSK.

CHKDSK filename

That's it.it really depends what PLATFORM you are using

i use win98 and at the dos prompt i simply type and enter    defrag

it connects all the defragmented PARTS. then you will knowscandisk /fragment [file name/path]

eg scandisk /fragment example.txt
541.

Solve : trying to find an old system.ini on my computer?

Answer»

i need helpmore info  >msconfig in the run BOX?what platform are you using.

in WIN98 you will FIND it in the WINDOWS directory called

system.bak

542.

Solve : ILLEGAL INSTRUCTION?

Answer»

How do i get rid of this problem.  This keeps popping up on my screen and no matter what i do it still come back.      16 BIT MS-DOS Subsystem.  C:/WINDOWS/SYSTEM32/2mdsrch7.exe The NTVDM CPU  has incountered an illegal instruction.  CS;053d IP:0112 0P:8f 94 96 Choose "close" to terminate the application.   There are twe chocies to click on close and ignore i have click on both and it GOES away for less the a min. and pops back up again. i am just a novice when it come to computer so any help at all WOULD be great to get rid of the problem. Also computer run real slow.  help please if you can   Thanks to All that Reply              scan for TROJANS etc...and read more here>http://www.techspot.com/vb/showthread/t-5039.htmlAre you rounning an old DOS programme.  NTVDM is the windows virtual DOS machine SUB system

http://search.microsoft.com/search/results.aspx?st=b&na=88&View=en-us&qu=ntvdm

http://support.microsoft.com/default.aspx?scid=kb;EN-US;314106

543.

Solve : command to run a file using the program name?

Answer»
i have forgotten...it has been so long.

i want to put a DOS command in an autoplay.ing FILE that will CAUSE ADOBE READER to read a specific file on the current cd.

it is something LIKE    adobe.exe  filewhat.pdf

does anyone KNOW how to do this?
544.

Solve : Multifunctional batch file help?

Answer»

Hi Everyone

I am fairly new in batch file SCRIPTING. I have a problem that i have been working opn since last 5 days but I cannot figure how to do it.  

I want to create a bach file. LETS say it is named extra2.bat.

Then it should use replaceable parameters so that the user may choose what file extensions to display.

Allow any existing files to be copied to a new file that the user names.

Display the contents of the newly CREATED file.

Provides a way for the user to change their mind and not to delete any files i.e. ask them for confirmation.

Use a SET of batch files and a menu text. extra2.bat would simply be a command to start the THING off:

echo off
cls
type menu2.txt


Menu2.txt would be a list of the available commands:

1) Copy file to new name, type 1 oldpath\oldname.ext newpath\newname.ext

2) Display file, type 2 path\name.ext

3) Confirm selection, type 3


Then you make up batch files 1.bat, 2.bat, and 3.bat.

1.bat is a sample:

echo off
if exist %2 goto error
copy %1 %2
goto end
:error
echo Destination file already exists, choose another destination name. Press a key.
pause
:end
extra2


You'll figure out the other two...

545.

Solve : DOS: PATH cmd to run EXE files - DLL file reference?

Answer»

I am trying to run an EXE (within DOS) from a directory that doesnt have the EXE in it.
So I use the PATH C:/.... command to 'reference' the directory where the EXE file is located.
DOS is then able to find the EXE file to execute.

Unfortunately the EXE file doesnt work PROPERLY, as it can't find DLL files it needs (which were also in the'referenced' directory, and not in the directory I am running the EXE file from).
I cant edit the EXE file as it is a commercial software program.

Is there any way around this? or is the only answer to copy the DLLs into the directory I am running from?

Hope that makes sense. Is there any reason why you can't cd to the directory the .exe is in? I.e.

Code: [Select]cd "c:\program files\someprogram"
start someprogram.exe
Quote from: cmpmike on October 12, 2011, 04:35:37 AM

Unfortunately the EXE file doesnt work properly, as it can't find DLL files it needs

If an exe file requires a DLL or DLLs Windows Windows first searches the set of pre-installed DLLs such as the performance library (KERNEL32.DLL) and the security library (USER32.DLL). Windows then searches for the DLLs in the following sequence:

    The directory where the executable module for the current process is located.
    The current directory.
    The Windows system directory.
    The Windows directory.
    The directories listed in the PATH environment variable.

So put the DLL or DLLs SOMEWHERE where Windows can find them.
Sounds to me like a paid app is being re-engineered to be made to run...
What app is this and why does the .exe not exist in the app folder ? ? Quote from: cmpmike on October 12, 2011, 04:35:37 AM
I am trying to run an EXE (within DOS) from a directory that doesnt have the EXE in it.

Why?
Why? - I need to run the EXE file from a job specific directory as it creates a heap of files in the root directory.
CD to directory? - same as above.
Using Path command? - this is in the MSDOS operating environment, not windows.
App specific? - it is a specific stand along app with one EXE file and a heap of DLL files, I dont want to mess up the softward directory with a thousand job files.

Does anyone have an answer? or Is it simply not possible.?With all of the restrictions you have described, I'm going to say you're looking at a not possible here. It MIGHT work if you could set up a dummy file and use the assoc and ftype commands to start the program from it's directory, but you are looking at a long shot and I'm pretty sure that isn't going to work either. I would stick with your original answer and copy the .dll files to the job specific directory. Write the batch file to delete the .dll files when done. That's about the best you can do at this point.Given the parameters at work here i don't think we should be assisting... Quote from: Salmon Trout on October 12, 2011, 10:46:40 AM
pre-installed DLLs such as the performance library (KERNEL32.DLL) and the security library (USER32.DLL).

Kernel32 is the base API (memory management, forward declarations to ntdll.dll). user32 is user interface stuff (Window and desktop management, arrangement, the default window procedure, etc).

Aside from that nitpick though the  actual order is CORRECT. Although...

Quote
Using Path command? - this is in the MSDOS operating environment, not windows.
What does this even mean? If it is a DOS program that uses overlays or DLLs than it doesn't use the windows search order and typically only searches in predefined locations, almost always only the current directory.
Quote from: cmpmike on October 12, 2011, 04:42:29 PM
Using Path command? - this is in the MSDOS operating environment, not windows.

MSDOS doesn't use DLLs. You must be talking about Windows command line environment.

Quote from: BC_Programmer
Aside from that nitpick though the  actual order is correct.

Blame Microsoft - that's where I copied it from!

http://msdn.microsoft.com/en-us/library/7d83bc18%28v=vs.71%29.aspx

Quote
Search Path Used by Windows to Locate a DLL

With both implicit and EXPLICIT linking, Windows first searches the set of pre-installed DLLs such as the performance library (KERNEL32.DLL) and the security library (USER32.DLL). Windows then searches for the DLLs in the following sequence:

    The directory where the executable module for the current process is located.
    The current directory.
    The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
    The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
    The directories listed in the PATH environment variable.

        Note   The LIBPATH environment variable is not used.
Quote from: cmpmike on October 12, 2011, 04:42:29 PM
Using Path command? - this is in the MSDOS operating environment, not windows.

Both Windows command line and MS-DOS - they are not the same thing - use the PATH command, so I'm not sure why you wrote that.

What version of MS-DOS are you talking about? You can check this by typing VER at the prompt and hitting Enter.

Quote
Does anyone have an answer?

Best not to post remarks like that, no matter how impatient you are. The level of joining and posting fees you paid determine the level of service you are assured of getting.

Quote
or Is it simply not possible.?

Is it almost certainly possible but we need better and more accurate information from you. It is certainly interesting that you refuse to say what the software application is.
Quote from: Salmon Trout on October 13, 2011, 12:00:49 AM
Blame Microsoft - that's where I copied it from!
I know. Surprised they haven't fixed that yet.
546.

Solve : FOR command starting with double quotes.?

Answer»

I have a simple batch command that wants to capture a program's output.  It works fine when used directly:

Code: [Select]FOR /F %A IN ('someprogram.exe "argument 1" "argument 2" "argument 3"') DO ECHO %A
However, I'd like to include an absolute path to someprogram.exe, which means using a quoted path.  This doesn't work:

Code: [Select]FOR /F %A IN ('"C:\Program FILES\someprogram.exe" "argument 1" "argument 2" "argument 3"') DO ECHO %A
The result is:

Code: [Select]The filename, directory name, or volume label SYNTAX is incorrect.
I've tried this with usebackq, but that produces analogous results.  I've also tried escaping the double quote with a caret (^).  This works fine for the arguments, but doesn't work when used around the program name.  I've also tried running it through a CMD /C but that also doesn't like a starting quote.  Does anyone here know the answer to this problem?Your best bet in a situation like this is setting the absolute path to a variable prior to the for command and using the variable in the for line.

Code: [Select]set someprogram=c:\Program Files\someprogram.exe
...
FOR /F %A IN ('%someprogram% "argument 1" "argument 2" "argument 3"') DO ECHO %A
THANKS, but that doesn't help, either.  I get the same results whether I use variables or not.  This is on Windows 7.Now I know some or all of this you have probably checked out, but I've been taught not to assume anything. Have you checked the file path and made sure that the program (not a shortcut, but the actual program) is in the file path location you are setting? Are you using the correct slash (\) in the file path (it does happen, more often than most would like to admit)? Are you sure you are typing the correct extension?

If all of these issues check out, then I would propose that you simply do a change directory command and get to the directory you are wanting then using your original line.

I tested out my proposal below, and I was actually able to accomplish what you are wanting to do here. This was what I typed in to the command prompt, and the output I received.

Code: [Select]c:\>set prog=c:\users\user\desktop\batch\Passing variables\arithmetic2.bat
c:\>for /f %A in ('"%prog%" 5 4') do echo %A

c:\>echo 9
9

I am also using a Windows 7 command prompt so my suggestion would be to either use the variable within the quotes as shown above, or to thoroughly check your other areas and make certain that all of the above issues are indeed addressed.

The other possibility is that this is the output from the program you are running. Try running the program with variables through the command prompt and see what output you get. At this point, it is DIFFICULT to troubleshoot the problem because it isn't apparant where the problem is.Thanks, the command I am trying to execute works just fine when run outside of the FOR statement.

I do see a slight difference that seems to be significant.  I can get your line to work:

Code: [Select]for /f %A in ('"%prog%" 5 4') do echo %A
However, several of the arguments to my program also need to be quoted.  Does this work for you?

Code: [Select]for /f %A in ('"%prog%" "5" "4"') do echo %AThat did not work, however the error I was getting was different from yours. It did spark a curiousity in me though, and I tried the following with success:

Code: [Select]set prog="c:\users\user\desktop\batch\passing variables\arithmetic2.bat"
set arg1="5"
set arg2="4"

for /f %A in ('"%prog% %arg1% %arg2%"') do echo %A

c:\>echo 9
9

For some REASON, the cmd prompt would not pick up the first double quote, and would therefore not run the program. I would imagine that if there are no spaces in the file path to your program, then it ends up running but without all of the parameters being passed to it, thereby generating the error you are getting. By essentially setting up a double double quote, the cmd prompt sees what we are wanting it to see and passes the correct parameters. I do not know the why on this one, but hopefully the how will be enough to get done what you want to get done.Thanks, that works, and I'll add one more caveat for anyone who may read this in the future, hoping it will save some headaches.  If you're on a 64-bit windows machine, then there are two folders for program files:

C:\Program Files
C:\Program Files (x86)

If you're trying to do this kind of FOR command, then you also need to explicitly escape the closing parentheses with carets, as well as do everything else with double quotes from the example above.

Code: [Select]SET prog="C:\Program Files (x86^)\Folder\Prog.exe"
SET arg1="C:\Program Files (x86^)\Folder\filename.dll"
SET arg2="Hello World"
FOR /F %A IN ('"%prog% %arg1% %arg2%"') do echo %A
What a mess!
Also, for anybody who'd like a shortcut for escaping the parenthesis with the caret, try this:

Code: [Select]SET variable=%variable:)=^)%
Thanks again for all of the help!The x86 folder is there so 64bit Windows can run native 32bit apps... Quote from: aarondiers on October 12, 2011, 12:54:20 PM

Also, for anybody who'd like a shortcut for escaping the parenthesis with the caret, try this:

Code: [Select]SET variable=%variable:)=^)%

And in case you are wanting to do that through an entire file:

Code: [Select]echo off
set /p file=What file do you need to caretize?
for /f "delims=" %%A in (%file%) do (
  set line=%%A
  call set line=%line:)=^)%
  echo %line%>>output.txt
)
ren %file% %file%.old
ren output.txt %file%

Make sure the file to be changed is in the same directory as the batch file. Otherwise you would have to adjust the code a little bit/
547.

Solve : is there a way to make windows batch files accept arguments??

Answer»

is there a way to make windows batch files accept arguments?
I know you can use %1 and so on, but I'd like to be able to use -a -g /f and all of those.

//RG0DYou can PROBABLY just use a variable to hold all of the arguments as well:

Code: [Select]set arg=command -a -g /f
...
call newprogram %arg%

What exactly is it you are trying to do that would require you to pass arguments?Well, I was thinking of trying to convert the linux cowsay command to a windows version (mostly for fun), and then, depending of the parameter, change the apperance of the ASCII image slightly. I can build the pictures and the input system, but I don't know how to get the aguments working.The easiest way is to have the receiving program accept more parameters and set them up in the right places.

Code: [Select]set arg1=/s
set arg2=/b

dir.bat %arg1% %arg2%

>>dir.bat<<
Code: [Select]dir %1 %2
With this, you can probably see that you can pass the command if you wanted to as well. For what you are trying to do, it MAY be easier to set up a series of IF tests to check the parameters being passed and then change the appearance based on that. It can be done, though it may require some extra work to do so.Wait, I just want to make sure if I got it?

If the code to activate will be like this:
Code: [Select]C:\> Mybatchfile -a
that would start Mybatchfile.bat and tell it "Here's a parameter called -a, What would you like to do with it?"Oh, I just got an answer in my PM inbox too. Now I think I've got it. Thx for your help guys!

PM from David Murphy:
Quote

C:\test>type argument.bat
echo off

rem argument can be passed to a batch file.
rem argument.bat one two

echo argument %1

echo argument %2

Output:

C:\test>argument.bat  one two
argument one
argument two

C:\test>
He is a Troll...and has been banned from the Forums...

Take the advice with a grain of salt. Quote from: Radiation G0D on OCTOBER 12, 2011, 10:03:16 AM
Wait, I just want to make sure if I got it?

If the code to activate will be like this:
Code: [Select]C:\> Mybatchfile -a
that would start Mybatchfile.bat and tell it "Here's a parameter called -a, What would you like to do with it?"

Exactly. That's how arguments are passed to other programs. It's up to the receiving program on how to use the arguments passed.I found this in the snippet closet. It mimics the VBScript named arguments feature. More of a demo, but it shows method and technique.

Code: [Select]echo off
setlocal
if .%1 EQU . goto Help

:ParseTheArgs
  if .%1 EQU . goto UserCode
  set argNamed=%1
  if "%argNamed:~0,1%" NEQ "/" echo Parameter Error [%argNamed%]...Job Canceled & goto :eof
  set argNamed=%argNamed:~1%
  for /f "tokens=1,2 delims=:" %%i in ("%argNamed%") do set %%i=%%j
  shift
  goto ParseTheArgs
 
:UserCode
  if defined month echo %month%
  if defined day echo %day%
  goto :eof
 
:Help
  echo.
  echo Named arguments have this format: /varName:varValue
  echo Exsmple: %0 /month:NOVEMBER /day:Thursday
  goto :eof

It allows variable names and values to be passed into the batch file. The batch file must be coded to handle the input, but the parameters are passed by name not position.

If you run the snippet with no parameters, a mini help screen will show the correct syntax to use.

Hope this helps.
548.

Solve : Call another .bat on Win2K?

Answer» CALL \\pc1\folder\test2.bat

Result:
Logon failure: unknown user name or bad password.

How to send a username and password forThe error you posted says you aren't authenticating to the \\PC1\VALIDSHARE  with a VALID username and password.  

Maybe this will help you?   You didn't say what OS(s) these 2 systems are running...  hmmm  If it's a flavor of Windoze why not run a straight bat file starting with a NET USE command?  That will let you authenticate to the remote SYSTEM with a username and password, then map a drive.  Then you can run or call or whatever remote bat files you want as you please?
 
Here's a LINK to how to use Net Services:  http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/WINDOWSXP/home/using/productdoc/en/net_use.asp
549.

Solve : DOS vs Windows?

Answer»

Now the fun starts!

I had a programming problem, with a XPCleanup batch file, where I wanted the program to do a starting count of the files on the C: drive, then remove the garbage files and then do another count and print out the difference.
I received help with that problem, right here on this forum, for which I'm VERY thankful.

The program works as intended when I run it from within windows XP, but, when I run it from a boot disk that was formatted by Windows XP, the batch file crashes.
First, on the initial count I get a Syntax Error and then as the cleanup portion of the batch file runs I get:
del /F /S /Q  Invalid Switch - /F

Most commonly, I'll be running this batch file from within windows, but I'd like the option to run it from a DOS Boot disk, like a CD or Flash Drive.

Here's a sample of the batch file in question:

Echo off
cls
Rem: Count the number of files on "C" before the cleanup.
Echo:  Performing initial file count. Please wait!

for /f "delims=" %%A in ( ' dir /a /s "C:\" ^| find /c /v "" ' ) do set Count1=%%A
::pause
Echo:  Disk Cleanup now starting.  Please Wait!
Echo off
del /F /S /Q "C:\temp\*.*" >nul
del /F /S /Q "%systemroot%\temp\*.*" >nul
del /F /S /Q "%systemroot%\SYSTEM32\config\systemprofile\Local Settings\Temporary Internet Files\Content.IE5\*.*" >nul

del /F /S /Q "C:\Documents and Settings\NetworkService\Local Settings\Temp\*.*" >nul
del /F /S /Q "C:\Documents and Settings\NetworkService\Local Settings\Temporary Internet Files\Content.IE5\*.*" >nul
del /F /S /Q "C:\Documents and Settings\LocalService\Local Settings\History\History.IE5\*.*" >nul
del /F /S /Q "C:\Documents and Settings\LocalService\Local Settings\Temporary Internet Files\Content.IE5\*.*" >nul
del /F /S /Q "C:\Documents and Settings\LocalService\Local Settings\Temp\*.*" >nul

del /F /S /Q "C:\Documents and Settings\%Username%\Local Settings\Temporary Internet Files\Content.IE5\*.*" >nul

del /F /S /Q "C:\$Recycle.Bin.Bin\*.*"
del /F /S /Q "C:\Recycled\*.*"
Echo:  Disk Cleanup is now complete.
Rem: Show number of files left on HD after the cleanup.
Echo:  Performing File Count, After Cleaning.  Please Wait!

for /f "delims=" %%A in ( ' dir /a /s "C:\" ^| find /c /v "" ' ) do set Count2=%%A

set /a deleted=%Count1% - %Count2%
Echo:
Echo:
Echo File Count before cleaning: %Count1% files
Echo:
Echo File count after cleaning:  %Count2%  files
Echo:
Echo Files deleted:              %deleted% files
pause


If anyone knows how to fix this, would you PLEASE let me know.

Thank You,
 
several problems:

1.the XP boot disk doesn't understand either the NTFS FILESYSTEM, so this will never work on a system whose hard disk is NTFS.
2.It Will only work on windows XP,2003 since those are the only windows systems that use C:\Documents and Settings\... more to the point, since that is a long name you might need to use the 8.3 filename for it from the boot disk, which you cannot guarantee to be the proper folder.
3. the Windows XP Boot disk is pretty much just DOS. Which explains issue 1 as well as the fact that del doesn't have the necessary switches. the only support switch with DEL from a boot disk would be /P to prompt before deleting. there is no /F or /S switch.

/F could be remedied by running a attrib and removing all attributes from files in the target directories. thankfully, attrib on the boot disk does support /S (which makes sense, it's available in DOS 6), then delete the files using DELTREE /Y, which you will have to copy yourself to the boot disk.

Another problem is that none of the control STRUCTURES will work, for doesn't support any of the functionality you are using it for, and set cannot do arithmetic in pure DOS.Let me see if I can respond to that, by the numbers.
1.  my computer is all FAT-32, , there is NO NTFS.
for NTFS drives, on customer's computers,  I would run NTFS4DOS before I would run the batch file.
That 'Allows' me to run batch files against the NTFS drive.

2.  The name of the batch file is "XPClanup.bat".  The key being "XP".  This is NOT meant to be run on Vista or Windows 7.
.....I'm writing a completely different batch file for those OS's.

3.  I checked out DEL in dos and saw that the only switch is /P, not what I want to do.
So, I use the syntax, " Echo y| del"  to send a yes response to DEL each time it runs.  I've done that before and
it works just fine.
I"ve been using Deltree /y in my batch files for many years now.  It's just that I wanted to get away from having
to load it wherever I want to run the batch file.

4.  I have a way to get the COUNTS, before and after cleaning, but I couldn't figure out how to do the math. That's what originally brought me to this forum.  I had everything down pat, except for that darned Math.

* Oh, by the way, long file names work just fine in DOS, as long as they are put inside of Quotes.

I may have actually run into a brick wall.  There I said it!
Looks like I'll be running my XPCleanup.bat program in Windows, so I can get a count of the files removed.

Shadow  I'm going to show my naivity now...

Couldn't you use rd (or rmdir) in place of Deltree with it being an XP Cleanup disk? Or does that delete too much? Like I said, naive, but also wondering if an rd/md combo wouldn't end up leaving a cleaner end product. Quote from: TheShadow on October 12, 2011, 08:04:29 PM


* Oh, by the way, long file names work just fine in DOS, as long as they are put inside of Quotes.


Really? In MS-DOS? Name one version where you have made that work. Without an LFN driver.

Raven,
That might work, but why would I change something I've been doing with 100% success, since before Windows.

I'm really kind of bummed out, that MS in their infinite wisdom would eighty six the Deltree.exe command.

I've heard it called the most powerful DOS command ever.
It's power lies in the syntax in which it's used.  It can delete just one file off of an entire HD, or it can delete a whole group of like files or an entire tree of files and folders or even wipe an entire HD. ( Deltree /Y C:\*.* )
With power comes danger and maybe that's why MS did away with the command.
I still use it a lot for my own work.

I've been using long file names in DOS batch files for years, just by putting the path inside of Quotes.
I'm hard pressed to even understand why anyone would doubt that. Eh?

At about 3AM this morning I finally figured out why my file counting line did not work from my DOS boot disk.
The command line has the "Find" command (Find.exe) in it and that's an external DOS command that must also match, the version of the OS being used.  (Command.com)  So for the line to work at all, the Find.exe file has to be on the boot disk.

After finding and fixing that problem, I gave up and went back to bed.  For now, I'm tabling the whole project.
I have some other projects that are pressing me to complete them.

Thanks to some great help I got on this forum, my XPCleanup.bat program works great when run from within Windows, and the file counting routine now works too.

Thanks Guys!
  Quote from: TheShadow on October 13, 2011, 11:51:56 AM
I've been using long file names in DOS batch files for years, just by putting the path inside of Quotes.
I'm hard pressed to even understand why anyone would doubt that. Eh?

Because MS-DOS filenames are limited to the 8.3 format? Eight characters for the filename and three for the extension?

http://en.wikipedia.org/wiki/8.3_filename

Of course, you might be one of those people who think (wrongly) that it is accurate to call all Windows command prompt environments "DOS". Which does call your self-awarded rating of "guru" into question.

Quote from: Raven19528 on October 13, 2011, 10:14:54 AM
I'm going to show my naivity now...

Couldn't you use rd (or rmdir) in place of Deltree with it being an XP Cleanup disk? Or does that delete too much? Like I said, naive, but also wondering if an rd/md combo wouldn't end up leaving a cleaner end product.

The windows XP boot diskette is really just a Windows ME boot diskette, as VER will tell anybody booting from such a diskette. The DOS version itself is 7.2, I believe, (7.1 being the version that introduced support for FAT32). Either way, it still only has basic DOS command parsing ability (it splits at spaces, quotes are not a special character to it at all), and the internal commands are equally limited. rd and rmdir accept no switches. (this means you cannot use /s to delete a folder) and you can only remove an empty folder, so that wouldn't work.

Quote from: Salmon Trout on October 13, 2011, 10:50:53 AM
Really? In MS-DOS? Name one version where you have made that work. Without an LFN driver.

Best not to ARGUE with an expert.


In any case, the run-down is this.

the for /f is never going to work. That would need to be changed.

There isn't really anything you can change it to in pure DOS batch. You might be able to get away with something involving find, but it is fairly limited pre-NT extensions as well. To be clear that entire for command is invalid syntax. there are no switches in plain DOS for the for command.

Another idea is that if you are creating a disc image or a USB drive for the purpose, you could use a Linux distro and set it to automatically run a shell script, which ought to be able to do any of the things necessary in the NT batch file. Also, it has "built-in" support for NTFS on any recent distro. Or you could try a WinPE environment, which should give you the NT command extensions your batch file needs.

As for long file names, as ST notes, it simply doesn't exist in pure DOS. the XP/ME boot disk doesn't read or consider VFAT entries, nor does it support the use of quoted names as one would CLAIM. This can be tested directly from a running XP machine by simply trying to use the the quoted form in the command.com interpreter (rather than cmd.exe) where it will issue 'Parameter format not correct - "C:\Documents"


Quote from: Salmon Trout on October 13, 2011, 12:00:37 PM
Which does call your self-awarded rating of "guru" into question.

I'm a proud Beginner!
550.

Solve : Adding blank line within batch file?

Answer»

I would like to display blank LINES in some data that will be displayed when running my BATCH file.
I also want to format the help that will be displayed when my batch file is invoked and I want examples on how I can make it STANDARD. can anyone help?echo &LT;information to display&GT;

echo. <blank line>You can have it TYPE a text file

type menu.txt

Make your Menu.TXT file look right but remember it has to stay in one screen or what's on top just scrolls off.

Or you can use ECHO as detailed in previous messages.