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.

7201.

Solve : How to send just one line from a ping result to a log-file??

Answer»

How do i send just one line containing one specific word, let SAY "TTL" from a ping result to a LOG-file?
I tried :
:start
ping get.no -n 1 | find /V "TTL" >> test.log
goto start

But that just send the number of lines containing "TTL", here "1"

Lars H.Using /V will not display any lines that contain TTL.

Are you wanting the result of TTL output to the log file?What I want is to send the underlined part of the ping result to the log-file.

Squashman gave you the clue. Remove the /V

find /? will show you the help and it should be where you check when something isn't quite right.

/V means Void in ENGLISH, which essentially means 'without' in this context. So you were making find.exe print all lines without TTLThanks a lot, the omittance of the /v switch was the solution. Quote from: Lars H. on December 11, 2013, 02:46:05 AM

omittance

Omission
Sorry!

Proud to be a NORWEGIAN!
7202.

Solve : running a .com program wiht a batch file?

Answer»

I am working on automating a .com file. I think the bast way to do this is with a batch file, but I'm open to suggestions.

To run the .com file I type the name into the windows cmd prompt, then the file runs in its own environment, this is very confusing to me. I changed the color settings on my cmd window, when I run the .com file that section of the cmd window reverts to standard colors.

Once called the .com file asks for 3 user inputs. I can't figure out how to mimic the user. I've tried the standard redirection operators, but the inputs are not being passed.Quote

Once called the .com file asks for 3 user inputs. I can't figure out how to mimic the user

There are free keyboard/mouse macro creators out there. I bought the one from JitBit which can mimic users and fully automate processes like this, especially if the information that is entered is static ( never changes ).

This type of AUTOMATION can be used for good or evil as for Jitbit allows for you to create stand alone macros as EXE's which can run on systems that dont have the software installed. I have only used this software for the good of automation myself such as creating macro's that run as automatic installers that I can launch from thumb drive and have my own complicated unattended automated installs in a corporate environment to multiple systems at the same time after going through a single install with the macro software recording every action and time delay between actions.

I tried all the free macro utilities out there for automating keyboard and mouse and none were stabile enough to put trust into them on a corporate network until I found JitBit which was worth the money. ( Currently using it to automate part of a GAME that requires about 2 hrs a DAY of grinding. I now have a routine that does this gind on my system unattended and I can go back later and spend my in-game virtual money etc to progress further and only have to endure the 30 minutes a day of a fun game that is the fun part and skip over the boring grind part. )

http://www.jitbit.com/macro-recorder/
7203.

Solve : Batch file to copy and Increment?

Answer»
After wasting far too much time trying to figure this out I thought I'd just ask.

I'm trying to write a batch file (OS is WInXP) that will copy (or use xcopy) one .txt file from 1 directory into another directory on a different drive and then increment the file name so I have several backups of the original file.

This is simple DOS stuff but I'm stumped never having WRITTEN batch files.


Any help would be greatly appreciated.

David....This will date and time stamp a file. That's much more useful than a plain number.

The first four lines of this code will give you reliable YY DD MM YYYY HH Min Sec variables in XP Pro and higher.

Code: [Select]@echo off
for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YY=%dt:~2,2%" & set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"

set "fullstamp=%YYYY%-%MM%-%DD%_%HH%-%Min%-%Sec%"

copy "c:\folder A\file.txt" "c:\folder B\file-%fullstamp%.txt" >nul

pauseset destination=C:\Dummy\
set Location=D:\Dummy\Test.txt
set FILENAME=Test
set a=1

:LOOP
if exist %destination%\%filename%_%a% set /a a+=1 && goto :loop
copy %location% %destination%\%filename%_%a%.txt

Untested
Though what foxidrive say's is true, a date\time would be much better for you.Thank you both for your efforts. I will most likely use the one that adds the date stamp but I also like the one that adds -1 to the file name.

Is there a string I can add to that batch file where it will increment file name (filename-1.txt, filename-2.txt, -3.....etc)?
Not in one command, I CREATED a loop that would increment a variable (%a%) by 1 each time it ran, then had it copy the file X times saving it with "-%a%" at the end. This would be the way I would do it, but I'm sure there are may other ways to complete the task.
7204.

Solve : DOS Internet program?

Answer»

Hi guys I'm new to the forum and I was reading some of the topics and I didn't see anything that would help me. I am trying to make a PROGRAM that when I double click on it from the desktop or press a button on my keyboard it goes to a specific url, but when I do this I get this,

mmand to carry out for each file.
command-parameters
ó SPECIFIES parameters or switches for theu♥Θ┬ ü>╠!U!u♥Θ║ ü>╠!║!u♥Θ╟
Θ╩ Θ╤☺♠▒☻ â>Q☻ tâ>Q☻☻u↕╞♠╕☻ â>▒☻ t♠╟♠▒☻ è─ï╫Φ└ⁿY^Ä▲↕♠╧║ô♠╛3☻Φ ░☻δΦ║VPSQRï▐ï≥¼
FIδ♠è╨┤☻═!ΓΓ├SQ░♥÷Γ♥╪èï_☺■╚t'■╚t+ï╣♦ ╤└╤└╤└╤└P$☼♦0<9v☻♦è╨┤☻═!XΓΣδ§u♥Θ┬ ü>╠!U!u♥
Θ║ ü>╠!║!u♥Θ╟ Θ╩ Θ╤☺╕♠╖═/ë▲╧☻3█╕╖═/u♥Θ┬ ü>╠!U!u♥Θ║ ü>╠!║!u♥Θ╟ Θ╩ Θ╤☺

Any IDEA what this is? I think I may have to un it from a batch file but I can't for the life of me remember the code to do this.All that grief most people use links/favoritesyeah but I am creating new ways to SIMPLIFY things and I also work with a lot of older people who have disabilities and need to have it as simple as possible. And if I can make it to where all you have to do is press a button on your keyboard to get to your email or to a specific website then I'm all for it.

7205.

Solve : xcopy and Windows 7?

Answer»

I just bought a Samsung Ultrabook with Windows 7 Home Premium. I use Dos batch files to backup my data but these files do not seem to work. I went into the Dos command PROMPT and tried to use the xcopy command, but I get a reply: xcopy is not a recognized internal or external command... The same goes with robocopy, though both of them should be available in Windows 7. The copy command works, but I need a command that would allow me to copy also subdirectories (switch D) and leave unchanged files alone (switch S).
What can I do?Does it have "c:\Windows\System32\xcopy.exe"

If so then maybe the path is screwedYour prompt session may not have the necessary Administrator permissions. In Windows 7 If xcopy/robocopy don't work from an elevated command prompt then maybe the account you are using does not have the needed NTFS permisssions for the folder you are copying to or from.

http://www.sevenforums.com/tutorials/783-elevated-command-prompt.html

Salmon Trout: surely the error would be different if it was a permissions issue.

Quote from: foxidrive on November 04, 2012, 06:47:34 AM

Salmon Trout: surely the error would be different if it was a permissions issue.

A good point; the OP said he "just bought" the ultrabook; if it is brand new you would expect the PATH system variable to be still set to the default and therefore find xcopy and robocopy. Maybe Fabricious should type PATH at a prompt and tell us what he or she gets? If a new variable, carelessly called %path% is in existence, that will screw things up. Or a rogue program installer could have mangled it.


Fabricious are you sure that isn't Win7 Starter ?/ ? ?
Hi Fabricius!

I am a newbie at this and do not know MUCH. But I would like to try and help.

Maybe you get this strange comment "xcopy is not a recognized internal or external command" because you haven't used it correctly (I imagine and HOPE MS-DOS is properly emulated even in Windows 7)

I really don't know (runs XP) but I think you should be able to, in the command prompt, run:

xcopy c: e: /d /s

if you want to copy all new files (with respect to the residing files in the destination drive, here called e:) from c: to the destination drive, e:

Using the /d-switch will thus enable copying of new files only

and

Using the /s-switch will enable copying of all subdirectories.

Actually I think I will use this command the next time I want to back-up my music. Because I do not want to wait another two hours for all my 5GB music to be copied and Windows actually sucks at this kind of synchronization.

MS-DOS rules!

Best regards, RogerQuote from: patio on November 04, 2012, 09:39:41 AM
Fabricious are you sure that isn't Win7 Starter ?/ ? ?

+1, I'm not 100% sure but it would MAKE sense that Win7 Starter doesn't have Xcopy or RoboCopy installed, and netbooks almost always come with the Starter Edition.Hi!

I would like to refrase my command to:

xcopy c:\path_S e:\folder_D /d /s

where

path_S is the path to your folder which you want to copy

folder_D is the folder you want to create and/or copy to (I think you will be prompted if the folder does not excist)

/d is the switch that makes all the files that are newer than the files in the destination folder (folder_D) being copied

/s is the switch that makes all the subdirectories in the source folder (path_S) being copied

The above destiction is neccesary due to the fact that xcopy cannot copy itself (yields a so called sharing violation).

Good luck!

Best regards, Roger
PS
If you want to copy to a simple USB-stick, destination drive might differ from e:

Personally I ignored your post since it doesn't even come CLOSE to addressing the Original Poster's problem.
7206.

Solve : Redirecting in DOS BAT Files?

Answer»

I am running Windows XP, SP3. The output of the VER command from the Command Prompt window is Microsoft Windows XP [Version 5.1.2600].

Typing a command line works fine:

DIR L: >>D:TESTOUT.TXT

When run from a BAT file, the command RESOLVES to this:

DIR L: 1>>D:TESTOUT.TXT

That is not the only command where this HAPPENS. The BAT file seems to work with this, but a really old version of PKZIP does not like it when run from the BAT file and does not run. I really wanted to capture the output of the PKZIP command in my "TESTOUT.TXT" file. What is happening; how do I prevent these "1"'s?

Thank you!
Bob Brown
Cranberry Twp, PA (Pittsburgh)Tbis is normal. What you see is the command interpreter expanding the redirection operator to show the stream number (1) for stdout; the other one is 2 for stderr. You can't stop it; why do you need to? If you want to hide the commands just put @echo off as the first line of the batch.Thank you. It turns out the reason PKZIP wouldn't work, which is what MADE me post, is I had it commented out. Since then, I have switched from "REM"s to "ECHO"s when I want the commands to show up in the redirected output file. Everything is fine now. - Bob B.

7207.

Solve : Mapping more than one folder to a drive using SUBST??

Answer» HELLO, I was wondering if there is a way to map two different folders to be in the same drive letter?

For EXAMPLE, I have this folder: C:\dir1\dir2

And this folder: C:\dirA\dirB

I would like to have the dir2 and the dirB directories SHOW up on a new virtual drive. Is this possible? I cannot seem to find any examples of it, so I am assuming it is not possible.

Can I simply map them both to the virtual drive? Or will this create a major conflict?

THANKS,
K.
It will not let you add a second folder to the SUBSTed drive. You will get an error message like the following:


c:\>subst h: d:\folder

c:\>subst h: c:\files
Drive already SUBSTedWhat version of Windows are you using. You could possibly do it as a symbolic link if you are using Vista or 7.

On XP you would need to install a 3rd party utility. Well not really THIRD party considering MS bought sysinternals a few years ago. You can download the Junction utility which will allow you to create links for directories.

And just saw this for the first time. A shell extension for Explorer.
http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html
7208.

Solve : Copy Folders Within a Folder?

Answer»

Quote from: powlaz on December 05, 2013, 01:27:18 PM

Salmon TROUT - I UNDERSTAND. And I'll be back. You've always helped me.

And will CONTINUE to do so. PLEASE ask about anything and if I can help I will.
7209.

Solve : How to state directory in xcopy MS-DOS command?

Answer»

Hello guys..

i'm new here and to be honest i know nothing about MS-dos programming. Thanks in advance for helping.

I want to do xcopy command to transfer files from one shared drive to another. I got one example of this command , it suppose to work the same way i want.

xcopy x:\"41DIMENSION" c:\"ikan" /s/m/d:01-01-12/y

But i have to modify it so it would work on my PC. The problem is, stating the new directory. INSTEAD of using x-drive or c-drive, mine is file-sharing with the adress

\\10.101.185.207\file_share\SCAN


Can it be done using xcopy command? How can i modify this?


i'm using Windows XP (version 5.1.2600).


"quotation marks" are only NECESSARY when a filename contains (or may contain) spaces.
So you would want:
Code: [Select]xcopy x:\41DIMENSION c:\ikan /s /m /d:01-01-12 /y
Copying from windows fileshares should be supported, so
Code: [Select]xcopy \\10.101.185.207\file_share\SCAN c:\destination /s /m /d:01-01-12 /y
Should work just fine. If it doesn't, type "net HELP use" (without quotes) into the command prompt to see how to map a network drive from batch. You would assign \\10.101.185.207\file_share\ to the (for example) S: drive, and refer to it like xcopy S:\SCAN.Xcopy supports UNC paths just fine. You should put your quotes around the ENTIRE path, not just one folder name.Also note the trailing backslash on the end of the destination path. This stops xcopy asking if the destination is a folder or a file and assumes it is a folder.

xcopy "\\10.101.185.207\file_share\SCAN\*.*" "\\192.168.1.20\share\folder here\" /s /m /d:01-01-12 /yThanks all.

Thread solved

7210.

Solve : Batch file to Delete some files in a folder?

Answer»

Hi ,
I want to prepare a batch file to delete some of the files in the folder.
For eg: C:\Users\rkhatavkar\New folder contains 20 files.
15 files contains the word "Content" in the filename i.e C:\Users\rkhatavkar\New folder\Content1,C:\Users\rkhatavkar\New folder\Content2 ......C:\Users\rkhatavkar\New folder\Content15.
I want to delete the remaining 5 files which does not have the word Content in it.
Can we CREATE a batch file for deleting these files which do not have the word "Content" in the filename??
Please help......Run this in the new folder DIRECTORY.
It will echo the del COMMANDS to the console only. Remove the 'echo' keyword if you are happy with it to enable the deletions.


Code: [Select]@echo off
for /f %%a in ( ' DIR /b /a-d ^| find /v /i "content" ' ) do if /i not "%%a"=="%~nx0" echo del "%%a"
pause
Thank you very much. It works as expected.This is something that I'm looking for, only I'm TRYING to delete .url file on the desktop that contains "ALLDATA Repair - " in the .url. The only script that I have deletes the specific file name.


FOR %%A IN ("%userprofile%\Desktop\ALLDATA Repair - Login.url") DO DEL %%ASee your later thread for a reply to this question.

7211.

Solve : BAT file to copy last modified file?

Answer»

Below is a script I use to find the last modified file to copy it and put into another location.

Code: [Select]SETLOCAL ENABLEDELAYEDEXPANSION

SET FILEPATH="LOCATION"
REM Arbitrary yyyymmdd starting point, nothing will be older than it
SET NewestDate=20130101

ECHO Recursively searching %FFPath%
echo.

FOR /F "delims=" %%I in ('DIR %ETPath%\*.xlsx /a:-d /s /b') DO (
SET FullDate=%%~tI

REM Set CurrDate to yyyymmdd format. Note: Will fail if regional settings changed.
SET CurrDate=!FullDate:~6,4!!FullDate:~0,2!!FullDate:~3,2!

If !CurrDate! gtr !NewestDate! (
SET NewestDate=!CurrDate!
SET NewestFile=%%~fI
)
)
ECHO Copying %NewestFile% to LOCATION

ECHO.
XCOPY /Y /R "%NewestFile%" "[i]LOCATION
[/i]"
ECHO.

This code works wonderfully, but if a user has the file open it can't seem to find the file. I don't know if it is because it CREATES a hidden file and locks it, or what. Any assistance in being able to IGNORE the hidden file or provide a fix for this would be greatly appreciated.I was able to figure it out using /a:-h
I will adjust the code in case somebody else is having a similar issue or LOOKING to do the same thing. Once again, this will copy a file using the last modified date attribute.

Code: [Select]SETLOCAL ENABLEDELAYEDEXPANSION

SET FILEPATH="LOCATION"
REM Arbitrary yyyymmdd starting point, nothing will be older than it
SET NewestDate=20130101

ECHO Recursively searching %FFPath%
echo.

FOR /F "delims=" %%I in ('DIR %ETPath%\*.xlsx /a:-d /a:-h /s /b') DO (
SET FullDate=%%~tI

REM Set CurrDate to yyyymmdd format. Note: Will fail if regional settings changed.
SET CurrDate=!FullDate:~6,4!!FullDate:~0,2!!FullDate:~3,2!

If !CurrDate! gtr !NewestDate! (
SET NewestDate=!CurrDate!
SET NewestFile=%%~fI
)
)
ECHO Copying %NewestFile% to LOCATION

ECHO.
XCOPY /Y /R "%NewestFile%" "LOCATION"
ECHO. Quote

I will adjust the code in case somebody else is having a similar issue or looking to do the same thing.

Thanks for sharing that ...

I have generally just used xcopy /s/d/y to make a copy of contents to an alt location over network to another system and the newest, last modified file is transferred to the alt location when date/time stamp changes when its last saved/modified, and all files that haven't changed and are a match between source and destination are skipped from transfer. Neat that this just transfers that 1 file.

*I may have a use for your batch to copy only the newest last modified file from one location to another, where this game called Poker Night 2 hosted by Steam, created by Tell Tale Games, has a corruption flaw in its code that many people are experiencing with no help from Steam or Tell Tale Games Co. And currently the only way to fix the problem is to uninstall and reinstall the game each time this happens. If I can detect what file was last written to before the crash occurred, I can then single out the one file that is getting corrupt and may find the one file that is causing the crash.

I was going to perform a file compare between the normal install and known good replicated location to find what file was last altered between A and B and single out that way, but your batch LOOKS like a better method.

Knowing which file is the cause... I can then make a bugfix for people to use since Steam and Tell Tale Games are ignoring requests for help on this flawed game. Some people are so mad about this when searching for a solution to this that they feel that legal action should be taken, over either a game that is poorly programmed and TROUBLED, or Steams client integration flaw that is causing the game to corrupt and fail.
7212.

Solve : Batch File Shutdown bug solution?

Answer»

I am new to computing forums. Please BARE with me if what I am about to tell you is common knowledge.

As we know
Code: [SELECT]shutdown -s -ftakes a few seconds to actually begin shutting down.
The solution is
Code: [Select]shutdown -t 0 -s -fThis begins your shutdown instantly. The same FIX can be used with RESTARTING, nonforce shutdowns, etc.

7213.

Solve : BAT file to move folders into current month folder?

Answer»

I am new to the forums and I have recently started working with bat files, so please bear with me. I am using Windows 7 and currently have a batch file that pulls reports and stores them in a directory that we will call "C:\My Document\Current Reports". Inside the Current Reports directory, I have another directory that is labeled Archives, and inside Archives are the folders labeled by months as shown below. Each day my batch file pulls new reports and moves yesterday's reports to the archive FOLDER. Rather than STOPPING there, I am wanting it to place the folder into the current month. I have a folder for each month labeled as follows:

1. January
2. February
3. March
4. April
...etc

Directories described above

C:\My Documents\Current Reports
C:\My Documents\Current Reports\Archives
C:\My Documents\Current Reports\Archives\"Folder labeled by month"

I know it has to be simple FOR command, but I can't quite figure it out. Any assistance would be GREATLY appreciated.I think you can adapt the following to suit your needs:

Code: [Select]SET MO=%DATE:~4,2%
IF %MO%==01 SET FOLD=1. January
IF %MO%==02 SET FOLD=2. February
IF %MO%==03 SET FOLD=3. March
IF %MO%==04 SET FOLD=4. April
IF %MO%==05 SET FOLD=5. May
IF %MO%==06 SET FOLD=6. June
IF %MO%==07 SET FOLD=7. July
IF %MO%==08 SET FOLD=8. August
IF %MO%==09 SET FOLD=9. September
IF %MO%==10 SET FOLD=10. October
IF %MO%==11 SET FOLD=11. November
IF %MO%==12 SET FOLD=12. December
ECHO %FOLD%WOW! Thanks a million. That worked beautifully. I also learned a LITTLE bit when messing with that code. Rather than asking the question here, I will create a new thread. This one is SOLVED. Thank you once again!.

7214.

Solve : DOS and the Web?

Answer»

Hi,

I was wondering if anyone here KNEW how to BROWSE the internet in MS DOS without USING a special program or anything.

Thanks,
NN

7215.

Solve : How to delete a file by searching for part of the file name??

Answer»

I would like to delete a file by searching for part of the file name. (Example: Test.txt, test123.txt, testing123.txt) I would like to delete anything that has "test" in the file name.your examples show that the filename always starts with test but your description says "in" the filename. So does 123testing.txt qualify as well.Thank you for your reply. "123test" will qualify as well, but most likely won't have a file like that. This is just an example, but not the real file that I'm trying to remove. This is the script that I currently have, but I'm LOOKING for the variables that the file may have in it. There are certain cases where there is random text after "ALLDATA Repair - ". I need to search for "ALLDATA Repair - " on the desktop that is a .url file. Your help is much appreciated.



DEL /Q "%userprofile%\Desktop\ALLDATA Repair - Login.url"QUOTE from: nfin8rider on November 28, 2012, 03:47:35 PM

There are certain cases where there is random text after "ALLDATA Repair - ". I need to search for "ALLDATA Repair - " on the desktop that is a .url file.

Try this"

del /Q "%userprofile%\Desktop\ALLDATA Repair - *.url"
Thank you Foxidrive, this worked!
7216.

Solve : Need help with my BATCH file?

Answer»

The purpose of this batch file is to FTP (PUT) a file to the server, then (GET) the file back to the client machine, then do the a file COMPARE between the original file and the file that was just received from the server to ensure that the file is not corrupted.

I would like to know, if someone could help me with the "f.bat" file to only append/write to the file when the output of the "comp" command is "Files are Different Sizes" and NOT append/write to the test.txt when the output for the "comp" command is "Files compare OK"

Thanks....

Here is the content of my batch file, but it append/writes to a file regardless of the output.


----------------------
Contents of f.bat
----------------------
:start

ftp -s:b1.bat 10.10.10.6

comp c:\test\junk20 c:\junk20 /D > c:\test.txt
date /t >> c:\test.txt
time /t >> c:\test.txt
ECHO ------------- >> c:\test.txt

cls

goto start
___________________________________

----------------------
Contents of b1.bat
----------------------
test10
test10

binary
hash

put c:\test\junk20

get junk20

delete junk20

quit
___________________________________

----------------------
Contents of no.asc
----------------------
N
___________________________________You are trying to do too much at once. Without the results of the compare, you cannot unconditionally use >>.

Code: [Select]
----------------------
Contents of f.bat
----------------------
:start

ftp -s:b1.bat 10.10.10.6

echo N | comp c:\test\junk20 c:\junk20 /D > work.tmp
if errorlevel 1 copy test.txt+work.tmp test.txt
date /t >> c:\test.txt
time /t >> c:\test.txt
ECHO ------------- >> c:\test.txt
del work.tmp

cls

goto start


You will have to fixup the paths.

Curious. Why the unconditonal goto start?

Hope this helps. Thanks! I will try it on Monday. This is purely for a software test lab. I use FTP at times to generate traffic across my test network to ensure that the FTP protocol works correctly through my setup.
Hope this answers your question...

I will need to append the contents of the failure into the test.txt, because this test will run overnight. Should I still use > instead of >> ?My response indicated you output the results of the compare into a work file. After checking errorlevel returned by the compare (0=files equal, 1=files not equal), the work file is conditionally appended to test.txt (the copy STATEMENT with the plus symbol). The example posted above will do all that. Just fixup the paths and you should be good to go.

Your original post was unconditonally appending the output of the compare to test.txt before knowing the results of the compare. The work file is just that; it will be created and deleted during each run of the code.

Hope this helps. Thanks! The code works great, however, the date and time as well as the "----------" still gets logged in the Test.txt file regardless of the condition. Should I correct that the same WAY you have corrected the "comp" command?Sorry about that. Errorlevel CONTAINS the value of the last command run, so you'll have to IMPROVISE. You didn't mention your OS but this should work on most of them.

Code: [Select]
----------------------
Contents of f.bat
----------------------
:start

ftp -s:b1.bat 10.10.10.6

echo N | comp c:\test\junk20 c:\junk20 /D > work.tmp
if errorlevel 1 copy test.txt+work.tmp test.txt & date /t >> c:\test.txt & time /t >> c:\test.txt & echo ------------ >> c:\test.txt
del work.tmp

cls

goto start


Note: create the IF statement as one line of text, the forum code box created two.

Good luck.

7217.

Solve : Modifying Internet Shortcut URL Path?

Answer»

I have a .bat file that removes an existing shortcut, then creates a new shortcut. The problem is that the old URL path doesn't change. If there is no existing shortcut, the path is correct. I'm not sure why this is happening.

Without seeing what you've written it would be sheer guesswork...THANKS for you reply...so this is what I have. To see what I'm experiencing, you will have to create a shortcut from https://repair.alldata.com, take a look at the url, then run this script. You will see that your shortcut url will be the same as the original url, but is suppose to be https://repair.alldata.com.


------------------------------------------------------------
del /Q "%userprofile%\Desktop\ALLDATA Repair - Login.url"

ping 127.0.0.1 -N 10 > nul
ping 127.0.0.1 -n 30 > nul

START https://repair.alldata.com

ping 127.0.0.1 -n 30 > nul

echo [InternetShortcut] > "%userprofile%\Desktop\ALLDATA Repair - Login.url"
echo URL=https://repair.alldata.com >> "%userprofile%\Desktop\ALLDATA Repair - Login.url"
echo IconFile=https://repair.alldata.com/alldata/brand?fileName=img/favicon.ico >> "%userprofile%\Desktop\ALLDATA Repair - Login.url"
echo IconIndex=0 >> "%userprofile%\Desktop\ALLDATA Repair - Login.url"

echo [InternetShortcut] > "%userprofile%\Favorites\ALLDATA Repair - Login.url"
echo URL=https://repair.alldata.com >> "%userprofile%\Favorites\ALLDATA Repair - Login.url"
echo IconFile=https://repair.alldata.com/alldata/brand?fileName=img/favicon.ico >> "%userprofile%\Favorites\ALLDATA Repair - Login.url"
echo IconIndex=0 >> "%userprofile%\Favorites\ALLDATA Repair - Login.url"

ping 127.0.0.1 -n 30 > nul

START https://repair.alldata.com/

-----------------------------------------------

This should erase and recreate the desktop .url file as the single > in the second line OVERWRITES any existing file.
Then it copies it into the favorites folder.

Code: [Select]set file="%userprofile%\Desktop\ALLDATA Repair - Login.url"

>%file% echo [InternetShortcut]
>>%file% echo URL=https://repair.alldata.com
>>%file% echo echo IconFile=https://repair.alldata.com/alldata/brand?fileName=img/favicon.ico
>>%file% echo echo IconIndex=0

copy /y %file% "%userprofile%\Favorites\"
Thank you for the reply Foxidrive, but unfortunately it didn't resolve my issue. The url path still shows the existing bad url that I'm trying to remove. Also, the ICON doesn't appear.I take that back Foxidrive, I retested again w/ the other script you GAVE me to delete the file and added it with this script and it worked! Thank you very much for you help!

7218.

Solve : command to check file version in batch file???

Answer»

Hi All,
COULD any one of you assist me in getting the dos command to check the version of the file installed?
Or the command to check file version in a BATCH file!!
Thanks in advance.

greetings,
Santhosh I'm not aware of any command EXCEPT for ver which will give you the version of your OS.

This script is will check file versions. (Note: all files do not contain version info)

Code: [SELECT]
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_Datafile Where name = 'c:\\windows\\system32\\rundll32.exe'")

For Each objFile in colFiles
Wscript.Echo "Version: " & objFile.Version
Next


Make sure your paths use \\ instead of \

Good luck.Thanks for your reply SIDEWINDER,
I was actually looking for a script to do it using only DOS or Batch file commands. However it would be useful.
I would appreciate more if there is a command in DOS or Batch file scripting..

7219.

Solve : How can I edit registry settings??

Answer»

I'm able to remove options for Delete Browsing HISTORY settings, but I'm having issues with adding options in. I want to make sure that the following are checked: Temporary Internet Files, Cookies, History. I'm currently using a REGISTRY file that I exported, then using this SCRIPT.

@regedit /Q /s C:\temp\delbrhst_prsrvfavwebdata.reg

Contents of delbrhst_prsrvfavwebdata.reg:

Windows Registry EDITOR Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Privacy]
"ClearBrowsingHistoryOnExit"=dword:00000000
"UseAllowList"=dword:00000000
"CleanForms"=dword:00000000
"CleanPassword"=dword:00000000
"CleanInPrivateBlocking"=dword:00000000
"CleanTIF"=dword:00000001
"CleanHistory"=dword:00000001
"CleanCookies"=dword:00000001

Any help WOULD be appreciated! Thank you!I actually figured it out!

START REG.EXE IMPORT .reg

7220.

Solve : How to know a service is running or not using DOS?

Answer»

HI,

How to know a service is running or not using DOS Batch commands?

Regards,
ArjunNeed more info. What is your OS and why does it have to be DOS batch language?

Let us know. Hi,

My Operating System is Win 2K. My requirenment with the Dos commands is, i want to copy the database file ( Ms Acess file *.mdb). A windows service is running with respective to the service. I want to stop the service while COPYING and again i need to START the service.

So for the first i have to CHEK whether the service is installed or not. Suppose the service is not even installed, if we TRY to stop the service it gives a problem.

That's why i am asking how can we know the particular windows service is installed and running or not?

Regards,
Mallikarjun.
I'm not sure if the sc command is valid on 2K but you can try this.

Code: [Select]
for /f "tokens=1-4" %%a in ('sc query servicename ^| find /i "state"') do (
if %%d==RUNNING sc stop servicename
)


Fill in servicename as needed. If sc is not valid on your machine, you probably need to write a script.

Good luck.

7221.

Solve : Need help on CMD.. if your good enough?

Answer»

Im awful at CMD prompt, ok, basicly.. i need a cmd syntax that will ALLOW me to find a certain FILE type, under 10kb in size , then LOG that filename in WORD or notepad or whatever.. does anyone know how to do this or if its even possible?That kind of subject line isn't going to woo too many PEOPLE to help you.
untested. just wrote this off the top of my head.
Code: [Select]@echo off

Pushd "C:\Source Directory"
FOR /F "delims=" %%G IN ('dir /a-d /b') do (
IF %%~zG LSS 10240 echo %%~G>>"C:\logfiles\filesize.log"
)
popd

7222.

Solve : Delete all lines with certain words in a .txt file?

Answer»

hey guys,

i was wondering if it's POSSIBLE to DELETE all lines with a SPECIFIC word in it in a .txt file with a batch file (to be more accurate, i want to make a batch for deleting some cookies in the cookies .txt file of the Firefox webbrowser, USUALLY located at C:\Documents and Settings\**WindowsUserName**\APPLICATION Data \Mozilla\Firefox\Profiles\**YourProfileName**\cookies.txt).

can anyone help me with this one?

kasper
that should do the job:

type cookies.txt | find /v "search item" >cookies.txt

uli

7223.

Solve : Major Goof?

Answer»
Hello all,

I installed the lastest win 2000 service pack, and when I restarted, windows WOULD never boot, kept rebooting. NONE of the safe mode options would start windows. I mean none.
So I used a recovery disk (purchased off the internet) and the goofball I am, deleted, everything except dos.(reformat, partition)

All right, heres the question: is there any dos command that would enable me to restore, recover, or undelet ( I never backed up the system .

Just for SEARCH sake for others looking for the same thing:
win 2000 windows 2000 professional deleted windows OS system restore undelet.Restore, recover or undelete What?? If you have FORMATTED then you need to get a file recovery program something like RESTORATION which MAY be help. BUT by installing an OS on your current hdd you WILL overwrite some of the deleted files. Can you slave your disk in another pc and try file recovery from there?

From what you SAY you will eventually have to re-intall your OS so you will have to Bite-the-bullet at some stage and re-install all your application progs etc...
7224.

Solve : file name with apostrophe?

Answer»

I have created an MS DOS batch file that backs up files in folders from one drive to another drive.
It works fine with all but one folder. The name of the folder is "Miller's pictures" It does not xcopy that folder.
The apostrophe is the problem. I put quotes around files with a space so that is not the problem.
I do not want to change the name of the folder. Is there a way of getting DOS to accept the apostrophe?
Thank you.
KeithI think you will find that it is not a normal apostrophe but one that comes from a foreign language character set.

Rename it with the apostrophe from your keyboard and it should be fine.Your guess appears to be correct. I tried a test filename with the keyboard apostrophe and the batch file found it fine!
Now, the problem is that I don't want to rename the folder since it contains zillions of pictures that have been ADDED to picassa. I fear that if I rename the folder I will lose all of the information that I connected to the pictures from within Picassa.
Any way to get the batch file to accept the FORIEGN character? Any other ideas?
KeithChanging the code page using the CP command at the start of the batch file might work.

or try Robocopy to back it up - see if that works with that character.Quote from: keithm on December 01, 2012, 11:03:26 AM

I fear that if I rename the folder I will lose all of the information that I connected to the pictures from within Picassa.

You might be able to alter the folder name in Picassa itself. Make a full backup first though.I think I got logged out before sending my reply so I'll try again...
Thanks for your SUGGESTIONS. I had not thought of trying to change the name of the folder from within Picassa. Since that might be real simple I'll start there. Thanks again for your help.
KeithI was able to change the folder name from within Picassa!!!! My batch backup program now works perfectly!!! Thank you very much for your help... KeithGood one Keith! Thanks for the followup
7225.

Solve : MsDos Command To Delete C Drive?

Answer»

I WANT To Change Operating System From Win95 ToWin98. I Need To DELETE C: What Is The MSDOS Command To Do This.format c:How to install Microsoft Windows 98

7226.

Solve : More for loop help >.

Answer»

So I DECIDED to restart my program after DROPPING it for awhile. So for the problem I'm stuck on, I need to grab some strings from diffrent points in a text file (I now exactly where) and set a veriable equal to them. So basicly, I need to set everything on the right of the ':' to a veriable that is named something similar to the what is on the left of it. Here's an example of the text file:
Quote from: 1.txt

Name:Lemonilla
Urels:50
Yuin:0
Wenarduls:0
Location:Tipa
Time:1
So far I've got a for /f loop that isn't quite working the way I want it to , It seems to reset the same veriable all the diffrent values, so instead of setting %Name% equal to Lemonilla, It ends up being 1 (as that is the value for the last executed loop, Time). Here is my failed attemp, I feel like i'm just putting the wrong stuff in the "s.
Code: [Select] ::ConfermSave.LoadSave.start
for /f "tokens=1-6" %%D in (%save%.txt) do (
set a=%%D
set name=!a:~5,100!
set a=%%E
set Urels=!a:~6,100!
set a=%%F
set Yuin=!a:~5,100!
set a=%%G
set Wenarduls=!a:~10,100!
set a=%%H
set location=!a:~9,100!
set a=%%I
set _Time=!a:~5,100!
)
Where %save% = 1.Code: [Select]@echo off

FOR /F "tokens=1,2 delims=:" %%G IN (1.txt) do set %%G=%%H

echo %Name%
echo %Urels%
echo %Wenarduls%
echo %Location%
echo %Time%
pauseOutput
Code: [Select]C:\Users\Squashman\Batch\for_loops>loop.bat
Lemonilla
50
0
Tipa
1
Press any key to continue . . .

C:\Users\Squashman\Batch\for_loops>>.< I guess I was thinking too hard... Thanks for the help!I wouldn't say you were thinking to hard. You just were not understanding how for loops parse text files. Your code makes me think you thought the for loop parses th whole text file at once which it doesn't. It processes one line at a time.Quote from: Squashman on DECEMBER 01, 2012, 11:11:40 AM
I wouldn't say you were thinking to hard. You just were not understanding how for loops parse text files. Your code makes me think you thought the for loop parses th whole text file at once which it doesn't. It processes one line at a time.

From the FOR documentation (type FOR /? at the prompt:)

FOR /F ["options"] %VARIABLE IN (file-set) DO command [command-parameters]
FOR /F ["options"] %variable IN ('string') DO command [command-parameters]
FOR /F ["options"] %variable IN (`command`) DO command [command-parameters]

file-set is one or more file names. Each file is opened, read
and processed before GOING on to the next file in file-set.
Processing consists of reading in the file, breaking it up into
individual lines of text and then parsing each line into zero or
more tokens. The body of the for loop is then called with the
variable value(s) set to the found token string(s). By default, /F
passes the first blank separated token from each line of each file.
Blank lines are skipped. ...
No fair, I was really tired that day
7227.

Solve : Ping batch?

Answer»

I want to make a batch/command file that will ping multiple IPs and save , "time=" from each ping from each IP, into a .txt file.

I tried this just to see if it would WORK

@ECHO
PING 104.12.0.234 ¦ FIND "time=" > Pingtimes.txt

but i got a prompt with "C:\My Documents> PING 104.12.0.234 ¦ FIND "time=" > Pingtimes.txt"
it just KEEP going all of the way down the command window. I had to close the window to stop it.

Maybe I wrote too much but hey if someone can help I would REALLY appreciate it.

PaulTry using the -n switch with a value of 1. Not sure that times= is really what you want. Perhaps MINIMUM, maximum or average would work better. Also use the /i switch with the FIND.

Just a THOUGHT. I figured out you have to use

PING.EXE doh!

that stopped the infiniloop.

if i do this
PING.EXE 111.111.111.111 | find "Average" > file.txt
PING.EXE 222.222.222.222 | find "Average" > file.txt

the second ping overwrites the 1st ping. is there a way around this?

Of course, on the second and subsequent PINGs using the >> redirection symbol. Very confused, your first post mentioned a FIND command....did I miss something?

i figured out how to use the FIND command to get what I want. I am now using it to put the whole min mx ave line into a text file. I want to have each subsequent ping into the text file so it looks like this.

Minimum = 588ms, Maximum = 593ms, Average = 589ms
Minimum = 570ms, Maximum = 590ms, Average = 580ms

but instead each ping overwrites the previous.Im a putz, >> Appends the text file thus allowing multiple lines!! yeah!
shoo its only taken me a few hrs to get this right.
Thanks for the help.

7228.

Solve : An interesting link?

Answer» http://lists.gpick.com/pages/MS_DOS.htm
7229.

Solve : setting STDIN for NET TIME command when running from a batch file.?

Answer»

I thought this WOULD work:

NET TIME \\127.0.0.1 /SET
where YES.txt contains a "Y" FOLLOWED by a "\n" (newline), but I get an error message "No valid RESPONSE was provided" with an %ERRORLEVEL%=-1.

Thanks in ADVANCE for any help you may be able to provide.

7230.

Solve : can´t edit autoexec.bat or cofig.sys?

Answer»

my problem is that I open the editor and modify the file but when I try to save a messaje appears . Something like unable to save because it might be protectd against writing. Is there any way to go arround this protections
thanks
miguelYou could try using the ATTRIB command to flip off the read-only bit. Autoexec.bat and Config.sys are not normally read-only files. How did this situation happen?

Good luck. I really don´t know how
thanks a lot
C:\WINNT\system32>attrib /?
Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [[DRIVE:] [path] filename]
[/S [/D]]

+ Sets an attribute.
- CLEARS an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
/S Processes matching files in the current FOLDER
and all subfolders.
/D Processes folders as well.Fron a dos prompt, include the path &AMP; file name of your choice.

C:\>attrib test.bat
A SHR C:\test.bat

C:\>attrib -r -a -s -h test.bat

C:\>attrib test.bat
C:\test.bat

C:\>attrib +r +a +s +h test.bat

C:\>attrib test.bat
A SHR C:\test.bat

C:\>

Pictures are easier. thanks a lot

7231.

Solve : Excel help with updating data?

Answer»

Hello,

I encountered the problem with excel asking whether i want to update the daa or not. COULD you help me with the following?

After opening excel file, could you write a command that would update the DATA (press the enter button that the file will open with data updated)? (adjusting excel options that it will update AUTOMATICALLY is not an option)

After doing that, I want to save fale as "current file name date"

I am pretty NEW with this and i tried googling, it didnt helped.

Thanks for help!Is it asking if you want to update links?Yes, i solved the problem by porbably not the most efficient way. I WROTE a command to sendkey "U", and then it updates. If you have more sophisticated method to do so, you are more than welcome to help. Also, i havent figured out the commands how to save file with current date in it.

7232.

Solve : Dynamic environment variable substring offset & length?

Answer»

I wrote the FOLLOWING, and am having trouble at the indicated location:

Code: [Select]REM SPLIT.BAT
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET STRING=%1
SET STRING=%STRING:~1,-1%
ECHO %STRING%>x & FOR %%A IN (x) DO SET /A STRLENGTH=%%~zA - 2 & DEL x
SET SEMINUM=0
FOR /L %%I IN (0,1,%STRLENGTH%) DO IF "!STRING:~%%I,1!" EQU ";" (
SET /A SEMINUM=!SEMINUM!+1
SET K.!SEMINUM!=%%I
)
SET /A %2.0=%SEMINUM%+1
SET /A I=%SEMINUM%+1
SET /A K.%I%=%STRLENGTH%
SET L=0
FOR /L %%I IN (1,1,%I%) DO IF "1" EQU "1" (
SET J=!K.%%I!
REM ---------------------------------------------------------
REM None of these is correct
REM
SET %2.%%I=!STRING:~!L!,!J!!
SET %2A.%%I=%STRING:~!L!,!J!%
SET %2B.%%I=%%STRING:~!L!,!J!%%
REM ---------------------------------------------------------
SET /A L=!J!+1
)
@ECHO ON
SET %2.
SET %2A.
SET %2B.

Here are the results I get:

>SPLIT.BAT "ONE;TWO;THREE;FOUR;FIVE;SIX" VAR

>SET VAR.
VAR.0=6
VAR.1=ONE;TWO;THREE;FOUR;FIVE;SIXLJ
VAR.2=ONE;TWO;THREE;FOUR;FIVE;SIXLJ
VAR.3=ONE;TWO;THREE;FOUR;FIVE;SIXLJ
VAR.4=ONE;TWO;THREE;FOUR;FIVE;SIXLJ
VAR.5=ONE;TWO;THREE;FOUR;FIVE;SIXLJ
VAR.6=ONE;TWO;THREE;FOUR;FIVE;SIXLJ

>SET VARA.
VARA.1=STRING:~0,3
VARA.2=STRING:~4,7
VARA.3=STRING:~8,13
VARA.4=STRING:~14,18
VARA.5=STRING:~19,23
VARA.6=STRING:~24,28

>SET VARB.
VARB.1=%STRING:~0,3%
VARB.2=%STRING:~4,7%
VARB.3=%STRING:~8,13%
VARB.4=%STRING:~14,18%
VARB.5=%STRING:~19,23%
VARB.6=%STRING:~24,28%

Is this possible? Thanks in ADVANCE for any help you might provide.I can see why the error is there.
You cannot USE two delayed variables as you have shown, to separate a string using another delayed variable.

If you supply an input string and DESCRIBE what you need to do then there may be better ways to do it.I am not sure what you are trying to do or why your input to your batch file would be like.
This gives some better output but it still don't look right.
Code: [Select]REM SPLIT.BAT
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET STRING=%1
SET STRING=%STRING:~1,-1%
ECHO %STRING%>x & FOR %%A IN (x) DO SET /A STRLENGTH=%%~zA - 2 & DEL x
SET SEMINUM=0
FOR /L %%I IN (0,1,%STRLENGTH%) DO IF "!STRING:~%%I,1!" EQU ";" (
SET /A SEMINUM=!SEMINUM!+1
SET K.!SEMINUM!=%%I
)
SET /A %2.0=%SEMINUM%+1
SET /A I=%SEMINUM%+1
SET /A K.%I%=%STRLENGTH%
SET L=0
FOR /L %%I IN (1,1,%I%) DO IF "1" EQU "1" (
SET J=!K.%%I!
REM ---------------------------------------------------------
REM None of these is correct
REM
CALL SET %2.%%I=%%STRING:~!L!,!J!%%
CALL SET %2A.%%I=%%STRING:~!L!,!J!%%
CALL SET %2B.%%I=%%STRING:~!L!,!J!%%
REM ---------------------------------------------------------
SET /A L=!J!+1
)
@ECHO ON
SET %2.
SET %2A.
SET %2B.Output
Code: [Select]C:\Users\Squashman\Batch\split>SPLIT.BAT "ONE;TWO;THREE;FOUR;FIVE;SIX" VAR

C:\Users\Squashman\Batch\split>REM SPLIT.BAT

C:\Users\Squashman\Batch\split>SET VAR.
VAR.0=6
VAR.1=ONE
VAR.2=TWO;THR
VAR.3=THREE;FOUR;FI
VAR.4=FOUR;FIVE;SIX
VAR.5=FIVE;SIX
VAR.6=SIX

C:\Users\Squashman\Batch\split>SET VARA.
VARA.1=ONE
VARA.2=TWO;THR
VARA.3=THREE;FOUR;FI
VARA.4=FOUR;FIVE;SIX
VARA.5=FIVE;SIX
VARA.6=SIX

C:\Users\Squashman\Batch\split>SET VARB.
VARB.1=ONE
VARB.2=TWO;THR
VARB.3=THREE;FOUR;FI
VARB.4=FOUR;FIVE;SIX
VARB.5=FIVE;SIX
VARB.6=SIX

C:\Users\Squashman\Batch\split>Thanks, I needed that.

7233.

Solve : Global variable in batch file?

Answer»

Hi,

I am trying to write a batch file where I NEED to access global variable.

set var=""
FOR /F "tokens=1 skip=1" %%A IN ('WMIC PRODUCT WHERE "Name like "MYSOFT"" get Version') DO (
set var=%%A )
ECHO %var%


I am not able to get the version of the software out side the for loop.
Can some ONE help me with this problem.

Thanks in advance.

VijayCode: [Select]@echo off
set var=""
FOR /F "delims=" %%A IN ('WMIC product WHERE "Name like 'Microsoft Silverlight'" get Version ^|find "."') DO (
set var=%%A )
echo %var%
pauseWOOW..that works! Thanks a lot

7234.

Solve : Batch code works in XP but not in Win7?

Answer»

The following line out of my backup batch, that saves 20 copies of a particularly important file, has worked well for years in XP. However it fails to work in Win7. Any Pointers please.

setlocal
set source=S:\WebSiteBaks
pushd "%source%"
for /f "skip=20 delims=" %%a in ('dir /b /a:d /o:-d 2^>NUL') do rmdir /s /q "%%a"
popd

Many thanks, Mal

Quote from: MalA on November 28, 2013, 11:02:30 AM

The following line out of my backup batch, that saves 20 copies of a particularly important file, has worked well for years in XP. However it fails to work in Win7. Any Pointers please.

It doesn't save 20 copies of a file. It deletes folders.

What does it do in XP that it doesn't do in Win 7?Sorry, perhaps I should have described the whole batch file in full. Here goes

When the whole file runs in XP, it backs up a folder in C:\ that contains what to me is important data about my website, that is constantly changing. First it copies the whole folder and sub folders, then it renames that copy to be file+date+time. Then it deletes more than 20 copies of those renamed folders, so my HDD doesn't get full.
And it has worked well for quite some time.

It is the last bit, the DELETING bit that is not working in Win7, where it runs though all the contained files in the folders to be deleted, and PIPES them as "Access is Denied"

Any chance that you can help please - Mal
Quote from: MalA on November 30, 2013, 04:45:02 AM
It is the last bit, the deleting bit that is not working in Win7, where it runs though all the contained files in the folders to be deleted, and pipes them as "Access is Denied"

"Access is denied" could be caused by Windows 7's UAC (User Account Control), the lack of administrative privileges, or the file you're trying to delete could still be in use.I would also set up the batch file to "run as admin" in preferences if its not a file in use issue."Access is Denied"
comes also when another program has the file open.
The below link shows it can happen even if you try bop open a folder.
http://support.microsoft.com/kb/810881

NOTE: The issue is specific to XP and applies when you re-install XP. This is a must read for anyone wishing to continue using XP as their OS.Quote from: MalA on November 30, 2013, 04:45:02 AM
When the whole file runs in XP, it backs up a folder in C:\

It is the last bit, the deleting bit that is not working in Win7, where it runs though all the contained files in the folders to be deleted, and pipes them as "Access is Denied"

Later versions of Windows don't allow users access to c:\ without Admin perrmissions, even if UAC is turned off.

Pick the "%userprofile%\desktop\tempfolder" and it should work fine.foxidrive, Thanks for correcting me.His problem is in Windows 7, not in XP. OOPS.
Here is a general article on UAC in Windows.
http://en.wikipedia.org/wiki/User_Account_Control
Quote
... MALWARE should be kept from compromising the operating system. In other words, a user account may have ADMINISTRATOR privileges assigned to it, but applications that the user runs do not inherit those privileges unless they are approved beforehand or the user explicitly authorize
Writing to the root of the system drive is forbidden, just as foxdrive stated.
7235.

Solve : Can't install from path set in a variable. Must be wherever batch file is?

Answer»

I am creating an automated, silent installer for all of my programs. This installer will be executed before Windows DESKTOP loads (setupcomplete.cmd)

I need to know how to specify the drive letter from which I am INSTALLING dynamically (such that it does not have to be hard-coded, e.g, e:\) The variable I'm using is not working reliably (where sometimes the path is not where the batch file is located). Any ideas?

This is what I have:

set mypath=%~dp0

start /wait %mypath%\7zip.msi /q installdir="C:\Program Files\7-Zip"

Regards,

JuanThee is a problem.
Why do you want to hide what your are doing? That would SUGGEST that you bare trying to hack somebody's PC.

Users need to know when a system has been modified or updated. Why should you have the privilege of an exception?

What I am saying is Don't use setupcomplete.cmd for a batch TASK. Unless it is the best way n to do a job.

Add a Custom Script to Windows
SETUP

7236.

Solve : Single line code?

Answer»

Hello,
I found a one line code on the internet and would like to get it to work on Windows 7 home Premium 64 bits.
The code is:
bcdedit /enum >nul 2>nul && (color FC && title ADMIN) || (color 07 && title NONADMIN)

The way I understand that this should work is to try and execute bcdedit.
If it executes, then the command processor must have administrative rights and executes (color FC && title ADMIN).
If it does not execute, the command processor does not have administrative rights and executes (color 07 && title NONADMIN).

This SOUNDS great, but doesn't work for the non administrative command processor.
The code needs to be on one line.
There must be some syntax problem.
Could someone please help.
Thanking you.
It works fine for me.Quote from: BC_Programmer on November 30, 2012, 07:23:11 PM

It works fine for me.

And me. And I have Win7 Home Premium 64-bit. Do you (the OP) have User Account Control turned on or off, and what WARNING level is it at?I tried it on my wife's machine (also 64bit win7 home premium) and also works.
Both machines have the User Account control setting to minimum (never notify).
So, there must be something in my machine's setting?
ThanksFWIW, the only thing it does is change the titlebar to say NONADMIN, the color is actually the same as the defaults.
What does bcdedit do when you execute it as non-admin?Also, saying it "doesn't work" is a bit vague- what actually happens?The color could be changed in the line to (color 07 && title NONADMIN) so that a non admin command prompt should change the background color to blue and the title to NOADMIN.
On my machine this does not happen. The background color and title does not change (for a non admin command prompt).
My wife's computer works fine.
Try typing color 07 in cmd and see what happens... you must have meant color 17 if you WANTED blue. Change that and see what happens then.I did that and posted my previous post. My machine does not go that part of the code.

If you run 'bcdedit' in a non admin command prompt you get a message:
"'bcdedit' is not recognized as an internal or external command.
Made some other test and in this case cames up with an errorlevel of 9009 on my machine.
On an andmin command processor the errorlevel is 0.
Now, for some reason my machine started to work.
Ok, for the next step.
In the registry, \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor
If you create a REG_SZ key, name it 'AutoRun' and the line
bcdedit /enum >nul 2>nul && (color FC && title ADMIN) || (color 17 && title NONADMIN) as the value,
the colours should come up as the white background for an admin command processor and blue for non admin command processor.
Both my machines now behave the same. The admin command processor is white but the non admin command processor is black.
I thought that if the code worked in a batch then it would work here also.
I think I know what causes this latest problem.
I LAUNCH the admin command processor from a shorcut to cmd.exe.
I launch the non admin command processor using DropMyRights. Being launched by DropMyRights, the command processor probably doesn't go through the registry key. So the line of code is not processed.
I think.1. You can use a number of commands that will fail if you are not in an admin prompt, for example reg query "HKU\S-1-5-19"
2. You don't need double ampersands like here (color FC && title ADMIN). A single ampersand is a command separator whereas a double ampersand or double pipe is an errorlevel test. Command1 && Command2 means "execute Command1 and if the errorlevel is zero, execute Command2". Command1 || Command2 means ""execute Command1 and if the errorlevel is not zero, execute Command2". So you can just use (color FC & title ADMIN). Color FC should ALWAYS return an errorlevel of zero, if it doesn't you have some problems to sort out!








7237.

Solve : Bat file issue with spaces?

Answer»

Hi, I'm pretty new to batch files, so I may not be doing it perfectly right, but anyway, I have this:

@echo off
START /d "C:\Program Files (x86)\Samsung SSD Magician" Samsung Magician.exe

This doesn't launch the exe file, however, if I rename the file to SamsungMagigican.exe, and then remove the space in the filename above, it works fine.

However, I don't want to have to rename files just so they will run, is there a way to fix this, I've googled it, but it's just making me more confused.

Thanks for any help.I seem to have fixed it doing this..

@echo off
START "" /b "c:\Program Files (x86)\Samsung SSD Magician\Samsung Magician.exe"

Not totally sure about the /b and /d, but glad I can do it without faffing about splitting the path,
since I'm creating the bats with java, and launching with java.

Let me know if any thought(s).
Thanks
hello,
PLEASE i have a problem:
I need your help. I have a lot of files in directory c:\temp shown as below :

c:\temp\test1 fit.csv
c:\temp\test2 fit.csv

I want to rename all this files by cut 'blank space' in names. I want to get following results :

c:\temp\test1fit.csv
c:\temp\test2fit.csv

thank you in advance...start a new threadIt occurs to me that a short google will find a solution to this issue, too:

https://www.google.com.au/search?hl=en&q=rename+filenames+to+remove+spaces+windowsthank you...

please i have another problem:
i have one name es: pipo
i want to add one path to 'pipo'.

Es:
input value: pipo

path to add: "c:\user\potatoes"

OUTPUT: c:\user\potatoes\pipo.

thank you in advance...Create your own thread please, and EXPLAIN your TASK a little better too - it's unclear what you need to do.OK,i have wrote this:
@echo off
setlocal enabledelayedexpansion

set oldchar=A
set newchar=P

pushd c:\temp

for /f %%i in ('dir /b /a-d *.csv') do (
set string=%%i

set "newchar="directoryName"

for /f "tokens=*" %%* in ('
"powershell -c ""$ENV:string"".replace('%oldchar%','%newchar%')"
') do set result=%%*

rem echo %result%
ren %%i !result!
)

popd

but i want to replace es:
i have i directory with bon.csv
nu.csv
sou.csv

i want in output have: directory name +nameFile.csv
like this:

es: C:\user\bon.csv
C:\user\nu.csv
C:\user\sou.csv

I don't know how can i do it.Another deaf typist...@bertin

Create your own thread instead of hi-jacking someone elses.

7238.

Solve : extract a string from multiple files?

Answer»

I'd like to extract a string (STARTING at pos 27, length 25 chrs) from MULTIPLE text FILES and log it to another file (log.txt).

The script below works fine to catch that data from within one specific file (file.txt). It even leaves out any empty spaces inside the string...

Code: [Select]echo on
setlocal enabledelayedexpansion

for /f "tokens=* delims= " %%i in (c:\tmp\file.txt) do (
set str=%%i
set id1=!str:~26,25!
set id1=!id1: =!
echo !id1! >> c:\tmp\log.txt
)
endlocal
Now to my problem:
How do CHANGE the script so it scans a directory (c:\tmp) with thousands of files to perform the same operation with files that has filenames such as invoice_[NR].txt?

Any help is appreciated
Untested:

Code: [Select]@echo off
setlocal enabledelayedexpansion
for %%a in (*.txt) do (
for /f "tokens=* delims= " %%i in ( ' type "%%a" ' ) do (
set "str=%%i"
set id1=!str:~26,25!
set id1=!id1: =!
>> c:\tmp\log.txt echo !id1!
)
)
endlocalfoxidrive, you nailed it. Thanks!

7239.

Solve : Duplicate and rename single file in a large number of folders?

Answer»

In my music library, I have organized my folders in the FORMAT: Artist/Album/01 song title.mp3. Within each Album, I have a folder.jpg for the album art. I am upgrading my media server in my house, and the new system wants to have both a folder.jpg and cover.jpg in each album folder. My collection is fairly large (50,000 tracks), so manually duplicating each folder.jpg file and renaming it cover.jpg is impractical.

Is there a SIMPLE way to search through the NAS folder containing the music and wherever it FINDS a folder.jpg file, to copy it and save as cover.jpg?

Thanks in advance!If the NAS drive is mapped as a drive letter, open a command prompt in the root of that drive, and type (or PASTE) this

for /F "delims=" %A in ('dir /s /b folder.jpg') do copy "%~dpnxA" "%~dpA\cover.jpg"

and hit Enter

or...

place this batch file in the root and execute it

@echo off
for /f "delims=" %%A in ('dir /s /b folder.jpg') do (
echo Copying %%~dpnxA
copy "%%~dpnxA" "%%~dpA\cover.jpg"
)
echo.
echo Done
Pause



7240.

Solve : Files in a Folder?

Answer»

Hi All,

I would like to run a script that will count the number of files in a folder (local or shared of a server) and send me an alert if it CONTAINS more than the specified number of files.

I have found on this Forum the following:

dir "D:\Test" /b | find /v /C "::" - shows me the number of files in the test folder
dir "\\sh-backt-rl01\TEST" /b | find /v /c "::"- shows me the files on that share

Any help will be MUCH appreciated.
THANKS in advance. I would think you would want it to traverse any sub-directories in there and an exclude it from counting the directories. That is not that difficult. That CHALLENGE is how you want to be notified.
Just curious as to the application for this?

Is it to ...
- Detect files saved to wrong locations by users.
- Find malware files that have been dropped there.
- trying to think of any other application for this...

7241.

Solve : Game saving trouble?

Answer»

Okay, hello! New here, hope you can help.

Anywho, sort of new to batch, I can do STUFF like giving the user a selection of actions and such. My problem is that I'm making a story-line game adventure thing. And I want to save the game occasionally through the story. I.e. if you didn't bother to go down the first path at the start of the game and find the pouch or not, which will affect something later in the game, the save checkpoint is somewhere in between. What it will affect I don't know I've only really just started. I've seen people save stuff before in batch games so I know it's possible. I made a test script here for saving and loading:
Code: [Select]@echo off
echo initializing....
mkdir %~dp0\testfolder
set /p testvar= Enter test variable here:
echo Will now save your variable to file.
echo %testvar% > "%~dp0\testfolder\testvar.txt"
echo Will now set active variable to random.
set testvar= %random%
pause
echo variable is now %testvar%
echo Will now load variable frim file.
set testvar < "%~dp0\testfolder\testvar.txt"
pause
apparently the %~dp0 makes it the drive, the path of the file and name of running file the location, but this seemed to glitch out, making a folder called 'stuff' (the parent folder of current folder is called 'game stuff') with a subfolder 'My' ('My game' is the folder with the batch in.) also a folder called %mylastname%. and the console window said something about problems with the folder C:\Users\%myfirstname%(confidentiality). which doesn't exist, plus some others of similar weirdness.
Possibly because of issues with security? Tried running as admin, it just didn't make the folders and obviously, couldn't find them when calling for them.
Any help?
Or some (detailed but simple) explanation of how to do this some other simpler way? like all in one file?

Thanks anyone who can help!! Quote from: gogglebot on December 07, 2012, 09:48:32 AM

mkdir %~dp0\testfolder

Quote
apparently the %~dp0 makes it the drive, the path of the file and name of running file the location, but this seemed to glitch out, making a folder called 'stuff' (the parent folder of current folder is called 'game stuff') with a subfolder 'My' ('My game' is the folder with the batch in.) also a folder called %mylastname%. and the console window said something about problems with the folder C:\Users\%myfirstname%(confidentiality). which doesn't exist, plus some others of similar weirdness.
Possibly because of issues with security? Tried running as admin, it just didn't make the folders and obviously, couldn't find them when calling for them.
Any help?
Or some (detailed but simple) explanation of how to do this some other simpler way? like all in one file?

Thanks anyone who can help!!

Standard variable MODIFIERS documented in the FOR help (type FOR /? at the prompt)


%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string

The modifiers can be combined to get compound results:

%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
%~fsI - expands %I to a full path name with short names only

These work not only for FOR metavariables but also batch parameters %0 (which is special, being the batch file itself) and %1 to %9 (passed parameters)

So you can see that %~dp0 is going to expand to the combination of:

%~d0 the drive letter (with colon) on which the batch script is located (NOT necessarily the current directory)
%~p0 the folder path to the batch script is located

I believe the issue you have is not security, it is spaces in the path. If the batch script is located in a folder whose path has any spaces, you have to use quotes so try mkdir "%~dp0\testfolder"

I see you USED quotes later on when echoing to testvar.txt



90% fixed! Stupid mistake that was!

Problem now is that it doesn't read the file and just comes out with the random number again.
The random number was just to test if it WOULD read the old one from the file and to make sure it wasn't just repeating what had just been entered instead of the file.

Now I see that it doesn't read the file.

Help? thanks again!This is one way to read line one of a file.

Code: [Select]set /p "testvar="< "%~dp0\testfolder\testvar.txt" >nulChanged a bit. Somehow more broken than previous.
code:
Code: [Select]@echo off
echo initializing....
mkdir "%~dp0\testfolder"
set /p testvar = Enter test variable here:
echo Will now save your variable to file.
echo %testvar% > "%~dp0\testfolder\testvar.txt"
echo Will now set active variable to random.
set testvar = %random%
echo variable is now %testvar%
echo Will now load variable from file.
pause
set "testvar" < "%~dp0\testfolder\testvar.txt" >nul
echo variable was: %testvar%
pause

The result:

initializing....
Enter test variable here:sdfvgbh
Will now save your variable to file.
Will now set active variable to random.
variable is now //Noteing that it isn't displaying the random number.
Will now load variable from file.
Press any key to continue . . .
variable was: //Also blank
Press any key to continue . . .


Oh dear....
Remember if anyone knows an alternate way to save stuff to file and then read it when the game is next run tell me :L
Just need it explaining well and simply. I posted just before you. You aren't reading the file correctly, and I posted one method.

set testvar=and
set testvar =two

are two different variables.So, what would be the correct code? I inserted your line you posted and put spaces between the ='s and such. that's what I posted just then. set testvar=123
echo %testvar%

Quote from: gogglebot on December 07, 2012, 12:56:25 PM
I ... put spaces between the ='s

This is what you should not do! Batch scripting language does not ignore spaces, unlike many other languages.

Alright, Salmon you seem to better explain things rather than throw bits of code at me. What lines and such specifically need changing?

Thanks@echo off
echo initializing....
mkdir "%~dp0\testfolder"
set /p testvar=Enter test variable here:
echo Will now save your variable to file.
echo %testvar% > "%~dp0\testfolder\testvar.txt"
echo Will now set active variable to random.
set testvar=%random%
echo variable is now %testvar%
echo Will now load variable from file.
pause
set /p testvar= < "%~dp0\testfolder\testvar.txt"
echo variable was: %testvar%
pause

Quote from: gogglebot on December 07, 2012, 01:18:59 PM
Alright, Salmon you seem to better explain things rather than throw bits of code at me.

You, my friend, didn't say thanks to me for either post.

If you want to learn to code, then expect to get lines of code in reply. It is up to you to study them.


Quote from: foxidrive on December 07, 2012, 02:00:28 PM
You, my friend, didn't say thanks to me for either post.

If you want to learn to code, then expect to get lines of code in reply. It is up to you to study them.

I agree 100% with foxidrive.
You can save one or more variable name/value pairs, separated by an equals sign, to one file (or create the file manually in an editor, or make a script generate them) and use FOR to retrieve them.

c:\>echo animal=cat > datastore.txt

c:\>echo colour=red >> datastore.txt

c:\>echo country=Russia >> datastore.txt

c:\>for /f "delims=" %A in (datastore.txt) do @set %A

c:\>echo %animal%
cat

c:\>echo %colour%
red

c:\>echo %country%
Russia

This was done at the prompt; in the FOR line use double percent signs (e.g. %%A instead of %A) in a batch script.

This is what datastore.txt contains

animal=cat
colour=red
country=russia

Handy tip: FOR skips lines starting with a semicolon.



Actually the final line of datastore.txt is now

country=Russia

The name of Russia correctly starting with a capital R. (I edited the script but forgot to correct the earlier version I posted before)

7242.

Solve : New User Error?

Answer»

Hello All ,

I have three user accounts on my pc now
but I need to add two more, everytime I try
to MAKE a new user account, I get this error.

(The User Profile Service FAILED The Logon.
User Profile Cannot Be Loaded.)

Thanks in ADVANCE!

Franktheman7 Which WINDOWS version?

Did you use an administrator account to create the new user profiles?

That's my guess.win 7 ult

yes i used an administrator account to create the new user profiles


Frantheman7http://support.microsoft.com/kb/947215

Look there.

7243.

Solve : How to cmd into Firefox SQLite??

Answer»

I know how to cmd into MS SQL by opening command and type cmdsql -S \(database name), but can I cmd into firefox's SQLite DB to add bookmarks to places.sqlite?Directly editing a web browser's db is *not* a GOOD idea... depending on the purpose you could export a bookmarks file and import it into the TARGET installation, or distribute a default profile with the necessary bookmarks. I'm sure firefox has APIs you can use, but i doubt that a script like that would (for example) work on all computers or future firefox versions.Smells slightly nefarious to me.Quote from: nfin8rider on December 10, 2012, 04:45:54 PM

I know how to cmd into MS SQL by opening command and type cmdsql -S \(database name), but can I cmd into firefox's SQLite DB to add bookmarks to places.sqlite?

Yes. use SQLite3. Specifically, the Command Line shell.



Thanks for the [emailprotected] most situations, it would seem nefarious, but this is for my jobs website. We have these login loop issues caused by the url in the bookmarks or shortcuts. So I'm creating a .exe that will automatically change their settings so that our agents don't have to spend 30mins on each call walking them through setting up their browser. IE was very easy to MAKE changes to, but firefox is a beast for me. Any help would be appreciated!Thanx for the clarification...No problem, I love this forum, it has helped a whole lot since I've joined. I wouldn't want to jeopardize my privelages of being on here and RECEIVING the wornderful help from all of you. I definitely appreciate everyone on here, and hopefully one day I'll be able to reciprocate with helping others as all of you have helped me. Once again, I thank all of you very much!Hope you didn't take it the wrong way...we prefer to err on the side of caution.No, I didn't take it the wrong way. I completely understood your concern. I would have felt the same way as you did because I didn't elaborate further of my intensions of wanting the script.
7244.

Solve : Multiboot with different file systems & OS?

Answer»

Hi everyone,

This is probably a newby question:

I have a new 300GB hard drive that I want to partition in the following way:

The max 2GB under DOS with FAT16
Another 2GB with Win 3.1 and FAT 16
Another 2GB with Win 95 (initial release that only supports FAT16)
Another 2GB with Win 98 and FAT 32
About 100 GB with Win XP
Extra partition for a non-Microsoft OS such as Ubuntu.

First of all, is this possible and what is the best way to start?

Thanks for any help.
Steve
Biggest issue will be DOS SATA Controller Drivers I think. Without those, the Operating Systems wont find the hard drive!

For DOS -> Windows 98SE you would need DOS already running with SATA Drive support, then be able to install 3.11, 95, and 98SE. But I have never done this. With Windows XP you will probably have to make a slipstream with the SATA Drive Controller drivers, so that you can install clean to a partition.

Also the most partitions I have ever made successfully work was 4 per drive.

An easier method I would suggest is making a bunch of virtual machines using Virtual PC which is free from microsoft and you can have DOS all the way forward to Windows 7 running virtual within the same system running XP, Vista, or 7 to support Virtual PC. Everything works well except for video games on Virtual PC, and some programs that have sound sometimes dont work as intended and are mute. I have DOS 6.22, Windows 3.11, Win 95, Win98SE, Win Me, Win XP Home & Pro, and Vista as virtual machines. However I never use Virtual DOS, Win 3.11, 95, or Me. I did it just to have a virtual system to use if I needed to work in that environment on anything, and the regular command shell is fine for my DOS needs.I also think that a VM is a good way to go - I use Virtualbox under Windows xp/7/8 and it works well.
You don't have to reboot to access another OS, you merely open Virtualbox and start the required OS in it's own window.

But if you want to multi boot then one of the boot managers should be able to do it.Quote from: foxidrive on December 06, 2012, 12:06:35 AM

... if you want to multi boot then one of the boot managers should be able to do it.

This is a good Multiple Boot Loader. It's called OSL2000 Boot Manager.
http://www.osloader.com/Thanks guys for all these ideas. I will try virtual PC at the weekend.

I'm not sure why SATA drivers was mentioned. I have already partitioned 2GB with a FAT16 file system, formatted it and installed DOS 6.22. This was just as a test. My motherboard is actually a SBC - Single Board Computer - (a Robo 8779 AR2) in an industrial rack mounted system because I need to use a number of legacy 16 bit ISA cards simultaneously. The backplane in the rack is AT/ATX compatible and has 8 ISA slots and 6 PCI slots that are actively driven. Slot addressing is automatically set in BIOS. The SBC has the necessary SATA sockets and the hard drive, with DOS 6.22 installed, boots fine. I guess the SATA drivers were all loaded succesfully when I setup the chipset driver, audio, video etc with the manufacturer's supplied CD.

My other main issue now, which has nothing to do with the partitioning question I asked about earlier, is communication with one of my 16 bit ISA interface cards that I want to install. This particular card is used to operate a spectrograph (Oriel MS125 with InstaSpec IV) under proprietary DOS software. When I installed the card, using default jumper settings (300H) and other defaults, the PC hung. I couldn't even get into BIOS !

I'm getting no support from the manufacturers Oriel Instruments (now Newport Instruments which became Thermo Corp. afew years ago) since it is a very old card and no longer supported.

What I don't understand is why I can't even get into BIOS after pressing DELETE ?!

Thanks
Steve

Steve .... just saw that this is related to your other ISA post for help. Knowing now the additional info, you might run into issues addressing those ISA cards with Virtual PC running a DOS environment. Reason why i say this is because the hardware in the virtual computer is mostly virtual, and I have used this environment successfully for running older software, BUT to address real physical hardware such as a real card in an ISA slot, that is all new territory and might not work out too well. In the past I have had to use redirection to get a virtual LPT1 printer port to PRINT over the network etc, and the stuff your working with is beyond redirection. You will need direct access to the cards in a real DOS environment I am guessing.

I tried for example to run Ghost 2003 from within Virtual PC to address my Intel Pro 100 NIC in a PCI slot and it wasnt able to find the hardware, because Ghost with NDIS2 drivers was not able to connect with the hardware address of the physical NIC, so to the Virtual System running Windows XP Pro in which Ghost was running at the DOS level after a shutdown of windows and boot to Ghost, it was not able to see the real hardware of the computer and only its virtual hardware. ( most would wonder...why run Ghost within a virtual environment when you can SIMPLY just save a copy of the virtual machine as a backup for quick restoration. I was just bored one day had some time and was wondering if it would work, and it didnt. So I learned then that within the Virtual PC environment, it see's virtual hardware and the software bends it to work with whatever real hardware exists, but it cant bend it to address a NIC directly according to my experience at the DOS level. )

* If anything its good to get familiar with Virtual PC in case you need to run older software side by side windows, but when it comes to interfacing with real hardware, that is a weakness of Virtual PC unfortunately.

Quote
My other main issue now, which has nothing to do with the partitioning question I asked about earlier, is communication with one of my 16 bit ISA interface cards that I want to install. This particular card is used to operate a spectrograph (Oriel MS125 with InstaSpec IV) under proprietary DOS software. When I installed the card, using default jumper settings (300H) and other defaults, the PC hung. I couldn't even get into BIOS !

I'm getting no support from the manufacturers Oriel Instruments (now Newport Instruments which became Thermo Corp. afew years ago) since it is a very old card and no longer supported.

What I don't understand is why I can't even get into BIOS after pressing DELETE ?!

*Its best to keep the QUESTIONS located in the correct location. It was great though that you mentioned that this is related to the ISA issue post though since now I have additional info I didnt have when answering you earlier. If I would have known you had to address older cards, I wouldnt have suggested Virtual PC.Thanks Dave,
I will bear in mind your advice in future regarding the location of posts - I am still quite new to the forum. I didn't get around to trying Virtual PC and actually I didn't believe it would solve my problem, which you have now confirmed.

As you can see from the other post in the Hardware section, I have a tough problem to solve with this old ISA card. Computer_Commando and Lisa_Maree are helping me out with several suggestions and I will try their ideas at the weekend since I'm away from home and the problem PC right now.

[ It's interesting in reading some of the comments how many people think that 16-bit ISA cards are obsolete dinosaurs that are gone forever. When you consider the mass consumer market these folks are absolutely right, of course. But what they do not realize is that there is a large secondary market for these cards, principally from industrial users but there are also private individuals like me, who still need support for these outdated interfaces. Brand new ISA cards are actually still manufactured today by several specialist companies who support industrial users who need these cards to keep their older industrial process control equipment and other machinery running. And dozens of these cards are available on sites such as eBay. ]

Steve
Quote
It's interesting in reading some of the comments how many people think that 16-bit ISA cards are obsolete dinosaurs that are gone forever.

From my background in service dept and manufacturing support as an ET in industrial controls with Allen-Bradley/Rockwell Automation/ Creonics as well as my current job with the USPS, while the majority of home computer users have left the older technology in the past in favor for faster computers with more bells and whistles. There are many businesses out there with older controls and systems etc that are running 15+ year old electronics. Reason being why fix what is not broken, as well as some businesses can not afford the money it would cost to upgrade to a newer PIECE of machinery. Usually you can update some of the older electronic components with newer ones such as when dealing with PLC's etc, but in some cases there are no replacement to the original electronics or the replacement to the original electronics to become modernized is too costly, so you end up running older hardware and either servicing it in house or sending it out for service as well as buying used parts/systems to keep your equipment going. At the USPS where I currently work we still use VMS OS and old DEC ALPHA systems as an example of using old hardware for modern day mission critical application. Sure this could be replaced with new, but what they are using is still working so it makes sense to keep running it vs spending millions of dollars to bring the system forward among all post offices and still end up with the same setup and nothing to gain. There is no advantage to moving the hardware forward for this application, the hardware is still running almost flawlessly on a daily basis, and because there is nothing to gain why replace it. About 75% of the machines out there that cancel your mail with wavy bars, ID Tag it, and take a snapshot of the send to address, are using 8 and 16 bit ISA cards with a mix of newer systems, newest being a DUAL CPU AthlonXP 2200+ CPUs running RedHat 6, and another system running also dual 10+ year old AMD CPU's with NT4, and then another system that is running Windows XP for the operator control interface. And the flat sorter that sorts BUBBLE mailers and magazines is run off of a Pentium III 866Mhz computer with 16bit ISA card used for the OCR and is running QNX OS.

* BUT ... Fact of the matter is that most assume that problems and questions discussed here are home users, and standard home computers, unless information provided states otherwise.
7245.

Solve : help with batch script?

Answer»

Try LOADING different drivers in Win7 for the USB to serial interface.i tried both sets of drivers available on the companys website, windows doesn't have any generic that workQuote from: coolasice1999 on November 25, 2012, 04:23:31 AM

I did take 64bit into consideration, but the NETBOOK i'm using is only 32bit and I have already tried to run it in compatibility mode and no luck there.
Compatability mode is not XP Mode! XP Mode is a VM that allows you to run XP as a virtual OS or older application as Virtual Apps inside XP mode but can be launched from Windows 7.Quote from: Squashman on November 25, 2012, 01:15:28 PM
Compatability mode is not XP Mode! XP Mode is a VM that allows you to run XP as a virtual OS or older application as Virtual Apps inside XP mode but can be launched from Windows 7.

tried in xp mode (did not know about xp mode...i use virtual MACHINES all the time) does the same result, i'm in the process of procuring the original drivers I used on the winxp machine, possibility they are customized somehow which is not working for me here... I would think you would need to install the drivers inside the XP VM for it to work.Quote from: Squashman on November 26, 2012, 04:15:39 PM
I would think you would need to install the drivers inside the XP VM for it to work.

i did... STILL waiting on the guys at work to get me the original drivers to testQuote from: coolasice1999 on November 25, 2012, 06:29:21 AM
I'm still perplexed why this would work perfectly under windows xp and in windows 7 via tera term and hyperterm but not in the batch program?

Just a guess..

http://www.sevenforums.com/tutorials/783-elevated-command-prompt.html

Quote from: Salmon Trout on November 27, 2012, 03:45:16 PM
Just a guess..

http://www.sevenforums.com/tutorials/783-elevated-command-prompt.html



nope, tried that already... still waiting on the original drivers... until them i'll just have to stick with terraterm
7246.

Solve : Comparing part of a filename in a windows batch file?

Answer»

Hi All,

I need help with comparing the filenames in a DIR and get the latest ONE over FTP. The directory on the FTP server has N number of files, all suffixed with MODIFIED date. For e.g :
Test_20131125.txt
Test_20131124.txt
Test_20131123.txt.

The filenames will always begin with Test_ but the date portion will vary. Now I have to get the latest one among these which would be Test_20131125.txt in the example. I want to use a batch file to do so but not sure how to go about it.

Thanks,
KhushbooThe steps you need are:

log in to the FTP server
do a DIR
quit

The DIR has to be CAPTURED to a text file and you will need to filter and parse the text file to extract the latest file, using SORT to give you a sorted list, where you extract the first filename.

Then you log in again
download the file
quit


FTP is a pita.

To get a script you will need to provide an actual log from the FTP server using DIR so that the method to parse the list can be developed, as FTP servers do not all return the directory listing in the same format.
Thank you very much. I am able to list the files on the server to a local text file using the following commands:
open ftpserver
username
password
cd testdir
prompt
ls * ftplist.txt
disconnect
bye

The filesnames get listed in the ftplist.txt on the local server and its contents now look like :
Test_20131122_0307.xls
Test_20131125_0306.xls

I have to get the filename based on the date i.e Test_ will remain the same and I should sort based on the datepart of the filename.
How do I do that?
This depends on the prefix in the files remaining constant:

Code: [Select]@echo off
for /f "delims=" %%a in (' sort ^< "ftplist.txt" ') do set "filename=%%a"
echo "%filename%"
pause

7247.

Solve : freeDOS?

Answer»

If i press f8 i get the following:
Device....[y,n] n
Autoexec.bat [y,n] y
Set prompt=$p$g [y,n] y
Set path=c:\\bin [y,n] y
Set nlspath=c:\\nls [y n] y
Set helppath=c:\\HELP y,n y
Set temp= c:\\temp y,n
I think this keeps going if I enter y so I am going to stop before i SCREW things up even more.

If i di nothing I get:
Invalid opcode at 000B 0000 0006 544e 5952 532e 5359 0000 4esc 5c33 3a44 4443 4f52

in a nutshell, my end goal is to load Windows 7 but baring that to at least get dos RUNNING again.
The computer came preloaded with freeDOS. Here in Asia you have to load your own os. I now see why US computers come preloaded, because i am so fustrated I'd probably go postal on someone at Asus ; )Quote from: netbookidiot on November 24, 2013, 04:02:06 AM

If i press f8 i get the following:
Device....[y,n] n
Autoexec.bat [y,n] y
Set prompt=$p$g [y,n] y
Set path=c:\\bin [y,n] y
Set nlspath=c:\\nls [y n] y
Set helppath=c:\\help y,n y
Set temp= c:\\temp y,n
I think this keeps going if I enter y so I am going to stop before i screw things up even more.

If i di nothing I get:
Invalid opcode at 000b 0000 0006 544e 5952 532e 5359 0000 4esc 5c33 3a44 4443 4f52

You can keep pressing Y and when the error occurs, reboot and press N at that point. Note which line it is and REM it out.
I SUSPECT it is a corrupted TSR and may not be needed.

But to install Windows, you need an external USB DVD drive and just boot off the DVD and install Windows. It doesn't need freedos.

See the steps here: note the boot menu which selects the DVD drive and then it will be a normal install. Note the option of changing the BIOS setting if needed.

http://support.asus.com/Troubleshooting/detail.aspx?SLanguage=en&p=20&m=Eee%20PC%201015E&s=1&hashedid=n/a&os=&no=1718
I would put the install on a usb thumb drive and install from that. I do that all the time on netbooks without optical drives.I think I finally got this to work! In the bios under security I was able to unlock USB and now Windows is loading. Hopefully the install goes well. Thank you for your help.
7248.

Solve : Count Filenames Containing a User-Specified Extension?

Answer»

That's the reason - the shortname generation doesn't follow the rules on XP and earlier (and apparantly Win 7 and 8 32 bit).

I don't have a 64 bit box to test on...I'm surprised; I'd have thought it was a filesystem thing, rather than an OS bitness issue, but your 32 bit W7 & W8 results suggest not.

On W7 64 I tried creating the files on a FAT formatted SD card that happened to be in my card reader; same behaviour (*.txt finds only fileN.txt)
I posted a request in alt.msdos.batch.nt with this batch file, to gauge if it is universal. I'll post results later.


Code: [Select]@echo off
>file1.txt echo abc
>file2.txt echo abc
>file3.txtx echo abc
>file4.txtx echo abc

dir /x *.txt*

for %%a in (*.txt) do echo %%a

pause
This is my Win 8 32 bit machine - same as earlier.


Directory of d:\ABC

20/12/2012 08:08 AM 5 file1.txt
20/12/2012 08:08 AM 5 file2.txt
20/12/2012 08:08 AM 5 FILE3~1.TXT file3.txtx
20/12/2012 08:08 AM 5 FILE4~1.TXT file4.txtx

file1.txt
file2.txt
file3.txtx
file4.txtx
Press any key to continue . . .
foxidrive, do you sleep during the day?
Quote from: Salmon Trout on December 19, 2012, 03:33:49 PM

foxidrive, do you sleep during the day?
Drat! My Vampire secret is out!
(I have insomnia and sleep when I can.)

Two replies are in so far - XP 64 bit and Win7 Pro 64 bit - and both show 'standard' 32 bit behaviour.

On my Windows 7 x64 as well as Windows 8 x64 systems, Ultimate and Professional respectively (doubt that matters but it might), *.txt matches a .txtx file, and dir /x SHOWS the short FILENAME as having a .txt extension.
So my x64 system is the odd one?
Another Win7HP 64 bit machine also shows the 'usual' behaviour.

It would seem just that the behaviour can't be predicted for short filename generation.Dunno if this sheds any light...

D:\test-delete>for /l %A in (1,1,3) do @echo hello world > file%A.lex

D:\test-delete>for /l %A in (1,1,3) do @echo hello world > file%A.lexi

D:\test-delete>for /l %A in (1,1,3) do @echo hello world > file%A.lexicon

D:\test-delete>dir
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 <DIR> .
20/12/2012 18:12 <DIR> ..
20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 file1.lexi
20/12/2012 18:12 14 file1.lexicon
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 file2.lexi
20/12/2012 18:12 14 file2.lexicon
20/12/2012 18:12 14 file3.lex
20/12/2012 18:12 14 file3.lexi
20/12/2012 18:12 14 file3.lexicon
19/12/2012 20:01 43 test.bat
10 File(s) 169 bytes
2 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir /x
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 <DIR> .
20/12/2012 18:12 <DIR> ..
20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 FILE1~1.LE~ file1.lexi
20/12/2012 18:12 14 FILE1~2.LE~ file1.lexicon
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 FILE2~1.LE~ file2.lexi
20/12/2012 18:12 14 FILE2~2.LE~ file2.lexicon
20/12/2012 18:12 14 file3.lex
20/12/2012 18:12 14 FILE3~1.LE~ file3.lexi
20/12/2012 18:12 14 FILE3~2.LE~ file3.lexicon
19/12/2012 20:01 43 test.bat
10 File(s) 169 bytes
2 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir *.lex
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 file3.lex
3 File(s) 42 bytes
0 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir *.lexi
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 14 file1.lexi
20/12/2012 18:12 14 file2.lexi
20/12/2012 18:12 14 file3.lexi
3 File(s) 42 bytes
0 Dir(s) 275,366,141,952 bytes free

D:\test-delete>dir *.lex*
Volume in drive D is SAT-D
Volume Serial Number is E8B2-C5D7

Directory of D:\test-delete

20/12/2012 18:12 14 file1.lex
20/12/2012 18:12 14 file1.lexi
20/12/2012 18:12 14 file1.lexicon
20/12/2012 18:12 14 file2.lex
20/12/2012 18:12 14 file2.lexi
20/12/2012 18:12 14 file2.lexicon
20/12/2012 18:12 14 file3.lex
20/12/2012 18:12 14 file3.lexi
20/12/2012 18:12 14 file3.lexicon
9 File(s) 126 bytes
0 Dir(s) 275,366,141,952 bytes free

D:\test-delete>The short name generation is different - but short names can even be random hex numbers in some cases, so it's not an issue.

Quote from: foxidrive on December 20, 2012, 02:23:34 PM
short names can even be random hex numbers

I noticed that when I WENT to 1000 of each extension.
7249.

Solve : How to send an already active program commands through a batch file??

Answer»

I've been working on getting this server running all night, and I could spend the next several hours typing in each command I want it to do ONE at a time and would need to do that again the next time, however I FEEL that there's an easier way. I've spent about an hour looking through commands and other peoples advice, but I haven't seen anything close enough that I could USE.

So I have the server up and running. It is now awaiting commands. Is there a way to tell it to type out all the other commands I need it to do with a batch file?

I have a text file of all the commands I'd like it to do, I just don't know how to get them all in there in a time efficient way. For /f "delims=" %A in (YOURFILE.ext) do %A

This will take each line of YOURFILE.ext and pass that line to cmd to run. If you have your commands formatted DIFFERENTLY, please post the format so someone can edit the syntax to work. (This will only work on basic text files, so no .doc or such.)Each command is a new line with just Quote

echo <command>

It's very simple. I have it saved as a txt at the moment, but changing that to an ext isn't an issue.Sendkeys in a VBS script or AutoIt can both enter text into active program windows.Not sure if you can do that via .BAT... but I use AutoHotkey for that.

http://www.autohotkey.com/docs/commands/Send.htm

The scripts are really easy to write. I can paste a little sample if you'd like... or you can look in their archives I believe.

- kyle_engineer
7250.

Solve : Excel data compilation using Comand Prompt. Possible. If yes, please help...?

Answer»

Request for help on being able to compile data from several workbooks. I've seen an example where the files can be compiled by converting them into CSV, but was wondering if it can be done on xls and xlsx version of excel 2007 using command prompt.

I need to compile data by tab from about 100's of similar xls or xlsx reports. They have 5 tabs each and it needs to be compiled by tab. The headers for each tab is consistent and needs to be only included once in the cumulative tab of the final product.

Please assist.

Thanks!This is UNTESTED - it comes from two sources and uses Excel on the machine to convert the *.xls* to *.csv.

Run it in a folder with copies of the *.xls* and if it works then provide a sample from a few .csv files with more information about what you need.
You can PM the information, if it is sensitive, if you like.



Code: [Select]@echo off
>excel2csv.vbs echo Set objFSO = CreateObject("Scripting.FileSystemObject")
>>excel2csv.vbs echo src_file = objFSO.GetAbsolutePathName(Wscript.Arguments.Item(0))
>>excel2csv.vbs echo dest_file = objFSO.GetAbsolutePathName(WScript.Arguments.Item(1))
>>excel2csv.vbs echo Dim oExcel
>>excel2csv.vbs echo Set oExcel = CreateObject("Excel.Application")
>>excel2csv.vbs echo oExcel.DisplayAlerts = FALSE
>>excel2csv.vbs echo oExcel.Interactive = FALSE
>>excel2csv.vbs echo Dim oBook
>>excel2csv.vbs echo Set oBook = oExcel.Workbooks.Open(src_file, 0 , TRUE)
>>excel2csv.vbs echo Set objWorksheet = oExcel.Worksheets(1)
>>excel2csv.vbs echo objWorksheet.Activate
>>excel2csv.vbs echo oBook.SaveAs dest_file, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, TRUE
>>excel2csv.vbs echo oBook.Close False
>>excel2csv.vbs echo Set objWorksheet = Nothing
>>excel2csv.vbs echo set oBook = Nothing
>>excel2csv.vbs echo oExcel.Quit
>>excel2csv.vbs echo set oExcel = Nothing

for /f "delims=" %%a in ('dir /on /b *.xls*') do (
Title Making "%%a.csv"
echo Making "%%a.csv"
cscript /nologo excel2csv.vbs "%%a" "%%a.csv"
)
Title Done!
if EXIST excel2csv.vbs del excel2csv.vbs
echo Done!
pauseSuperlike! I'll try this out and comeback shortly:)

Much appreciated! Phenomenal! Thank you so much...

Sorry about the delay! Here’s what I need as the end product:

Once the CSV files have been created. I would like to compile them into a workbook with data from each tab under the following conditions:

1. My files have 3-5 tabs – Each tab to be compiled in one workbook from all the individual CSVs
2. The headers for all the tabs is always consistent, and I would like them to be only available in the consolidated files once
3. In any one column preferably "Column A" populate the name of the file name and in "Column B" the tab name.

Attached is a sample file presenting my report format. These sometimes have a Password too The password is "openbook1"

Thanks again… You are a rock star!

Wishing you a very Merry Christmas and a Happy New year in advance!

[year+ old attachment deleted by admin]For starters, I don't think the xls to cvs script can handle passwords.

Did it create the CSV files? That is what we'd need to write something to help you.Got it. I've removed the password and have attached the the CSV version.

Thanks a lot!




[year+ old attachment deleted by admin]Open the CSV file in Open Office and explain what you want done. The data below the line with all the field names is what you need to be manipulated.
I am unsure how the first THREE lines in the CSV file are used (open it in notepad too see).


Additionally I don't think a CSV file contains the TAB information, or I don't understand how it does so.About two years I had learned that Powershell can easily read and write to Excel files. Thanks Squashman. I would assume it also needs Excel to be installed to do so, as the VB script does.

Can it also write to native XLS files?I too am interested if Powershell can write to native XLS files, as for I know that CSV's are easy to edit, create etc.Although Powershell can write and read .csv files, as can MANY scripting and programming tools, there isn't anything in Powershell (or any of the others) to natively read or write Excel format files, that is, files which would have an .xls or .xlsx extension. By 'natively' I mean, when Microsoft Excel is not also installed. When Microsoft Office applications are installed, (it gets a bit technical here!) they expose something called a "COM object MODEL" that programmers and scripters can get at and manipulate to do various things. Powershell uses the same COM object (Excel.Application) as VBScript. I found this in the snippet closet. It converts a single workbook into txt, csv, or html format. It could be tweaked to convert an entire folder of workbooks by adding an outer loop to iterate all the workboooks in a folder.

The VBScript version can check if the worksheet in empty, but I could not get the equivalent instruction to work in Powershell. In order to save each worksheet in text format, the script must loop thru the worksheet collection. If not, only the active worksheet gets saved correctly.

Code: [Select]param (
[System.IO.FileInfo] $xlBookPath = $( Read-Host -Prompt "Enter Spreadsheet Path" ),
[System.IO.DirectoryInfo] $txPath = $( Read-Host -Prompt "Enter Output Folder"),
[string] $filetype = $( Read-Host -Prompt "Enter Output Filetype" )
)

function Release-Ref ($ref) {
([System.Runtime.InteropServices.Marshal]::ReleaseComObject([System.__ComObject]$ref) -gt 0)
[System.GC]::Collect()
[System.GC]::WaitForPendingFinalizers()
}

function GetOutputFileFormat {
Param([string]$formatname)

$passback = 0
switch($formatname) {
"csv" { $passback = 6 }
"txt" { $passback = 20 }
"html" { $passback = 44 }
default {Write-Host -ForegroundColor Yellow "Invalid File Format"; Exit}
}
return $passback
}

$xlApp = New-Object -ComObject Excel.Application
$xlApp.Visible = $false
$xlApp.DisplayAlerts = $true
$xlBook = $xlApp.Workbooks.Open($xlBookPath)

$OutputFileFormat = GetOutputFileFormat($filetype)
$xlSheet = $xlBook.Worksheets.item(1)

foreach($xlSheet in $xlBook.Worksheets) {
$TextFileName = (Join-Path -Path $txPath -ChildPath $xlBookPath.basename) + "~" + $xlSheet.Name + "." + $filetype
$xlSheet.SaveAs($TextFileName, $OutputFileFormat)
}

Release-Ref($xlSheet) | Out-Null
Release-Ref($xlBook) | Out-Null
Release-Ref($xlApp) | Out-Null

Stop-Process -Name Excel

Notes:

Tested on Win7 x64
The Stop-Process cmdlet is used to flush Excel from the system; Excel likes to hang out past it's shelf life.
The output file names are formatted: workbookname~sheetname.extension; The file format and the extension are the same. (Prompted at runtime)
I'm big fan of prompts. Saves opening in an editor for each run and don't have to remember any command line arguments

Maybe somebody can use this

Quote from: foxidrive on December 21, 2012, 08:10:18 PM

Thanks Squashman. I would assume it also needs Excel to be installed to do so, as the VB script does.

Can it also write to native XLS files?
Yes. I believe so. It was a few years ago that I was playing around with it but haven't touched it in close to 3 years now. I got back from vacation that year and either my desire to keep working on it dwindle or my job duties changed. Either way I don't think my co-workers would use it anyways. I was working on a Powershell script that would take an excel file and extract to a flat text file because that is what we work with on the mainframe. I could actually go column by column and figure out what the longest cell was in each column and then extract each row to a fixed text file.

I want to get back into it one of these days.Thanks to all - and I've saved the snippet for later use
I don't have excel to test it out with.