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.

6501.

Solve : How do I exit safe mode ??

Answer»

How do I exit safe mode ?

Its like the computer is not in safe mode but it has the coloring of safe mode everything is blurry and everything on the DESKTOP is 3xs its usual size its weired and hard to explain Ive tried going to control panel and going to display but it doesnt work I have windows 98 yhea its PRETTY old but what do I do

HELP !!!did you restart
and if so try restarting in safe mode then restarting normaly
make shoure you shud down properly Quote

did you restart
and if so try restarting in safe mode then restarting normaly
make shoure you shud down properly
so its doing this cuz I dont be shutting down properlyDoes it have Safe Mode displayed in each of the 4 corners of the screen?
If not then you are probably in NORMAL mode and have LOST your video drivers or your resolution has been changed to 640x480.
6502.

Solve : password protection??

Answer»

hi in NEW here. i hope some of u can help me.

Is it possible to set a password protectioen on a file with dos? how?goto PASS
:BAD
echo PLEASE enter the corect password.
:pass
set /P pass=Pasword:
if %pass%==YOUR PASSWORD HERE got good
goto bad
:good

6503.

Solve : how to write a script (to save running program without user hand)?

Answer»

i have one recording software i want to monitor some users during working hours.
our work environment is under Win2k3 domain.

i written a logon script like : camrecording.exe /r/h (R=Recording,H=Hidden)it ill start screen recording at startup

whereas the problem is log off script i don't KNOW it;s not working?
i written same way in log off script too like : camrecording.exe /s/x (S=Stop&Save,X=Exit from the PROGRAMS)

now i wanna to know how to stop the recording ?
when user try to log off it ill ask "stop recording before log off"
please help me it;s very urgent.

vijayyou ALREADY asked this, didn't you?yes n i reply that mail also my friend.
really it's a very urgent.
i tried all the codes still its not working.

vijay, please try to STICK to one thread per topic. I understand that this problem is urgent to you, but CLUTTERING up the board with extra posts won't get you help any faster. It's more convenient and less confusing to stick to your original thread.Post locked look for answers or discuss issue in original post.

6504.

Solve : How can i read the contents of a file using DOS??

Answer»

I have a file called List.txt , in this file I have N lines.
I need to have a batch file to read each LINE and create a file for each line. The name of this file must be same as the content of the line.

For e.g.
List.txt has 3 lines.
Line 1 is ABC.rep, line 2 is PQR.rep and line 3 is XYZ.rep
The batch file will read the the 3 lines and create files ABC.rep, PQR.rep and XYZ.rep

These 3 files can be blank files.Without knowing your OS, it's hard to come up with a definitive answer.

This may WORK on some machines:

Code: [Select]@echo off
for /f "tokens=1* delims=" %%a in (list.txt) do echo. > %%a

8-)My apologies -- the OS is Windows 2000.did you try that batch from sidewinder yet? whats the results?I have tried the commands -- I am very happy with the results.
Many many thanks for your help.I was wondering if the above commands can be enhanced. Can there be a lag of 2 MINUTES between creation of each file?

Basically each file that is created triggers a process and the REQUIREMENT is to not start all processes at the same time as this will hog all resources. Hence a delay of 2 minutes between creation of each file is ideal.

Please can you help.You can use the PING command as a timer.

Code: [Select]@echo off
for /f "tokens=1* delims=" %%a in (list.txt) do (
echo. > %%a
ping -n 121 localhost > nul
)

There is also a SLEEP command in the Win2003 Resource Kit which you can find with Google.

8-)This works just as I desired. Many thanks for your help.

6505.

Solve : Delete PCI Audio File-DOS HOW??

Answer»

I have Windows 98SE, MS-DOS 4.2. I need to know if it is possible to delete a file that was mistakenly(I didn't do it!) setup in DOS? It is a PCI Audio file that has all the settings for the speakers and sound. The file had both a Windows application and an MS-DOS application. A WELL-intentioned friend decided to see what would happen if he clicked the MS-DOS file. Well it downloaded into DOS and now the file APPEARS (quickly) between the Windows 98 start window, (the one with the 6 different choices-MS-DOS, safe-mode, etc.) and the regular screen. I know that this is not right because the SB port, FM port, IRQ, and DMA are interfering with something else (I'm not sure what) that should be using those things. Also it is interfering with the sound. What can I do, if anything? I am only just a little knowledgeable about DOS. Thank you for any help and/or SUGGESTIONS you may have. poniMS-DOS 4.2? What's that about?

Check your autoexec.bat and config.sys file in the ROOT directory as well as any variants.

Sorry, I meant 4.1. I know that the files are in the autoexec.bat, but I have not seen them in any other directory, including the config.sys. When I type in C:\PCIAUD\SETAUDIO, a file opens, listing the Device Number, Vendor ID, Device ID, PCI Config. Base I/O, PCI IRQ, DMA, IRQ, and the set SB Port, FM Port, and the MPU401 Port to I/O. It is called a Finished file. And the C:\PCIAUD\C3DMIX file has a list of audio devices, (i.e.:Master, CD Line-In, Mic, Recording, etc.), with left and right volume controls for each one, if changing their sound becomes necessary. Although I can CHANGE the loudness and disable the mute buttons, I can not find a way to delete these applications. And I don't mean to sound ignorant, but what do you mean by the variants? And even if I do check these things, what do I do once I find them? Thank you. poni

6506.

Solve : Batch to check for Media location before rest of batch is executed?

Answer»

Anyone KNOW the % % command to find media in a system with multiple CD or DVD drives?

Unfortunately it cant be FIXED with just creating the media to autorun on whichever drive its loaded from.... That would have been way to easy... ha ha

Most systems have just a single CD or DVD Rom, but my batch is failing to execute on systems with more than one CD or DVD Drive, if the batch doesnt land on the 50 -50 chance of the correct drive.

Is there a test condition I should be using to find the media on the other drive?

Please post a snippet of batch code on how to go about doing this...

Thanks in advance! ... Davebetter if you post the problem code and then we can advise you how to MODIFY it.

For a start, we don't know your drive letters or what kind of media you are talking about. (That probably won't stop CERTAIN teen hotshots from indulging in some guessology, but never mind them)
Is this a batch file that is running from the CD drive in question? If so you can use %~d0
Like:
Code: [Select]echo The drive letter is %~d0Otherwise, you can loop through the optical drives that you found with the VOL command to see which one has the volume label you are LOOKING for.
Thanks Guru ... That works ... I was able to use VOL to find the CD no matter which drive it was inserted into since the volume is always acct_updt for the Accounting Systems Update CD.

Thanks for your help! Many Thanks!!!!

Dave

6507.

Solve : batch scripting?

Answer»

File not Found - Goto

File not Found - yes

after 2 sec command prompt was exit.

ex:
ping 192.168.5.68 | find "Reply from 192.168.5.68" goto yes

(or)

ping 192.168.5.68 | find "Reply from" goto yes

exit

:yes

start /max notepad
pause
now it's working

ex:

ping 192.168.5.68 | find "Reply from 192.168.5.68" && goto yes

exit

:yes

start /max notepad

pause
Thank youQuote from: rampa on MAY 21, 2007, 09:00:15 AM

now it's working

That's GOOD...
Quote from: rampa on May 21, 2007, 09:01:34 AM
Thank you

You are very welcome, my friend!

hi all,

how to find drive size, through Dos command ?


Your new question should probably be a new thread.

What OS are you running? This should run in Windows XP / 2003 to list the size of all :
Code: [Select]@ECHO off
setlocal enabledelayedexpansion
for /f "delims=" %%a in ('echo list volume ^| diskpart') do (
set line=%%a
if "!line:~39,9!"=="Partition" echo Drive !line:~15,1!: is !line:~51,7! in size.
)'diskpart' is not recognized as an internal or external command,
operable program or batch file.Quote from: rampa on May 23, 2007, 12:31:10 AM
'diskpart' is not recognized as an internal or external command,
operable program or batch file.

Code: [Select]Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

c:\>diskpart

Microsoft DiskPart version 5.1.3565

Copyright (C) 1999-2003 Microsoft Corporation.
On computer: PUPP-C92F25ED23

DISKPART> exit

Leaving DiskPart...


(for Non NT systems ie NOT Windows 2000, XP, 2003 etc)

Code: [Select]chkdsk c: | find "total disk space"
i am using windows 2000 Adv. ServerQuote from: rampa on May 23, 2007, 12:38:57 AM
i am using windows 2000 Adv. Server

What's the DiskPart utility?

DiskPart is similar to the MS-DOS Fdisk utility, which lets you create and view partitions from the command line. However, DiskPart does much more than Fdisk. In addition, the DiskPart UI matches the GRAPHICAL interface of the Microsoft Management Console (MMC) Disk Management snap-in.

DiskPart is part of the Win2K Server Resource Kit and the Win2K Professional Resource Kit. (Microsoft includes DiskPart as a core utility in Windows Server 2003 and Windows XP.) You can download the tool for free from Microsoft's Web site.

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

6508.

Solve : How to monitor changes on environment variables?

Answer»

Hello all!

I have several SCRIPTS running on DOS and there are some variables that is set and changed during these scripts execution. Is there a monitor to registry all sets, usage and CHANGES on these variables?

Thanks in ADVANCE!Sure, you just edit the files so that everything has echo on and then you just stare at the monitor.
Or did you WANT some program to do that? You could write a program that eedits all batch files so that every set command will echo on the printer.
As far as I know there is no ready made debug tool for DOS batch commands.
But I don't know everything. let's say that we want to see if the ENVIRONMENT variable bootfolder has changed.

first action is set bootfolder-original=%bootfolder%

later, if it has changed this will tell you...

if "%bootfolder%"=="%bootfolder-original%" goto same

echo variable %bootfolder% has changed

(code to execute if different)

:same

echo variable %bootfolder% has not changed

(code to execute if same)

6509.

Solve : tough topic - single instance running baddly?

Answer»

Hello, i have this script not running ok, it depends how it is launched.

IF "%RUNNING%"=="E" ECHO Program is already running&SLEEP 1&EXIT
SETX RUNNING E -M

ECHO now any other program instances will be revoked
PAUSE

REM program tasks

SETX RUNNING K -M
EXIT

This script doesn't let the program (REM program tasks) launch a second time.
There are programs that work only a single instance at a time, otherwise bad things happen.

Launched from explorer it is working FINE, launched as a parameter from another program, (using another program), it won't work anymore, i'm wondering why.

The script works ok until i launch it using the main surveillance program, by
example WebCam Monitor http://www.deskshare.com/wcm.aspx
Then it doesn't care anymore of the %RUNNING% variable.

It can be seen at the PAUSE that %RUNNING% is not replaced adequately.
Let echo on to see the error.

WebCam Monitor has an easy way to test this, without having a camera
attached. The way is to press Test Selected Alerts (more times) after have
checked Launch Program and Configure it to launch the above script.

When we take the case the script is launched from WebCam Monitor http://www.deskshare.com/wcm.aspx
Run it without @echo off and you'll see in the IF statement what is replacing RUNNING variable, you'll see that during the script, RUNNING doesn't take the adequate value, i think it will be not defined, also the same time if you look in system properties/advanced/env var, you'll find the correct value for it.

link for SETX:
http://www.deskshare.com/wcm.aspx
http://support.microsoft.com/kb/927229

link for SLEEP:
http://www.petri.co.il/download_free_reskit_tools.htm
http://www.microsoft.com/downloads/details.aspx?displaylang=en&familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd

Ask me anything you want please, if confused.I'm not sure I understand the ISSUE.

What OS are you running?

It sounds like sometimes the environment variable RUNNING does not have the right value? What value should it have, and what value does it have when it is not working CORRECTLY?

What is the syntax used when it is launched from explorer? And the syntax used when launched from the other program?It sounds like sometimes the environment variable RUNNING does not have the right value?

>>>Yes, it's like the script doesn't recognize RUNNING as being defined or as being the adequate value, whereas w2k pro in its system prop/advanced... sees RUNNING correctly.

What value should it have, and what value does it have when it is not working correctly?

>>>first time the script is runned, RUNNING will not be defined at all, will not be "E" or will be "K". So, it will skip the line:
IF "%RUNNING%"=="E" ECHO Program is already running&SLEEP 1&EXIT
and will set RUNNING "E", then it will PAUSE. This time if launched again the same script, it will see RUNNING being "E" and will EXIT. This is happening until the first script launched will end, when it will reset RUNNING to "K".
(Instead of PAUSE line will be my program, so it won't run a second instance of it)

Now i'll say what value RUNNING has when it is not working ok. It has exactly the value before WebCam Monitor launch, usually it is "K" if script runned once. WebCam Monitor will keep the value "K" on and on, for the script, otherwise windows shows its correct value.

What is the syntax used when it is launched from explorer?

>>>Just double click on it.

And the syntax used when launched from the other program?

>>>WebCam Monitor has a configure window for Launch Program:
-specify program - i passed just the BATCH without any parameter
-parameters for the program
-start in folder - i passed the script folder

6510.

Solve : Batch file for Laoding Programs from CD?

Answer»

Good afternoon all, tried a search but was unsuccessful...
I have been working on a batch file to automate the install of CiscoVPN and setup DESKTOP Icons from an install disk...
Basically I want to be prompted only once for the install of all three programs. I tried to manipulate the autorun.inf but it will not work with multipul files the way i want it to.

Here is the batch file...

title Cisco VPN and MS RDP installer...
@echo off
cls
:start
ECHO.
set choice=
set /p choice=... Install My Secure Connection and Icons (Y/N)?
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='y' GOTO INSTALL
if '%choice%'=='Y' goto INSTALL
if '%choice%'=='N' goto end
if '%choice%'=='n' goto end
ECHO "%choice%" is not a valid selection, please try again
ECHO.
goto start
:INSTALL
ECHO INSTALLING...
Start d:\setup2.exe
Start d:\serverEntryToHostsFile.bat
Start d:\setup.exe
goto end
:end

My question is... how do i make it so that the CD install drive is chosen automatically? Not all CD DRIVES are going to be 'd' drives. So if I insert my disk and and the disk drive is 'n' instead of 'd', is there a subroutine or someting that will RECOGNIZE which drive the cd is in and install from?The batch file is on the CD and you want it to "know" what drive letter it is being run from?

In 2000 & XP it is %~d0
Exactly what I was looking for!!

Thank you!!!

6511.

Solve : Append month/year names to the end of a file?

Answer»

Quote from: ghostdog74 on May 23, 2007, 10:46:47 AM

if you have XP you can use powershell. its easier.

You have to download it, and as to whether it's easier, that's a MATTER of opinion. Object oriented shell programming isn't everybody's cup of tea, ESPECIALLY if they are just starting out.

Do you NEED this loaded on the server as well as the workstation?Quote from: contrex on May 23, 2007, 10:49:44 AM
Quote from: ghostdog74 on May 23, 2007, 10:46:47 AM
if you have XP you can use powershell. its easier.

You have to download it, and as to whether it's easier, that's a matter of opinion.
So what's wrong with downloading it , esp it is a m$ tool? by the way, It will be included in the OS in future (win2008).
Quote
Object oriented shell programming isn't everybody's cup of tea
like you said, its a matter of opinion, its up to whoever to use his computer to the fullest...




Quote from: crosscut2020 on May 23, 2007, 10:56:53 AM
Do you need this loaded on the server as well as the workstation?
no need, you install it on the machine you want to run the script from.Quote from: crosscut2020 on May 23, 2007, 10:56:53 AM
Do you need this loaded on the server as well as the workstation?
You would need PowerShell and all of PowerShell's dependencies installed on any computer that will run a PowerShell script. So if just one computer will run it, it just needs to be installed on one computer. If the script will be run on all computers in an organization, then PowerShell would need to be installed on all of those computers.

PowerShell does have a lot more power than the standard CMD shell, but for copying a file to a new name with an embedded timestamp ... I personally think batch is just as easy. And it can be done in one line. For my U.S. English FORMATTED date, the code to duplicate the requested
Quote
copy fileName.csv folderA\%yr%%mth%%dy%fileName.csv
is:
Code: [SELECT]copy fileName.csv folderA\%date:~-4%%date:~-10,2%%date:~-7,2%fileName.csvAnd to do it in PowerShell, I would personally do it in one line also, like:
Code: [Select]cp fileName.csv "folderA\$(get-date -uformat +%Y%m%d)fileName.csv"
PowerShell and many other scripting languages (like Perl, Python, etc.) are great tools, but I think cmd shell batch is so much more convenient because it is already there and working in Windows. No installing, no dependencies, no compiling. Several years down the road, when most computers have PowerShell built into Windows, I will probably use it a lot more. Right now, I just use it for things that the cmd shell can't do, and on my own computer where I don't have to worry about compatibility. Just my two cents.
6512.

Solve : need random value in a batch file?

Answer»

ok what I need is a random VALUE in the range of 0-255 I know about the %random% command but the value is in the range of 0-65535 so can some ONE please help? Welcome to CH, BlazingClaymore.

Try this:
Code: [Select]@echo off
set /a NUM="%random%" %%36 + 1 >nul
echo %num%
pause

6513.

Solve : booting from a floppy disc?

Answer»

I have windows xp home. I made a bootable floppy disc. When I get to the comand PROMT. What do I type to make windows boot from the floppy disc.

Thanks ChristopherWhat are you trying to do exactly?
I don't think you are going to be able to get Windows to boot from the floppy disk. What version of command prompt / DOS is on the floppy disk? If you are not SURE try the VER command and post back.

And, as asked by Contrex, what are you trying to do? To run Windows XP, you will have to boot off of your HARD drive. There are PE versions of Windows XP that can be run from CD or USB flash, but there is way more information than can fit on a floppy.Ok let me explaine. The startup.ini files are messed up and windows cannot boot up with them. So I made a boot floppy with all the good start up files on it. What the disc does is allow windows to use the boot files on the floppy instead of the hard drive to boot windows. Once i'm in windows I can REPLACE the bad start up files. The floppy disc has these files on it. AUTOEXEC.BAT,BOOT.INI,COMMAND.COM,CONFIG.SYS,DISPLAY.SYS,EGA2.CPI,EGA3.CPI,
EGA.CPI,IO.SYS,KEYB.COM,KEYBOARD.SYS,KEYBRD2.SYS,KEYBRD3.SYS,KEYBRD4.SYS,
MODE.COM,MSDOS.SYS,NTDETECT.COM,NTLDR. Windows will still boot from the hard drive but use the bootini files on the floppy to do it. So I need to know what to type in the command promt to make it do that.

Thanks ChristopherYou didn't make a proper XP boot disk. You made a DOS boot disk with some XP files on it.

There is no DOS command that will start XP!

Correct instructions here.

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

What filesystem does your hard drive have on it? NTFS? FAT32?

It probably has NTFS, but if it does have FAT32, then you can still access your partition and boot.ini file through the boot disk that you already created. Otherwise, use the link provided by Contrex.You can also look at www.bootdisk.com

Also, if you have your Windows XP CD, you can boot to that and CHOOSE the recovery console.
Quote from: GuruGary on May 24, 2007, 11:32:05 AM

but if it does have FAT32, then you can still access your partition and boot.ini file through the boot disk that you already created.

Good point. I had almost completely forgotten about FATXX filesystems.

6514.

Solve : convert exe program, how do i use it??

Answer»

how do i use this convert to exe PROGRAM? i was thinking of this program:
link:

http://img231.imageshack.us/img231/5848/somerl0.jpg

can anyone tell me how it WORKS ? thnx for all answers <3Seems pretty straightforward. Do you have a Works FILE you want to read in Word? Do you have Word on there?dont GOT work yet to work with... just wondering, so when i got some files to work with i can convert them Do you have Word on there?microsoft word right? the writing program ? yes i have

6515.

Solve : Re: format usb?

Answer»

If your USB flash drive is X:, you COULD do something like:
Code: [Select]echo. |format x:It can be any drive letter. Just substitute X: for your actual drive letter. If it is E:, then the COMMAND would be:
Code: [Select]echo. |format E:You have to create a program that will overwrite every file with some code you will provide... For example, your program will overwrite a file with the text "abcd" (or all the FILES; if it works for one, it will work for all). The format command it is not "SURE" because if that someone USES the usb stick in another computer, it is very possible that the letter assignation to be different from your's.OK yea this doesnt work right because the drive is in use...

6516.

Solve : DOS for loop question?

Answer»

I am tryng to use for /f command to read in the file and returning a first line. Is there anyone who KNOWS if I can tell for /f command to give me the first line in the txt file?after echoing the line, exit.if you don't want to exit, you can jump to a label.

for /F "delims==" %%a in (test.txt) do set line=%%a &AMP; goto Next
:Next
echo %line%

This works fine as long as the first line does not have any
"poison" characters (", %, ^ etc.).
Or you can call it as a function, and exit on the first loop:
Code: [SELECT]@echo off
call :PrintFirstLine
echo The REST of your code goes here
goto :EOF

:PrintFirstLine
for /f "delims=" %%a in (test.txt) do echo %%a&exit /b
If you want only the first line, use this

Set /P FirstLine=
GrahamQuote from: gpl on May 24, 2007, 09:53:38 AM

If you want only the first line, use this

Set /P FirstLine=<test.txt

Graham

That takes my vote for BEST suggestion. No need for a FOR loop, and all in one line.


Yes, Graham's solution is simple and robust. I like it.I works like a charm. thank you all.

Robtem
6517.

Solve : Need a command line?

Answer»

I need a command line to enter "C:\Program Files"
But DOS does not accept the space.. its probably a simple problem but im novice at it.

Can someone tell me exactly what to put in?

~shayne~cd C:\"Programs Files"Are you speaking of real DOS or command prompt?Well im using Windows Xp Pro and using the command prompt.

Im probably being a show off here or not but im trying to hack into my schools T: drive (The drive with all the Tests and Answers on it) and get all the answers VIA dos because the network doesnt block DOS from entering the Drive. i need to get to program files because i INSTALLED a program onto the computer (VIA ADMIN USERNAME) (I came across the password in a note on a teachers desk) but admin user isnt on the network. and it didnt add shortcuts to my desktop. to i plan to enter program files through dos because C: is normally Blocked.
The program Puts an IP SHADOW on the computer while I access T: and then they cant trace back.. simple... or not...Do you honestly think anyone is going to help you hack into your school's computer? Pass, with prejudice 1. That is ilegal and you would be hacking GOVERNMENT proerty fedural offence
2. Why dont you just do as every one eals does and study for you test it will make you smarter
3. If we helped you we COULD get in a lot of truble to
4. You are stealing government property

6518.

Solve : Changing a character in text?

Answer»

need help to Changing a character in text


[AR]
a=Setup.exe
b=Setup.exe


change to....


[AR]
echo Setup.exe
echo Setup.exe


a= and b= change to echo


how to write in batch? please help meWhat OS are you using?i'm using windows sp2

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.The following is not batch, but an example in powershell and windows services for unix. both can be downloaded from M$.
Powershell eg
type this code and save as change.ps1
Code: [Select]$pattern1="^a="
$pattern2="^b="
$REPLACEMENT="echo"
FOREACH($text in (get-content yourfile.txt)) {
if ($text -match $pattern1) {
$text = $text -replace $pattern1, $replacement
echo $text
}
elseif ( $text -match $pattern2) {
$text = $text -replace $pattern2, $replacement
echo $text
}
else { echo $text}
}
then on cmd , type
Code: [Select]C:\temp>powershell -nologo -noninteractive -command "& c:\TEST\change.ps1" > new

using Windows for Unix services :
Code: [Select]/dev/fs/C/SFU/bin/awk -F"=" '/^a=/ || /^b=/{$1="echo";}
{print} ' yourfile.txt
save as change.sh, then on cmd:
Code: [Select]C:\test> ksh test.sh
Not your NORMAL batch, but something else to add to your the toolbox.Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\asda>C:\temp>powershell -nologo -noninteractive -comma
nd "& c:\test\change.ps1" > new
'C:\temp' is not recognized as an internal or external command,
operable program or batch file.


wat is windows for unix services?

Quote from: insertusername on May 26, 2007, 02:58:14 AM

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\asda>C:\temp>powershell -nologo -noninteractive -comma
nd "& c:\test\change.ps1" > new
'C:\temp' is not recognized as an internal or external command,
operable program or batch file.


wat is windows for unix services?


c:\temp is just my directory where i did my tests scripts...dude you don't even know your command prompt.
Actually its services for windows. Its Unix in windows , that means you can do unix stuff in windows...SEE here
6519.

Solve : background?

Answer»

Is there any way to change the DESKTOP background with batch vbs autoit or anything ealse?

Think youany help at all :-? :-?Quote

any help at all :-? :-?
i am sure you can find some vbscript SOLUTIONS by googling for it. below is what i GOT from GOOGLE. you can try it out..
Code: [Select]Dim WshShell
Set WshShell = WScript.CreateObject("Wscript.Shell")
WshShell.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", mybitmap.bmp
WshShell.Run "%windir%\System32\RUNDLL32.EXE user32.dll,
UpdatePerUserSystemParameters", 1, False
Set WshShell = NOTHING


6520.

Solve : How to get the path of current directory?

Answer»

How can I get the path of CURRENT directory?

I want to copy some files from current directory to c:\windows\system32

Now my current directory is C:\Documents and Settings\Shajahan\Desktop\fatal
It will change any time
So I want to pick the current directory


pls help me soontype this at the prompt and you'll know the answer

echo %CD%i know that

i want to RUN from windos
so where i put the batch file i want the path of that directory

maybe from desktop
maybe from mydocumentSo, you to copy a file from whatever your current directory is to C:\Windows\system32?
Code: [Select]copy filename.ext C:\Windows\system32For multiple files, you can use a wildcard, like *.dll

Or from a batch file, you can do:
Code: [Select]copy %1 C:\Windows\system32and put the batch file somewhere in your path, and call the batch file with the filename you want to copy from your current directory.

Is that what you are looking for?shajahan, the "current directory" in DOS and in NT is the directory you are logged into, that is, the directory WHOSE path forms the prompt. That is the CONTENTS of the %CD% variable. In a batch file, the variable %~dp0 is the folder that the batch file is located in.

here is the batch file F:\test\cdir\show.bat

Code: [Select]@echo off
echo the current directory is %CD%
echo this batch file is in directory: %~dp0

Code: [Select]F:\test\cdir>show.bat
the current directory is F:\test\cdir
this batch file is in directory: F:\test\cdir\
F:\test\cdir>
F:\test\cdir>cd..

F:\test>f:\test\cdir\show.bat
the current directory is F:\test
this batch file is in directory: f:\test\cdir\
F:\test>c:

C:\>f:\test\cdir\show.bat
the current directory is C:\
this batch file is in directory: f:\test\cdir\
C:\>e:

E:\>f:\test\cdir\show.bat
the current directory is E:\
this batch file is in directory: f:\test\cdir\
E:\>




6521.

Solve : starting in MSDOS mode using win xp?

Answer»

ok, you have no idea how pissed off i am at microsoft. here's microsoft: "Win 95 and 98, u get an option to restart in MSDOS mode." windows xp comes along and yoink, "LET's NOT give them that option, what a GREAT IDEA!" seriously why would u take out something like that, to make it extremely hard to access such a vital part of the computer system? now that THAT is out of my system...

I want to start my WIN XP computer in MSDOS mode because it has a bunch of *censored* on it and i want to reformat. i have a new copy of windows xp home and when i tried booting from the windows CD it takes me into setup then says "setup cannot find a hard disk..." that is retarted... i don't have a floppy DRIVE in my dell 3 GHz 512 ram 80 gig HD and want to just start it in dos so i can do "format c:" and be done.

thanksThis doesn't work because Windows is not something that runs on top of DOS like the non-NT versions (95, 98, etc.) but is an operating that has a command prompt (not DOS) window available.

On no computer can you boot to the C drive and format itself. THat has to be from ANOTHER device, not involved in the format. In your case a real Windows CD is able to do that.

It sounds like you did not get that, so you have to do the reinstall with whaever medium (hidden partition, restore CD) the manufacturer PROVIDED. Formatting i susually part of that process.

Do you have a SATA drive? If so, you need to install the drivers for it to load XP. If not you have other issues (not Windows) that need to be addressed.thanks for the help, u mentioned drivers for my HD. I went and couldn't find any new drivers.
then i went into the BIOS again and went to the hard disk section where it was booting up something weird, so i changed it to find an ATA hard disk.

i ran windows xp CD and voila, it worked.

i'm happy now GLAD you are all fixed up. This section of the Forum needs to be re-named from MS-DOS to "Command Prompt"...True. MS-DOS doesn't seem to ever enter into the equation.

6522.

Solve : NEED DOS HELP PLEASE?

Answer»

im trying to RUN something in command prompt and whever i type in the command it says the following

Error: cannot run in WinNT/2k/XP DOS box. Run from DOS or Win 9x/ME

Someone please help me with this problemWhat OS are you using as obviously it is not DOS? What program is this?\

This is probably what you are NEEDING, but the psychics are out.

well all i kno is tht im trying to find a certain device on my computer and it wont let me find itWell that's a very STRANGE statement, and I wonder what the device could possibly be, but 16 bit errors can usually be corrected with this:

http://support.microsoft.com/default.aspx?scid=kb;en-us;324767ok thanx and could u tell me where i can download dosIf you mean Microsoft DOS, it cannot be legally downloaded.

There are some free variants, but it seems all have issues, some more than others. Here is one:

http://sourceforge.net/projects/freedos/

Come on, I'm curious now. What are you reallly trying to do?im messing with my ipod and putting linux onto itAnd how does DOS enter into the EQUATION?idk but the dos box is wht im using it for


Quote

idk but the dos box is wht im using it for




Huh? ? ?Hopeless, I fear.
6523.

Solve : Edit Autoexec.bat Through a .bat??

Answer»

I feel totally retarded.

I am working on a project and have been for a couple days now.

I have most of everything I need done

I just need to be able to edit the autoexec.bat somehow through a different .bat file

And I do have a few sub questions

#1 When running a .bat on startup, does it run before anything else, or after, or in no set order

#2 I dont remember where I saw it on the site, but I remember that there was some way to skip files/folders from being delted, I just dont remember what that was.

#3 How do you move files


I am running on the windows XP OS

Sorry about all the questions. I feel retarded posting for help so soon, I feel like a leecher
What are you REALLY trying to accomplish?sounds like he's trying to remodulate the majiggery agitator on the combustive flatulater while a unicorn sips fairy juice out of a popper.Thank you for your kind words of advice, This was totally worth it.why do you need to edit it through a different bat file?
and could you elaborate on points 2 and 3 please?Is this a homework assignment? Hopefully not, so here are some hints:

1) If you are talking about the AUTOEXEC.BAT getting run during MS-DOS boot, I think it loads in this order: IO.SYS, CONFIG.SYS, COMMAND.COM, AUTOEXEC.BAT. If you are talking about the order of executing .bat vs .com vs .exe, I think it goes in order of .COM then .EXE then .BAT for the same file name before the extension.

2) You might be talking about DEL /P that will prompt before deleting files so you can skip files if you don't want them deleted.

3) The MOVE command.QUOTE from: shiro on May 24, 2007, 06:05:25 PM

I am running on the windows XP OS

On XP machines, the autoexec.bat file has morphed into the autoexec.nt file. It is used (along with the config.nt file) to initialize the command prompt environment (cmd.exe)

Windows initializes from values in the registry.

Thank you so MUCH Guru Gary, that actually did help.

Sorry about my response it was just late at night and I took reaper's response pretty harsh.

But actually this is a bet from a friend. He made some program or whatever that basically just creates a blank file on startup. and he bet me $20 that I couldn't make a program to delete it on startup.

It sounds nerdy, mainly because it IS

but I learned about DOS and hopefully getting $20.

Question 3 was just for my own info.

It really was a interesting experience and I might find a use for bat files LATER on.

But SERIOUSLY thank you seriously now...nobody answered..how to edit a another .bat file with a .bat file...a I would really like to know...Do you want to edit the entire thing or just add something at the end or completely change the file you are editing. There are two ways I know how to do this.

Outline:
delete the current file
create a new file in the same location with an edited code

Is that more or less what you (two) are looking for?Quote from: adikid on May 26, 2007, 04:24:02 AM
seriously now...nobody answered..how to edit a another .bat file with a .bat file...a I would really like to know...

Hints are appropriate for a true learner. You don't want to just see how the magic trick is done, do you?btw my COMMENT was possibly a bit misinterpreted... i do actually enjoy doing things like this and i would like to know about this particular subject aswell

It is not easy to edit / replace strings in batch. You can use
SET := to do string replacement, but there are several characters that will confuse that SET command. So basically there is no robust reliable way to edit a .BAT file with another .BAT file (without lots and lots of work and error checking).

Here is a simple example:
Code: [Select]@echo off
set String=Hello World
echo %String%
set String=%String:World=Reaper%
echo %String%
So using that example, you could get each line out of a file (with a FOR /F loop) and replace the contents that you are looking for with new values using the SET := but you will need to do lots of error checking as there are lots of characters you will need to work around.

Is that what you were looking for?
6524.

Solve : search and replace?

Answer»

Hi

I have two files

file 1 contains

VALUE_1
VALUE_2
VALUE_3

file 2 contains

parameter 1 has value &1
parameter 2 has value &2
parameter 3 has value &3

I WOULD like to replace the &1, &2 and &3 which the values of file one so &1 --> VALUE_1 etc. So when we are finished
files 2 contains the following

parameter 1 has value VALUE_1
parameter 2 has value VALUE_2
parameter 3 has value VALUE_3

How do I do this in a cmd file......

The following code takes every line from file1.txt and every line from file2.txt
so you have it in %%A and %%B and writes it in file3.txt.
This works if you will take the lines completely. If you want to filter it out it is a bit different.

snip---

for /f "tokens=*" %%A in (file1.txt) do for /f "tokens=*" %%B in (file2.txt) do ECHO %%B %%A >>file3.txt

-----snap


If you have exactly the same count of colums and want to have it lieke:

Parameter 1 has Value_1
...

snip----
for /f "tokens=*" %%A in (file1.txt) do for /f "tokens=1-4 delims= " %%B in (file2.txt) do echo %%B %%C %%D %%A
---------snap


hope it helps
uli
That's not quite what I want. In your we I concat just two files, thats not what i want. In file2 I have params which must be replaced by the values mentioned in file1.

VALUE_1 IN 10
VALUE_2 IN 20
VALUE_3 IN 30

file 2 contains

parameter 1 has value_1
parameter 2 has value_2
parameter 3 has value_3

So value_1,2 and 3 must be replace by 10,20 and 30 so the file should look like this

parameter 1 has value 10
parameter 2 has value 20
parameter 3 has value 30

But anyway thanx for the reponse!!

Pjotter
Like this?

Code: [Select]for /f "tokens=1,2,*" %%a in (file1.txt) do set %%a=%%c
for /f "tokens=*" %%a in (file2.txt) do (
set line=%%a
for /f "tokens=1,* delims==" %%a in ('set value_') do (
call set line=%%line:%%a=%%b%%
)
call echo.%%line%%
)>file3.txt
move /y file3.txt file2.txt >NUL
Should also work CORRECTLY when:
- The values in file1 contain text with space
- A line in file2 has multiple values to replace

Same is much easier when the syntax for a variable to be replaced in file2 is like %value_1%, i.e.:
parameter 1 has %value_1%
parameter 2 has %value_2%
parameter 3 has %value_3%

In which case the script would simplify to:
Code: [Select]for /f "tokens=1,2,*" %%a in (file1.txt) do set %%a=%%c
(for /f "tokens=*" %%a in (file2.txt) do call echo.%%a)>file3.txt
move /y file3.txt file2.txt >NUL
DOS IT HELP? MANY THANKS!!!!

For 99% procent it covers what I want, the 1% is the next issue file2 does indeed contain the params as described in file1 BUT the PREFIX in this case is an & so file2 looks like

parameter 1 has &value_1 <---- watch for the extra & in each row
parameter 2 has &value_2
parameter 3 has &value_3

instead of

parameter 1 has value_1
parameter 2 has value_2
parameter 3 has value_3


so the line for /f "tokens=1,* delims==" %%a in ('set value_') do ( should be something like for /f "tokens=1,* delims==" %%a in ('set &value_') do (

BUT & is some kind of preserved word. How do I overcome this?

DOSItHelp DOES indeed help!!!!!
pjotter



:-? :-? :-?
when chaning VALUE_1 to P_ the every lines ends with 3 c's

When changing P_PARAM1 IN 10 to V_PARAM1 IN 10 in file1 the output is

parameter 1 10c c c

strange, is P_ somekind reserved word??

just an alternative. Not in batch but in Python
file1.txt contains
VALUE_1
VALUE_2
VALUE_3

file2.txt contains
parameter 1 has value &1
parameter 2 has value &2
parameter 3 has value &3


Code: [Select]all = open("file1.txt").read().split() ##"all" contains ['VALUE_1', 'VALUE_2', 'VALUE_3']
count = 1
store = {}
for items in all:
## store will contain {'&1': 'VALUE_1', '&2': 'VALUE_2', '&3': 'VALUE_3'}
## a mapping of your &1 with VALUE_1 and so on
store['&' + str(count)] = items
count = count + 1

p = open("file2.txt")
for lines in p:
lines = lines.strip() #strip off newlines
print lines[:-2] + store[ lines[-2:] ]

p.close()

Output:
Code: [Select]parameter 1 has value VALUE_1
parameter 2 has value VALUE_2
parameter 3 has value VALUE_3




Or in batch:

Code: [Select]for /f "tokens=1,2,*" %%a in (file1.txt) do set %%a=%%c
for /f "tokens=*" %%a in (file2.txt) do (
set line=%%a
for /f "tokens=*" %%a in ('set value_') do call set line=%%line:^&%%a%%
call echo.%%line%%
)>file3.txt
move /y file3.txt file2.txt >NUL[highlight]; )[/highlight]

6525.

Solve : Resolved: Moving all .mp3?

Answer»

There we go, that did it! This will surely come in handy. Thanks!

One little thing, however...In the test folder, I have two subdirectories: happy and new year. Each of those contains a text file try.txt (same filename, but different content). When I use this batch for .txt files, it only copies the new year file and not the happy one. So, that must mean that one is overwriting the other. What can be done about this?



(I've completely hijacked your thread, Dark Blade, and I'm sorry, but I think the information here will benefit you.)For XCOPY, you can user the /D switch to tell it to only overwrite an existing file if the file to be copied is newer. XCOPY will also keep the DIRECTORY tree like it is in the source. If you want to merge all files into a single directory, then use code like Sidewinders.But what I'm wondering is...when USING Sidewinder's code, how can I prevent overwriting? I'm not too worried about it with xcopy, but it's a problem with his code.

If I wanted to copy my entire music collection into one directory, I'd lose hundreds of songs. I've got at least fifteen California.mp3 files, and they're all different songs. How would I set up the batch file to prompt me to overwrite or not?

Better yet, how could it be set up to automatically rename like-named files (California(1).mp3, California(2).mp3, etc.)?Quote from: CBMatt on May 26, 2007, 01:16:55 PM

But what I'm wondering is...when using Sidewinder's code, how can I prevent overwriting? I'm not too worried about it with xcopy, but it's a problem with his code.
...

Try experimenting with the -y switch.

Check out:
http://www.vfrazee.com/ms-dos/6.22/help/xcopy.htm
and
http://www.vfrazee.com/ms-dos/6.22/help/copy.htm

Note the EXPLANATION:
" (Previous versions of MS-DOS would simply replace the
existing file.) If the COPY command is part of a batch file, COPY will
behave as in previous versions. "


Bear in mind that this info was written about MS-DOS.

Quote from: CBMatt on May 26, 2007, 01:16:55 PM
Better yet, how could it be set up to automatically rename like-named files (California(1).mp3, California(2).mp3, etc.)?
How about this:
Code: [Select]@echo off
setlocal
set Source=C:\Documents and Settings\Owner.Murgatroyd7\Desktop\test
set Dest=C:\Documents and Settings\Owner.Murgatroyd7\Desktop\curious

for /f "delims=" %%a in ('dir "%Source%\*.mp3" /b /s') do (
if exist "%Dest%\%%~na%%~xa" (
call :IncrementFile "%%a"
) else copy "%%a" "%Dest%"
)
goto :EOF

:IncrementFile
for /l %%b in (1,1,99) do (
if not exist "%Dest%\%~n1(%%b)%~x1" (
copy %1 "%Dest%\%~n1(%%b)%~x1"
exit /b
)
)That should rename up to 99 copies of the same file. It takes all the .MP3 files from SOURCE and all of it's subdirectories and puts them all in a flat directory of DEST.

Is that what you are looking for?That's perfect, Gary. Thanks a lot for that!

And thanks for the links, Willy. I'm going to read up on those when I have some free time tonight.



Dark Blade...I believe I'm done with rudely hijacking your thread. I hope my questions here benefit you as much as they benefit myself.Well, at least you waited unitl my question was answered before hijacking, so I guess it was alright.

This thread (and your hijacking of it) has actually helped me learn a few things about the for command. It's not as hard as I thought!

Code: [Select]if not exist "%Dest%\%~n1(%%b)%~x1" (
copy %1 "%Dest%\%~n1(%%b)%~x1"
But not smart enough to have ANY idea what that means.


Anyway, I'll rename this POST Resolved, to get into the spirit of things.Quote from: CBMatt on May 26, 2007, 10:12:28 PM


And thanks for the links, Willy.

You're welcome.

Quote
I'm going to read up on those when I have some free time tonight.


Instead, you might want to bookmark this:
http://www.vfrazee.com/ms-dos/6.22/help/

That's pretty much what we used to get when we typed help at the command line, back when Billy was only worth a few hundred million bucks.

Everything on that page that is ENCLOSED in the green < > symbols is a link.


6526.

Solve : Can I copy Shotcut From StartMenu To DESKTOP?

Answer»

Can I copy Shotcut From STARTMENU To DESKTOP

try like this but not WORKING geting error "syntex of the command is incorect"

pls help me

echo off

copy C:\DOCUMENTS and Settings\All Users\Start Menu\Programs\shotcut1.lnk C:\Documents and Settings\All Users\Desktop
ren C:\Documents and Settings\All Users\Desktop\shotcut1.lnk shotcut2l.lnk

pauseYou need to put quotes around the file names if they have SPACES in them. Try:
Code: [SELECT]copy "C:\Documents and Settings\All Users\Start Menu\Programs\shotcut1.lnk" "C:\Documents and Settings\All Users\Desktop"
ren "C:\Documents and Settings\All Users\Desktop\shotcut1.lnk shotcut2l.lnk"

6527.

Solve : make html file with everything inside?

Answer»

Hi everyone. I would like to make a bat file that makes a file CALLED htmlpage.html and it has all the tags in the file.

So far i have

Code: [SELECT]ECHO.html>htmlpage.html
ECHO.
ECHO.title>>htmlpage.html
ECHO.
ECHO./title>>htmlpage.html
ECHO.
ECHO.body>>htmlpage.html
ECHO.
ECHO./body>>htmlpage.html
ECHO.
ECHO./html>>htmlpage.html

problem being i cant put the <> on any of them. If i do then it doesnt work. It's the only way i know how to WRITE something into a file. PLZ could someone show me how to do this?

Thanx in advance.Try escaping the special characters using a caret (u/case 6)

e.g. echo ^ >filename
echo.
echo ^ >>filename

etc...

GOOD luckah thank you very much. yay it works. thanx man.Thanks for coming back..

6528.

Solve : how can i make shotcut via batch file?

Answer»

I want to make SHOTCUT on desktop
how can i do this
pls help meHow can i get the desktop path
please help me


reply soon
1. copy this batch file to notepad
2. SAVE to your desktop as show.bat
3. double click to see desktop folder path

Code: [Select]@echo off
echo this batch file is in directory:
echo %~dp0
echo.
pause



Do you want to list your Desktop directory? Your Desktop should be at:
%HomeDrive%%HomePath%\Desktop

So you can try:
Code: [Select]echo My Desktop is in the directory %HomeDrive%%HomePath%\Desktopor
Code: [Select]cd /d %HomeDrive%%HomePath%\DesktopQuote from: shajahan on May 26, 2007, 12:21:50 PM

I want to make shotcut on desktop
how can i do this
pls help me
you can use vbscript
Code: [Select] Set oWS = WScript.CreateObject("WScript.Shell")
shortCut = "C:\temp\myshortcut.lnk"
Set oLink = oWS.CreateShortcut(shortCut)
oLink.TargetPath = "C:\temp\test.bat"
oLink.WorkingDirectory = "C:\temp"
oLink.Save


or you can use the shortcut.exe resource KIT from NT
6529.

Solve : how to change your IP with a batch file??

Answer»

So I would really like to know how to change my IP with a batch FILE. I know about Netsh.exe and IPConfig but they don't seem to do anything? I probably not using them right can some one show me how to do this? I also would to say hey and thanks for the quick reply earlier. Big Help!!! NETSH should be able to do it for you. What do you want to change it to? Here is the command line to change it to 192.168.1.100/24 with a gateway of 192.168.1.1 and a metric of 1:
Code: [Select]netsh int ip set address name="Local AREA Connection" source=static 192.168.1.100 255.255.255.0 192.168.1.1 1Tried it but it still does nothing so to see if it changed I type ipconfig but it's the same as it was. Why do you want to change your IP?

What sort of network connection do you have? Are you on a LAN, wired or otherwise, a DSL modem, a cable modem? Because, depending on what kind of connection you have, it may not be possible to change your IP address in the way that you envisage. In connection with this, you could type "DHCP explained" into Google.



Do you have just one network card? Is the network card you want to change called "Local Area Connection"? Post the results of your IPCONFIG and we'll see what we can figure out.Well theres not really one reason. just allot of little ones basically I just want to know all that there is to know. I already know C++, Visual Basic, C#, Java, HTML, PHP, Assembly, Max Script, Maya Mel Script and etc. and also I'm using a cable modem with a wireless linksys router and here is the output:

Windows IP Configuration


Ethernet adapter Hamachi:

Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 5.152.11.87
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . :

Ethernet adapter Wireless Network Connection:

Connection-specific DNS Suffix . : triad.rr.com
IP Address. . . . . . . . . . . . : 192.168.1.102
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

Quote from: BlazingClaymore on May 25, 2007, 02:55:35 AM

I already know C++, Visual Basic, C#, Java, HTML, PHP, Assembly, Max Script, Maya Mel Script and etc.

Wow! You know all that, and you're stumped by a little thing like changing your IP in a batch file?

Have you tried etc++ ?



you can use vbscript
Code: [Select]Set Adapters=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2").ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=true")
IPArray = Array("192.168.1.100")
MaskArray = Array("255.255.255.0")
GatewayArray = Array("192.168.1.1")
GatewayMetric = Array(1)
For each NIC in Adapters
NIC.EnableStatic IPArray, MaskArray
NIC.SetGateways GatewayArray, Gatewaymetric
Next
The reason my initial post didn't change your IP address is because I assumed your computer was using the default adapter name. For your case, if you want to change the IP address of your wireless card, the command line to change it to 192.168.1.100/24 with a gateway of 192.168.1.1 and a metric of 1:
Code: [Select]netsh int ip set address name="Wireless Network Connection" source=static 192.168.1.100 255.255.255.0 192.168.1.1 1Or for your other (Hamachi) card, the code would be:
Code: [Select]netsh int ip set address name="Hamachi" source=static 192.168.1.100 255.255.255.0 192.168.1.1 1Dah! why didn't I think about it like that. well the main reason why I don't know this stuff is because I've never had the internet before but now I do. I'm also learning sock PROGRAMING with C++ now. For some reason my internet connection gets messed up when I change my IP. what can the problem be? I had to unplug every thing then plug it all back in.Your internet connection uses your IP address. Why are you changing it? And what are you changing it from and to?I don't know but I think it may have SOMETHING to do with DNS thing? because its empty when it doest work. Try adding this as the following line in your batch file (change the adapter name and IP adress for your needs):
Code: [Select]netsh interface ip set dns "Hamachi" static 192.168.1.1
6530.

Solve : autorun file?

Answer»

how would i write an autorun program that would run when i plugged in my flash drive?I think the closest thing to what you WANT is AUTORUN.INF, but I don't think AUTORUN.INF will work on flash drives.

U3 drives accomplish this by creating a CDFS partition on flash drives and launching an AUTORUN.INF file on the CDFS partition. So start by looking at autorun and U3. Post back if you have more questions.I have an autorun on my usb drive.
Code: [Select][autorun]
icon=myicon.ico
Put the Autorun.inf in the root of your drive with the icon and it gives the flash drive an icon. You have to unplug it and then replug it and you will have a personal icon.Quote from: goodnatureddog on May 11, 2007, 03:53:28 PM

how would i write an autorun program that would run when i plugged in my flash drive?

What exactly do you want it to do? You gotta help us out here if you want definite answers.

And autorun.inf, by the way, will work on a flash drive.I'm trying to write an autorun file for portable apps, i get sick of have to tell it what to do every time i plug it in. also i want to write one for a cd that i have some homemade games on, i want to start the menu from the cd when the cd is put in, i have that covered with a batch file. so in a nut shell, i nned something to autorun portableapps and a batch file from a cdYou are still not being specific for a PROBLEM that requires specifics...in other words i don't think you can write a batch file for your flash drive that says run all my stuff right now....
See the issue ? ?Check out this LINK from Microsoft:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/autorun/autoplay_cmds.aspI'm not saying i want it to be a batch file, i want it to run a batch file from my flash drive
6531.

Solve : Send files?

Answer»

Hey Guys!

I was wanting to make a batch FILE search for my internet IP address and send it to my email address.

or

make a batch file, make a txt file with the IP in it, and it sends it to me via email.

If anyone could at least lead me in the right direction, that would be great!

Thanks


--EDIT: Or does someone know of a command to send files from one computer to an email address?--This sounds DEVIOUS....

You don't plan on doing this on someone else's computer, do you?no.....then why do you want to send a computer's IP to yourself?carbon read this

Quote from: jimmyplex123 on July 06, 2008, 01:46:33 PM

I was wanting to make a batch file search for my internet IP address and send it to my email address.
he wants his ip address but this is very fishy. jimmy could you tell us what you are trying to accomplish?To see your ip address, click on any one of these links:

http://www.google.com/search?hl=en&q=whats+my+ip+address&btnG=Google+Search

For example: http://whatismyipaddress.com/or just type ipconfig on your command prompt.Hmmm...he deleted his account.... Perhaps my assumption was right?well we only gave him info on how to GET your computer's IP address.
so he CANT do any thing bad.Quote
I was wanting to make a batch file search for my internet IP address and send it to my email address.
If it's his own computer, why does he need to send it to himself using a batch file? good question , this is QUITE unusual...
6532.

Solve : The Play Command?

Answer»

I worked for quite a while to figure out how to express a certain piece of music in the play command's syntax..
(You know, a5 c4 ...)

..a good while ago, for my Mother.

...and then, it went away.

I've never been able to find anything about it again - even, just now, in a list of all MS-DOS commands.

Maybe it was something other than a ~pure command~.

What I wonder, of course, is whether there's something now that would play what I worked out.

...or even something else (free) that I could use similarly.


Any pointers?


Thanks,

-- M.Welcome to the CH forums.

Play is a command in the Basic programming language, does that ring any bells?Thank you, Dusty.

(and maybe hee hee (ie: LIKE when someone asked me if I had ever heard of Gamelan, & I said "Doesn't ring a bell.") )

Embarrassingly, I discovered that with some more (fortunate) Googleing in the meantime.

Now the question is: Having LIKED that (& maybe even being able to find the FILE I created way back then), what's available now like(ish) that that I might like?

(I've also found ANSI Play and Melody Maker, but haven't had time to get into them very deeply. I bet that some of the things out there like these are quite good, and some not so.)


Thanks again,

-- M.you could also try the start command to play a sound(note it will play the sound in a sound player, such as Windows media player)

try this

Code: [Select]start <name of sound>.wavQuote from: Dusty on July 06, 2008, 05:14:23 PM

Welcome to the CH forums.

Play is a command in the Basic programming language, does that ring any bells?

Was there a ~version~ of DOS, then, that would sorta forward commands to Basic?
(bec. I remember working with this stuff in a DOS window, & as a batch file -- but I've never done (much) Basic at all)no SORRY PMH but some of the MS-DOS versions, i believe version 5 and later had QBasic which was a program that could make Basic programs and yes it did SUPPORT playin of sounds but why dont you try this?

Quote from: macdad- on July 06, 2008, 07:53:21 PM
you could also try the start command to play a sound(note it will play the sound in a sound player, such as Windows media player)

try this

Code: [Select]start <name of sound>.wav
6533.

Solve : How to connect two string with a line break???

Answer»

@echo off
set str1=this is LINE 1
set str2=this is line 2

rem how to write FOLLOWING code???
set STR3= ??

echo %str3%
pause



the result is:
this is line1
this is line2

Code: [Select]@echo off
set str1=this is line 1
set str2=this is line 2
echo %str1% && echo %str2%

By concatenating the two echo commands, you effectively insert the carriage RETURN line feed characters.

thank you very much!

6534.

Solve : command or Program that can terminate an application after specified time?

Answer»

Greeting,
I am looking for a command or a program that can terminate an application after a specified time. Say, I want to run a certain Application for 12 hrs and I want to end it after 12hrs is passed and start another application.
any help is appreciated/Vansky03Code: [Select]@echo off
set time=43200
:loop
cls
IF %time% GTR 0 (
set /a time=%time% - 1
echo %time%
ping 127.0.0.1 -n 2 > NUL
goto loop
)
start cmd.exe
pause
this will run cmd after 12 hours (43200 seconds)
hmm i smell a virus...vansky03 do you intend to use this for malicious purposes?Try setting up two batch files.

The FIRST will put the SECOND on the scheduler to run in 12 hours (at command). It will also launch your first program.

The second will contain a taskkill command to kill off the first program and then launch the second program.

Batch code does not do date/time arithmetic very well, however with 12 hours you should only need to flip the am/pm indicator and determine if the new time is tomorrow.

Good LUCK.


Quote from: macdad- on July 05, 2008, 06:33:30 PM

hmm i smell a virus...vansky03 do you intend to use this for malicious purposes?

How so? With all the accusations of VIRUSES and homework, it's a wonder anyone is willing to post a question.the title says "command or Program that can terminate an application after specified time". "terminate" MEAINING delete

Quote
ter�mi�nate �audio� (t�rm-nt) KEY �

VERB:
ter�mi�nat�ed , ter�mi�nat�ing , ter�mi�nates
VERB:
tr.

1. To bring to an end or halt: "His action terminated the most hopeful period of reform in Prussian history" (Gordon A. Craig).
2. To occur at or form the end of; conclude or finish: a display of fireworks that terminated the festivities.
3. To discontinue the employment of; dismiss: a company that terminated 300 workers.

VERB:
intr.

1. To come to an end: The oil pipeline terminates at a shipping port. Negotiations terminated yesterday. See Synonyms at complete.
2. To have as an end or result: "The Peloponnesian war ... terminated in the ruin of the Athenian commonwealth" (Alexander Hamilton).


Quote
the title says "command or Program that can terminate an application after specified time". "terminate" meaining delete

Taskkill can terminate a program. It can delete a program from memory, not from disk. Del can delete a program from disk, not from memory.

Why are you assuming the worst about the posters? Your nomination to the CH Welcome Wagon may be in serious jeopardy.

im sorry sidewinder.
i guess that i was jumpy.
but vansky is gone...
and he didnt thank you nor jacob.Greeting,
Did not mean to be ungrateful to you all, just did not have a chance to try the codes until today and it's worked great.
Thank you all/Vansky.
PS. no I am not using the program as a virus or malicious purpose.ok. i apollogize vanksy for any assumptions i made about you using this for malcious purposes.Not a problem Macdad,
I guess the Title does suggest so, what I really mean is to end the current running app after 12hrs then start another.
peace..
6535.

Solve : Need help with specific batch file?

Answer»

Firstly I have had a good LOOK through these forums, I found a heap of stuff that was interesting
but nothing quite like what I need.

Firstly the set up is one server with Windows Server 03 on it, then 6 (for now) client machines
all running XP PRO SP2.
The script needs to run entirely from the client machine..
The tasks it needs to execute in order are;

1- prompt for a computer name to REMOVE from AD on the server
2- Add a specific computer name to AD on the server
3 - Prompt for a new computer name for the client machine, add this new name to the domain, then reboot
I would then have a simple bat file "IPCONFIG /registerdns" that runs from the startup on boot which should update the dns on
the server with the new details.

I'm currently able to partially do this but with different bat files and a vbs on the server.
The current process is, I remote desktop to the server, then run a vbs file which prompts for a computer name to delete from the AD (I have to manually add the other name into AD)
Then back on the client machine run the .bat file which adds a computer to AD on the server,
prompts for new computer name for the local machine, adds this to the domain and reboots.

The batch file I'm using for the rename, join & reboot process is below.

Quote

netdom add /d:domain.local computername
set /p newname="newname: "
netdom renamecomputer %computername% /newname:%newname% /userd:domainadmin /passwordd:domainpassword /usero:localadmin /passwordo:localpassword /reboot:05

All I need at this point to MAKE it work is a bat file that can prompt for a computer name to remove from AD on the server.
My knowledge is fairly limited on batch files so PLEASE be gentle, but any and all help or ideas are appreciated.
6536.

Solve : Hide window??

Answer»

I know this is a very common question, and there are a lot of answers, however I try to hide (not minimize!) a jar file that run trough the console.
-I don't want to use a shortcut that has properties of minimized/hide, 'cause it should go automaticly hidden on startup
-If I use the visualbasic-scripts from the internet, then the cmd.exe process keeps opening (under windows vista home premium edition), and the process that launches the script (vbscript.exe) keeps GETTING multiplied.
-If I use a external command (that you should add in your windows folder) then I get the error: unknown window handler

Does anyone have ANOTHER IDEA (that would WORK under winvista) to hide my dos window?echo CREATEOBJECT("Wscript.Shell").Run """" ^& WScript.Arguments(0) ^& """", 0, False>a.vbs
wscript.exe a.vbs yourfile.bat


run a .bat file invisible with the above, im assuming this is what you want.. you need to hide the console and not the jar file right?

6537.

Solve : batch rename file with date on windows 2003?

Answer»

hy! i have this

for /f "tokens=1-7 delims=." %%d in ("%date%") do rename "c:\test.txt" %%d.%%e.%%f.txt

i run this script in windows xp and it works FINE but under windows 2003 i GOT this

"The system cannot find the FILE specified."

why?

(every path is ok)

thank you all!
A guess... the 2k3 setup has a different date format producing illegal characters?

You're quite sure that c:\test.txt exists, is not HIDDEN or read only, and you have privileges to modify it?

If you REWRITE the code like this

for /f "tokens=1-7 delims=." %%d in ("%date%") do (
echo %%d.%%e.%%f.txt
rename "c:\test.txt" %%d.%%e.%%f.txt
)

what do you see?

6538.

Solve : how can i reset windows xp gui to default throught msdos??

Answer»

on my computer I have installed custom themes which for some reason stopped working and set everything in the GUI to black except for icons and the background. I have tried to reset the GUI through control panel but because everything is black on black and i cant read it has been unsuccessful. If SOMEONE could please give me a way to reset the GUI to all defaults through DOS i would be very grateful. Thanks, Motsumuto.Try booting into SAFE mode by tapping F8 repeatedly.......CHOOSE the first option Safe Mode" and see if you can change it there.
What PROGRAM was this ?

6539.

Solve : Read parameter from file?

Answer»

MBox.exe is application, it can accept one parameter.

how can i start mbox.exe with the parameter readed from a file( tmp.txt ).

i try it as FOLLOWING:

start mbox.exe

but the mbox.exe can't accept the parameter in tmp.txt, why???i DONT have mbox.exe , so theres no way to tell for SURE.. but you could try the for command


for /f "tokens=1*" %%a in (tmp.txt) do start mbox.exe %%athanks your REPLY, but i want to GET all the message once from the tmp.txt as the input parameter.

how can i do this?

6540.

Solve : Take the output of one command and use them in another command..???

Answer»

How do I Take the OUTPUTS of this command:

DIR %SYSTEMDRIVE%\DOCUME~1 /AD /B

and for each output name listed do this command:

net localgroup ADMINISTRATORS %USER-NAME% /addfor /f "delims==" %%D in ('DIR %SYSTEMDRIVE%\DOCUME~1 /AD /B') do net localgroup Administrators %%D /add

6541.

Solve : Find certain directory that has spaces in it's name.?

Answer»

I am making a batch file that searches for a certain folder and if it exists copies files to it.
MS-DOS does not search for a directory, but null device exists in every folder.
According to the Help file "if exist C:mydir\nul goto process" searches for the null device.

But WHENEVER there is a space in the folder name, it refuses to work.
Here is a tuned down version I ran as a test. It won't work either.

@=========
@ECHO off
If exist "c:\aa bb\nul" goto cont else goto knock

:knock
echo no folder
pause
exit

:cont
echo folder found
pause
exit
@========

If I take out the space it WORKS just fine, but the thing is: I need that space.
Can Anyone help me out here?
Kinda new to this stuff.

Greetings,
Dramklukkel

WinXP Pro, SP2use quote marks

"c:\path and\directory name with spaces"Hi Dias,

Thanks, but I did use these quotes. That's the frustrating PART of it. You shouldn't need the nul device in XP.

Code: [Select]If exist "c:\aa bb" goto cont else goto knock

searching for \nul is not advised on ntfs.
ROTFL.
The help file in XP told me to do just that. To search for the nul device.
You guys were right. It ONLY works perfectly well without it.

Thanks, both of you.
Dramklukkelalso, NT/2K/XP/2k3/Vista command prompt is NOT MS-DOS.
Quote from: Dias de verano on July 09, 2008, 08:29:37 AM

also, NT/2K/XP/2k3/Vista command prompt is NOT MS-DOS.

You're right. I meant CMD.
6542.

Solve : Can i Create a MessageBox with batch command???

Answer»

Can i Create a MessageBox with appointed caption and displaying message using batch command??Yes, sort of
You can create a short vbscript file with the messagebox in it, you could write the response from the messagebox to a file and read that in your bat

Grahami know i can start a exe file displaying a messagebox implemented by c or c++.

but i want to know whether i can start a messagebox directly with batch command or not.Quote

but i want to know whether i can start a messagebox directly with batch command or not

Batch code does not support messageboxes, popups, or windows. However this little novelty script maybe helpful:

Code: [Select]@echo off
start %comspec% /c "mode 40,10&title My Popup&COLOR 1e&echo.&echo. Today is %DATE%&echo.&echo. Press a key!&pause>NUL"

This is one of those scripts where you keep asking "What was I thinking"

What about:

msg * Hello!!!!!!!!!!

That works in Command Prompt and in a batch file.echo msgbox"yourmesagehere">a.vbs,&;a.vbs <echo for i = 1 to 10>a.vbs &;echo msgbox"yourmessagehere">>a.vbs &;echo next>>a.vbs << to display 10 timesQuote from: diablo416 on July 05, 2008, 06:38:57 PM
echo msgbox"yourmesagehere">a.vbs,&;a.vbs <<to display once

That doesn't work, GIVES a VBS compilation error.

This does

Code: [Select]echo msgbox"your message here">a.vbs&a.vbs
(The semicolon and comma were causing the error)

that was a typo SORRY,

echo msgbox"yourmesagehere">a.vbs &;a.vbs is what i ment instead.Quote from: diablo416 on July 07, 2008, 10:24:04 AM
that was a typo sorry,

echo msgbox"yourmesagehere">a.vbs &;a.vbs is what i ment instead.

You don't need the semicolon (';')

This is tidier because it deletes the vbs afterwards

Code: [Select]echo msgbox"your message here">a.vbs&a.vbs&del a.vbs
6543.

Solve : learning about and to create batch files?

Answer»

Hello

As an absolute beginner where and how do i start to LEARN about creating BATCH files

carn't really add anything else, until i KNOW more about them.


thanks everybody
type "write batch files" into Google
or GOTO this link
MS-DOS Batch File Help

6544.

Solve : Testing for JRE?

Answer»

Hello all

I need to test if the Java Runtime Environment is installed on the local computer before running a program. If it isn't I default to another version of the program.

Any ideas on how I would do that?
Surprisingly you can use Java to determine if the JRE is installed.

Code: [Select]@echo off
for /f "tokens=* delims=" %%v in ('java -version 2^>^&1 ^| find /i "runtime"') do (
if errorlevel 1 echo %%v && GOTO :eof
)
echo Java NOT installed

A little misdirection redirection, some SMOKE and mirrors and you've got an instant cup of coffee.

Ok I tried to modify this to get myself a cup of cofee and am having a problem.

Here is my script:

REM Test to see if the Java Runtime is installed on the local computer
if {%MYQKC%}=={qkj} (
for /f "tokens=* delims=" %%v in ('java -version 2^>^&1 ^| find /i "runtime"') do (
if errorlevel 1 set MYQKC=qkc
)
)

Here is the executed command:

C:\>REM Test to see if the Java Runtime is installed on the local computer
C:\>if {qkj} == {qkj} (for /F "tokens=* delims=" %v in ('java -version 2>&1 | fi
nd /i "runtime"') do (if errorlevel 1 set MYQKC=qkv ) )

C:\>pause

Shouldn't the errorlevel check be a variable?
As in:

if {%MYQKC%}=={qkj} (
for /f "tokens=* delims=" %%v in ('java -version 2^>^&1 ^| find /i "runtime"') do (
if %ERRORLEVEL% NEQ 0 set MYQKC=qkc
)
)

Either way it is not setting the variable correctly.
HELP....Was there something wrong with the POSTED code. I thought it was rather clever! If I read your modifications correctly, this may help you out:

Code: [Select]@echo off
for /f "tokens=* delims=" %%v in ('java -version 2^>^&1 ^| find /i "runtime"') do (
if errorlevel 1 set myqkc=qkc && goto :next
)
set myqkc=qkv

:next
.
. your code goes here
.

By replacing your code goes here with %myqkc%, the appropriate program will run.

Good luck. I copied your code into my script and nothing happens. This computer has Java installed so I expected the variable to change to qkc:

SCRIPT:
@echo ON
echo %MYQKC%

REM Test to see if the Java Runtime is installed on the local computer
for /f "tokens=* delims=" %%v in ('java -version 2^>^&1 ^| find /i "runtime"') do (
if errorlevel 1 set MYQKC=qkc && goto :next
)
set myqkc=qkv

:next

echo %MYQKC%
pause


RESULTS:

C:\>echo qkj
qkj

C:\>REM Test to see if the Java Runtime is installed on the local computer

C:\>for /F "tokens=* delims=" %v in ('java -version 2>&1 | find /i "runtime"') d
o (if errorlevel 1 set MYQKC=qkc && goto :next )

C:\>(if errorlevel 1 set MYQKC=qkc && goto :next )

C:\>set myqkc=qkv

C:\>echo qkv
qkv

C:\>pause
Press any key to continue . . .Ok nevermind I got it. I changed the script to store the contents of the errorlevel and tested for that:

REM Test to see if the Java Runtime is installed on the local computer
if {%MYQKC%} NEQ {qkj} goto NOTJAVA
for /f "tokens=* delims=" %%v in ('java -version 2^>^&1 ^| find /i "runtime"') do (
set JRETEST=%ERRORLEVEL%
)
if {%JRETEST%} NEQ {0} set MYQKC=qkv
:NOTJAVA

6545.

Solve : Need to get the File Size??

Answer»

Hi Friend,

I need to know the DOS COMMAND to get the SIZE of the file.

For example, i am having file named as "Vinoth.Txt" with the size of 80Kb.
I need know the size of that file using dos command. And also i need to print that Size using echo statement.

Please help me to RESOLVE this issue.

Thanks in advance.

Regards,
Vinoth R set filename=Vinoth.txt
for /F %%A in (%filename%) do set filesize=%%~zA
echo file size is %filesize% bytes

6546.

Solve : Need help with "Diskpart" and "Shutdown" command?

Answer»

Hi all, I have a question about VB script that I hope you guys can give me some help on. Here's the situation I ran into.

I am creating a program that's needs to be run on both WIN2K3 32-bit and 64-bit. The program works fine on the 32-bit Win2k3. But when I runs it on the 64-bit ED, it broke. What I have is a vbscript that calls and try to execute a cmd file. It contains "diskpart" and "shutdown". Those are the two commands that has problem when I run the script. It says that those two commands are not recognized as an internal or external command, operable program or batch file. But when I just type in those commands on the command line without the .cmd file, they works just fine.

Can anyone give me some pointers in about how to GET this fixed or a way around it? Thanks for the help.

MichaelQuote

What I have is a vbscript that calls and try to execute a cmd file.
file

Please show us the code that executes the cmd file. You may have to use paths on the diskpart and shutdown commands.

Prior to the cmd file execute, trying expanding the %path% variable to see if the system32 directory is included. In the batch file also check the expansion of the %path% variable. Something may have gotten messed up in the switch between the vbs and cmd environments.

Here's the simple code that I am running.

Code on VBScript:

set shell = CREATEOBJECT("WScript.shell")
shell.Run "run_restart.cmd"

================================
Code on the command file:

diskpart
shutdown
pause


It's really nothing flashy. But those two commands is totally throwing off the program. I have checked out %path% on the regular prompt and running it on the command file. They are showing the same paths.

Thanks for taking the time check out this thread. Any help will be greatly appreciated.

MichaelQuote
I have checked out %path% on the regular prompt and running it on the command file. They are showing the same paths.

I was trying to find out of the system32 directory was on the path that the cmd file was using.

The easiest solution would be to point the diskpart and shutdown commands to their home directory:

Code in command file:
Code: [Select]c:\windows\system32\diskpart.exe
c:\windows\system32\shutdown.exe
pause

I SIMPLY copied your command file but be aware the pause statement will never get executed.

The above code is only a workaround. Check out if the c:\windows\system32 directory is on the path by adding this code to your VBScript:

Code: [Select]WScript.Echo "Path is " & Shell.ExpandEnvironmentStrings("%Path%")

I got it fixed, I think. I am still not so sure why though. Here's what I was doing.

command file 1 - execute a .vbs file using "call"

on the .vbs file - calling command file 2

on command file 2 - contains "diskpart" and "shutdown"

The two commands never got recognized. But after switched "call" to "cscript" using that to excute the .vbs file. It was working out just fine. Maybe there was something fishy about "call", I suppose.

But anyway, thank you so much for reading this threat and the help, really appreciated!

MICHAEL
6547.

Solve : Trying to change file extensions?

Answer»

Hi there. I have a tool that will process images from one FORMAT to another. I have the list of filenames to be processed but I'm having difficulty in getting the batch file to run properly the code is:
Code: [Select]for /F "delims=," %%a in (imagelist.lst) do (
set oldname = %%a
set newname =%oldname:.*=%
convert %%a %newname%.jpg
)

but it seems that newname does not set correctly. any Ideas?Be very careful about introducing spaces in a set command. Spaces are actual characters.

The star (*) on the set newname statement does not act as a wildcard. You'll need to spell out exactly what the extension is, or parse the file name to extract the information.

Good luck. Thanks, I changed the spacing and got a better response but it's still reading in a value for newname that was set outside the script. Is there a better way of stripping any extension and replacing it with .jpg ?What is confusing the the comma delimiter. If you have one image name per line then this should work:

Code: [Select]for /F "tokens=1-2 delims=." %%a in (imagelist.lst) do (
convert %%a.%%b %%a.jpg
)

The for statement READS one line from the input file on each loop. If you have multiple image names SEPARATED by commas on each line, you'll need to parse the entire line. This will involve rethinking the structure of the batch file.



Thanks sidewinder, I appreciate the help

I'm new to DOS scripting, coming from UNIX it's hard

OK, I can reformat the input file, at the moment it LOOKS like this :
Code: [Select]Test.eps,
one.png,
two.eps,
So I'm going to knock out the end comma and try your solution on:
Code: [Select]Test.eps
one.png
two.epsThere is no need to change your data. A simple tweak of the batch code will account for the comma:

Code: [Select]for /F "tokens=1-2 delims=.," %%a in (imagelist.lst) do (
convert %%a.%%b %%a.jpg
)

Good luck.
Sidewinder you superstar !!!! Thanks that worked perfectly.

I really appreciate the help. Cheers

6548.

Solve : Setting 'Type' As A %Type%?

Answer»

Hello, Say i read something from a text file CALLED text.txt.
How would i set this as %text% or whatever.
Example:
Say HP.txt saves your current hitpoints (life)
I then NEED to do something like
set /a HP=%HP%-%Damage%
Where %HP% is the number in the text file.
How would i set the number in the text file to %HP% so i can then do some arithmetic.
Any Help Is Appreciated
If this was text.txt:

Code: [Select]10
Then it could be read like this:

set /p health=<"C:\documents and settings\%username%\desktop\text.txt"

Try that.If you have more that txt files i have better idea. You can echo all those variables into one file ex. Code: [Select]10 50 5will be Code: [Select]health SCORE level then you can MAKE sth like thisCode: [Select] for /f %%a in (file) do (
set health=%%a
set score=%%b
set level=%%c
) Thank you both, i feel that although devcom, your issue is more practical, i feel that dudeoxide is more simpler and works better for me, once again, thank you both.No problem.

How's the game coming along?Quote from: Carbon Dudeoxide on July 08, 2008, 02:28:02 PM

No problem.

How's the game coming along?
kinda stopped making it really.
haven't had time.Quote from: Carbon Dudeoxide on July 09, 2008, 12:46:19 PM

Yeh
That's life.
6549.

Solve : Start a chosen program, then another?

Answer»

What I need is a batch file that will give me a choice of three programs to start, and a choice to not start any of them.
It then needs to give me a choice of several more programs, and exit after I've made this second choice.
If possible it should let me press a number, e.g. press 1 for PROGRAM 1, 2 for program 2, 3 for program 3, 0 for no program, and then 1 for program 4, etc.
Is this possible to do?
Thanks in advance for any help or advice.This command is called choice
Code: [Select]choice /c 1230
if %errorlevel% equ 1 start prog1

if %errorlevel% equ 2 start prog2

if %errorlevel% equ 3 start prog3

if %errorlevel% equ 4 GOTO A
:A
however if you have xp you have not this commandI should have mentioned I am using XP, is there an ALTERNATIVE to the choice command?
Thanks for your help.Code: [Select]set /p choice=
if '%choice%' equ '1' start prog1
etc
but you must hit enter
i can PM you and send you a choice.exe if you wantSorry for the inconvenience but I've sorted my problem a different way, without using batch files.
Thanks for the help anyway though, it's APPRECIATED.

6550.

Solve : Help with the at command?

Answer»

Hey all,

I am having trouble getting the at command to work the way I wish it to. can some one please tell me how to add a scheduled task with an id or name I choose?


here is an example of what I wish to do
Code: [Select]at "\\computer" 99 13:30 "C:\WINDOWS\test.txt"

thanks,
WayneNot sure you can. You can always use the GUI to rename the job, but if you do, the AT command will no longer have access to that job.

The Windows scheduler USES two API's. The GUI API can see jobs placed on the schedule by the AT command. The AT API cannot see jobs put on the schedule by the GUI.

I am not sure what is the actual command that you wish to execute at 13:30 but my guess is that the command that you wish to run has to end with either EXE, bat or other similar extension, I am not sure txt will do it.

If you wish to run AT on the local computer, you don't need to specify the computer name but if it is for a remote computer, your login account has to have admin rights on that remote PC this to work.

Here is an example AT script that I created and used couple of days ago just ti give you an idea:

at \\computer 21:00 /every:M,T,W,Th,F shutdown -s -f -t 300

which will shut down the remote computer at 9PM Mo- through Fri, giving 5 minute LONG waiting time for the user in case the computer is in use at that time.

The command itself is indicated with red, you can substitute it with any other command.

Geza
That is the way I was working with the at command. But it would not allow me to change the name from at1, at2, at3, ext.

You can run any ext that your computer knows through that at command.

Quote from: Geza on July 03, 2008, 06:41:26 PM

I am not sure what is the actual command that you wish to execute at 13:30 but my guess is that the command that you wish to run has to end with either exe, bat or other similar extension, I am not sure txt will do it.

after looking through possable commands I found the following:

schtasks

This is Microsoft's replacement for the at command. It dose everything the at command will and ALSO lets you set things like a unique name for the tasks you are setting up.Hi,
I am familiar with "schtasks" but your question was "at" related.

Personally I just keep track of the ATx names in my notes of which at tasks contains what.