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 ? did you restartso 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. |
|
| 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. |
|
| 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. |
|
| 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? |
|
| 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? |
|
| 6507. |
Solve : batch scripting? |
|
Answer» File not Found - Goto 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, 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! |
|
| 6509. |
Solve : tough topic - single instance running baddly? |
|
Answer» Hello, i have this script not running ok, it depends how it is launched. |
|
| 6510. |
Solve : Batch file for Laoding Programs from CD? |
|
Answer» Good afternoon all, tried a search but was unsuccessful... |
|
| 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 AMSo 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).if you have XP you can use powershell. its easier. Quote Object oriented shell programming isn't everybody's cup of tealike 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.csvis: 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. |
|
| 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. 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: |
|
| 6515. |
Solve : Re: format usb? |
|
Answer» If your USB flash drive is X:, you COULD do something like: |
|
| 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. If you want only the first line, use this 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" |
|
| 6518. |
Solve : Changing a character in text? |
|
Answer» need help to Changing a character in text Microsoft Windows XP [Version 5.1.2600]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? 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? |
|
| 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... |
|
| 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 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 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 |
|
| 6525. |
Solve : Resolved: Moving all .mp3? |
|
Answer» There we go, that did it! This will surely come in handy. Thanks! 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
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 |
|
| 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. |
|
| 6528. |
Solve : how can i make shotcut via batch file? |
|
Answer» I want to make SHOTCUT on desktop I want to make shotcut on desktopyou 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: 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. 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.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.. Welcome to the CH forums. 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) |
|
| 6533. |
Solve : How to connect two string with a line break??? |
|
Answer» @echo off |
|
| 6534. |
Solve : command or Program that can terminate an application after specified time? |
|
Answer» Greeting, 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 � 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 netdom add /d:domain.local computername 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. |
|
| 6537. |
Solve : batch rename file with date on windows 2003? |
|
Answer» hy! i have this |
|
| 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. |
|
| 6539. |
Solve : Read parameter from file? |
|
Answer» MBox.exe is application, it can accept one parameter. |
|
| 6540. |
Solve : Take the output of one command and use them in another command..??? |
|
Answer» How do I Take the OUTPUTS of this command: |
|
| 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. 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 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, 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 |
|
| 6544. |
Solve : Testing for JRE? |
|
Answer» Hello all |
|
| 6545. |
Solve : Need to get the File Size?? |
|
Answer» Hi Friend, |
|
| 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. 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: |
|
| 6548. |
Solve : Setting 'Type' As A %Type%? |
|
Answer» Hello, Say i read something from a text file CALLED text.txt. No problem.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. |
|
| 6550. |
Solve : Help with the at command? |
|
Answer» Hey all, 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. |
|