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.
| 5751. |
Solve : Folder Cleaner Utility, Should I include a Log File?? |
|
Answer» I'm developing a command line utility that will remove sub-directories/files BUT leave the parent folder. My question is, should I include the ability to write the deleted sub-directories/files to a log file, so the user could see what was deleted? I'm developing a command line utility that will remove sub-directories/files BUT leave the parent folder. This should do that job: it's untested. Remove the rem to create the log file. Code: [SELECT]@echo off :: removes the files and folders under %1 but leaves the %1 folder set "folder=%~1" if not "%~1"=="" if exist "%folder%\" ( rem DIR "%folder%" /b /s /a-d >file.log pushd "%folder%" && (rd /s /Q /f "%folder%" >nul 2>&1 & popd) ) pause |
|
| 5752. |
Solve : error downloading with wget in batch? |
|
Answer» K so i installed wget and it all works but then i get permission deny even if i run it as admin |
|
| 5753. |
Solve : Automatically click a batch file? |
|
Answer» Quote from: BC_Programmer on January 04, 2016, 12:03:31 AM His Windows install is probably borked. Could be a result of him allegedly writing malware and other garbage provided to him by his "professional programming teacher". no its so that i can implement a pixel mouse inside the batch to click a button, dude back off with the negativity. i run my malware in a virtualbox, and i dont use it for illegal purposes. im noting going to bork my windows. thats non senseQuote from: Geek-9pm on January 02, 2016, 10:38:14 PM A mentioned earlier, batch is not much of monitoring events and external conditions. im just trying to type in two windows at the same timeQuote from: zask on January 04, 2016, 11:22:45 PM im just trying to type in two windows at the same timeAgain, it is not clear what you mean. Do you ride two bicycles at the same time? (Very HARD.) Do you walk two dogs at the same time? (Possible.) Can you type on two typewrites at the same time? (Clark Kent could.) For users that need to repeat something MANY l times, they use tools suitable for doing repetition a number of times. Such are called 'macro' devices or tools. https://en.wikipedia.org/wiki/Macro_%28computer_science%29 Quote (Thus, they are called "macros" because a big block of code can be expanded from a small sequence of characters.) In batch you can define macros in a special way. There are not called macros, but they are. On batch can call another batch and pass parameters. For an industrial programmer this serves as a macro. Quote from: foxidrive on December 30, 2015, 11:57:02 PM It helps in a programming FORUM to ask an exact question of what you want to doQuote from: zask on December 31, 2015, 12:02:52 AM Im sorry that my question appeared bogus, I couldn't think of anyway to explain it any better than i want the file to automatically click itself at startQuote from: zask on January 01, 2016, 12:47:11 PM like really it's not that hard to understandQuote from: zask on January 04, 2016, 11:18:57 PM no its so that i can implement a pixel mouse inside the batch to click a buttonQuote from: zask on January 04, 2016, 11:22:45 PM im just trying to type in two windows at the same timeQuote from: zask on January 04, 2016, 11:16:15 PM I want multiple windows to be focused at the same time as the batch windows, for example if i type in google, or on a game or something, it would also type in the batch screen.Quote from: zask on January 04, 2016, 11:18:57 PM dude back off with the negativity.Actually I've been quite restrained. I made significant edits to most of my posts before submitting them to fit within forum rules. I STILL don' get what he really means. He says type in two windows. You can not do that. But you can switch windows. Quote Many users reach for the mouse, point to the Taskbar, and then click the button for the window they want to bring to the foreground. That's about the slowest, least convenient method. If you're a fan of keyboard shortcuts, like I am, you probably use Alt-Tab to cycle between open windows. Now if you have a block of text you wish to send to two destination,s you select it and use the 'send to' option to put in on another location. Or send to clipboard and then to destintion. Okay i dont mean have two windows focused at the same time, i said that wrong, i mean i want to have two windows that implement task and send them to each other, for example like the [Batch] [Colours] [Sound] Honguito98: Limits Of Batch 2 that is found here~ https://www.youtube.com/watch?v=QMiZQxu1Rpo they all require each window to make it's whole operation work. |
|
| 5754. |
Solve : help for my batch? |
|
Answer» Hi, |
|
| 5755. |
Solve : Installation MS-DOS 6.22? |
|
Answer» As per usual Geek's headline Post is mis-leading...Quote from: BC_Programmer on January 12, 2016, 06:23:34 PM I've had no issues booting FreeDOS on a Core i7 4770K with 32GB of Memory, but FreeDOS is limited to 4GB total address space as it doesn't support PAE. The limit of HIMEM.SYS is why anyone WOULD use QEMM. Even back in the later 80s when expanded and extended memory was available it allowed extensive use of as much RAM for you to use. Now back then when your average machine was somewhere around 8 to 16 mhz compiling and linking took several hours but if you load your source, set temp, and load your compiler and linking up in a fast ram disk you cut your time almost in half. Also back then you did not have HIMEM.SYS to use, Also back then I ran a multi-node BBS on an old IBM-PC with an AST 6-pak expanded memory card loaded with 16meg of RAM. 3 windows for the BBS and one I USED for maintenance. I used it through Win98. I guess if you never have used it you would not know some of the advantages of it.I did a search on ebay and yep you can buy 6.22. But these are on floppies, some on 5.25" floppies. Floppies are magnetic disks, and they do not last a life time, fact is 2 years is stretching it if they are never used. Also you have no idea how or where they were stored since any thing magnetic will erase them in a heartbeat. The product id was just that a product key, you did not enter it to make it work. The ID really was to go with the computer it was installed on. I built many a dos machine and packaged the manual with the machine, and never put in any ID. Also my original floppies are trash, but several years ago before they went dead I created a boot CD with 6.22 and copied the files to the CD. If, and it has several times in its life, were to die I can easily reload DOS. I did the same with my Win4WG 3.11 and those original floppies are also dead now. Quote from: OldTimeCoder on January 12, 2016, 02:29:26 PM I triple boot on this machine MS-DOS, Linux, and WinXP. Virtual machines is what I use these days. Booting a PHYSICAL machine is OK if you have hardware requirements that need a real OS, or have some program that can't be made to run in a VM - but the convenience of a virtual OS is MAGIC. |
|
| 5756. |
Solve : Simple Batch Text Editor Plzzz help? |
|
Answer» I am trying to make a batch file that creates messages for other batch files. It FIRST ask for a name to name the file it creates. then then asks to display a MESSAGE which goes into a spinner for 20 loops and then displays if you would like to clear the screen or continue typing. The problem is that every time I type (Y) in the prompt to clear the text of the created batch file, the prompt closes for an unknown reason. can anyone help? Your IF - ELSE block after label Restart1 does not look right. There is no opening parenthesis ending the IF line.no i did not know that, thanks! |
|
| 5757. |
Solve : %appdata% use within batch help? |
|
Answer» I made a batch earlier today to clean my IMVU http game cache that grows over time with no built in size management, and as it grows it starts to lag out performance as at one point it was filled with 5.3GB of cache mostly junk gathered throughout gameplay which appears to act like a precache for the game. However when you end up with over 100,000 of these small files the performance benefit of these files being local disappears. I made a copy of IMVU before and after so I could restore the 5.3GB of cache data back and it LOADS rooms etc more than twice as fast by not seeking the data locally but instead redownloading it off the IMVU servers over 25/5 mbps broadband. The batch I made for this specific COMPUTER I just gave it the full path of c:\Users\AX4\AppData\Roaming\IMVU\ and told it to remove the HttpCache directory and all contents silently. Then recreate an empty directory back at that location for the IMVU client to write to when the game is run again. The filename, directory name, or volume label syntax is incorrect. Note: The pause after the rd /s /q HttpCache is only here for debugging and WOULD be removed later. I placed it there to capture the error condition. echo off color 4f cls @echo. @echo. *************************** @echo. IMVU Http Cache Eraser @echo. *************************** @echo. Version 1.0 @echo. 6/1/2016 @echo. pause color e0 cls cd c:\%AppData%\Roaming\IMVU\ @echo. @echo. @echo. *************************** @echo. Erasing IMVU Http Cache @echo. Please Wait... @echo. *************************** @echo. @echo. rd /s /q HttpCache pause md HttpCache color 3f cls @echo. ************************** @echo. IMVU Http Cache Erased @echo. ************************** @echo. @echo. pauseThe expansion of the %appdata% environment variable already contains the system drive letter, colon and backslash e.g. C:\ at the beginning so you don't need it like in the code line following. It will make the CD command point to a non-existent folder and give the error you saw. cd c:\%AppData%\Roaming\IMVU\ Thanks Salmon for assisting... But its still not happy. Using Windows 7 Home Premium 64-bit by the way just in case that make a difference somehow. I tried cd %AppData%\Roaming\IMVU\ cd \%AppData%\Roaming\IMVU\ cd C:\%AppData%\Roaming\IMVU\ And the path is correct to this folder at the deeper target of Roaming\IMVU\ Changed it to cd %AppData%\Roaming\IMVU\ as suggested and it says path not found. Quote The system cannot find the path specified. Here is my system paths from SET: Quote Microsoft Windows [Version 6.1.7601] [attachment deleted by admin to conserve space]Environment variable may not expand %APPDATA% to the Application folder https://support.microsoft.com/en-us/kb/329308 Quote This behavior is caused by a problem in Shell32.dll.Hello Geek ... it looks like that bug is in reference to: Quote Article ID: 329308 - Last Review: 02/28/2007 23:02:00 - Revision: 2.3 And I'm running Windows 7 64-bit I didnt catch this fact that it was for different OS until I went to the suggested fix and there was no Properties option and I was like hmmm why is it missing and then I looked further and saw that it was regarding other affected OS's. Quote APPDATA=C:\Users\AX4\AppData\RoamingQuote Changed it to cd %AppData%\Roaming\IMVU\ as suggested and it says path not found. That expands to C:\Users\AX4\AppData\Roaming\Roaming\IMVU\ . You want Code: [Select]%APPDATA%\IMVUCOOL! Thanks BC That was the fix! Thanks everyone. I thought it would only bring you in to the AppData depth of the path. Did not know that any subfolders could be targeted without exclusive pathing. I thought the path had to be exclusive to be specific to Roaming prior to IMVU. Correction to my last response Quote Did not know that any subfolders could be targeted without exclusive pathing. I thought the path had to be exclusive to be specific to Roaming prior to IMVU. I realized I was wrong in my statement. Looking back here I see that %AppData% pointed direct to the Roaming folder of the profile Quote APPDATA=C:\Users\AX4\AppData\Roaming The path is specific as seen in SET The fix to batch worked perfect, so issue is solved, but in case anyone ever gets here and reads the entire thread, they will see this correction.Windows XP SP3 C:\Documents and Settings\username\Application Data Windows 7 SP2 C:\Users\username\AppData\Roaming Windows 10 C:\Users\username\AppData\Roaming Usernames can have spaces and other nasties, so wrap it in double quotes to protect against that. Code: [Select]"%APPDATA%\IMVU"Cool Thanks Foxidrive ... I overlooked that. The good thing is that my friends computers who also run IMVU dont have spaces so the original form worked like a charm, but its good to state it here to fix that line to include the " " in case someone else runs with the batch to use as their own that finds this online. |
|
| 5758. |
Solve : getting variables in batch encrypter to work.? |
|
Answer» I changed the code again, maybe this one is more better to look at. Zack, I thought you already did this. okay i will explain, and yes i have but i just got busy and just now had the time to start again. im trying to make a text file. this text file will have commands in the batch language inside of it. i want to make a encrypter to take this text file and encrypt it. after the text file becomes encrypted i want the encrypter to generate another batch file (the decrypter), in this new batch file, it will take all the encrpyted lines of text (commands) and decrypt them within the same batch file and execute them. this way i can actually encrypt my batch files themselves, unlike other batch encrypters that only encrypt messages, i want to make the first actual batch encrpyter (a.k.a encrpyt the commands). I gave up in the past because i couldn't get any commands that involve variables to execute within the decrypt batch file in the correct way. but i found out that as long as the variables aren't enrypted and everything else is, the code will work completely fine. i tested this with the example above. now im wondering if there is a way to avoid encrypting capitalized letters, this way if a make a variable like this %A%, it wont become encrypted. but if i add one like this %a%, it will become encrypted. this way i can ensure that if i capitalized all my variables, they will display correctly rather than incorrectly because they wont become encrypted. if you would like me to explain exactly what everything in the code is doing then i can, and it's honestly not as complex as it looks. it's actually petty essay to understand once you explain it. the reason is because at this moment, there is no true batch encrypter, and i think it would just be absolutely amazing if someone could make one of these, because it is possible, just no one has put the effort into doing it. if i obfuscated my code, then encrypt my obfuscated code, as well as obfuscate my decrpyter, then compile the decrpyter, then i could more effectively protect my batch file sources, or at least use it for a small part of my programs that i have compiled. is this elaborate enough? The problem is in this section of code. Setlocal EnableExtensions for /f "delims=" %%A in (%FILEA%.txt) do ( Set /a C+=1 Set X[!C!]=%%A set CHECKPASSWORD=%%A set CHECKKEY=%%B set CHAR=0123456789%Randalphabet%%% echo(%%A|findstr /v "[abcdefghijklmnopqrstuvwxyz]" >nul && ( goto avoid ) || ( for /l %%C in (10 1 36) do ( for /f %%D in ("!CHAR:~%%C,1!") do ( set /a MATH=%%C*%CREATEKEY% for /f %%E in ("!MATH!") do ( :avoid set "CHECKPASSWORD=!CHECKPASSWORD:%%D=¼%%E!" ) ) ) echo !CHECKPASSWORD! >> %FILEB%.!_RndAlphaNum! ) ) ) Set X Quote from: zask on May 24, 2016, 03:44:17 PM okay i will explain, and yes i have but i just got busy and just now had the time to start again. im basically trying to add this to my code @echo off setlocal set x=ABC set y=AbC echo(%x%|findstr /v "[abcdefghijklmnopqrstuvwxyz]" >nul && ( echo %x% is Valid pause ) || ( echo %x% is Invalid pause ) echo(%y%|findstr /v "[abcdefghijklmnopqrstuvwxyz]" >nul && ( echo %y% is Valid pause ) || ( echo %y% is Invalid pause ) this is all i can think of so far Setlocal EnableExtensions for /f "delims=" %%A in (%FILEA%.txt) do ( :reload Set /a C+=1 Set X[!C!]=%%A set CHECKPASSWORD=%%A set CHECKKEY=%%B set CHAR=0123456789%Randalphabet% Setlocal EnableExtensions echo("%%A"|findstr /v "[abcdefghijklmnopqrstuvwxyz]" >nul && ( echo %%A >> %FILEB%.!_RndAlphaNum! call :reload ) ) || ( for /l %%C in (10 1 36) do ( for /f %%D in ("!CHAR:~%%C,1!") do ( set /a MATH=%%C*%CREATEKEY% for /f %%E in ("!MATH!") do ( set "CHECKPASSWORD=!CHECKPASSWORD:%%D=¼%%E!" ) ) ) echo !CHECKPASSWORD! >> %FILEB%.!_RndAlphaNum! ) )There is a button on the editor toolbar in the forum that adds code TAGS around the highlighted section of text. - usually you highlight your code and then select the # button and it will appear correctly when you submit your post.Code: [Select]@echo off setlocal set x=ABC set y=AbC echo(%x%|findstr /v "[abcdefghijklmnopqrstuvwxyz]" >nul && ( echo %x% is Valid pause ) || ( echo %x% is Invalid pause ) echo(%y%|findstr /v "[abcdefghijklmnopqrstuvwxyz]" >nul && ( echo %y% is Valid pause ) || ( echo %y% is Invalid pause ) this is all i can think of so far Setlocal EnableExtensions for /f "delims=" %%A in (%FILEA%.txt) do ( :reload Set /a C+=1 Set X[!C!]=%%A set CHECKPASSWORD=%%A set CHECKKEY=%%B set CHAR=0123456789%Randalphabet% Setlocal EnableExtensions echo("%%A"|findstr /v "[abcdefghijklmnopqrstuvwxyz]" >nul && ( echo %%A >> %FILEB%.!_RndAlphaNum! call :reload ) ) || ( for /l %%C in (10 1 36) do ( for /f %%D in ("!CHAR:~%%C,1!") do ( set /a MATH=%%C*%CREATEKEY% for /f %%E in ("!MATH!") do ( set "CHECKPASSWORD=!CHECKPASSWORD:%%D=¼%%E!" ) ) ) echo !CHECKPASSWORD! >> %FILEB%.!_RndAlphaNum! ) ) Quote from: foxidrive on May 25, 2016, 01:59:45 AM There is a button on the editor toolbar in the forum that adds code TAGS around the highlighted section of text. Oh ok i figured it out now. Is this what you mean? I just didn't know how to do it on here.Please quit quoting your code and creating huge posts. I think i mentioned this previously...if not ...take heed.Quote from: patio on May 25, 2016, 02:33:58 PM Please quit quoting your code and creating huge posts. Okay ill just be simple, i need a way to detect if a variable contains a capital letter in it, if it does do one thing, if it dont do something else.Zack, just get it to work with lower case letters. Then deal with upper case later. Also, is there any other program language you use?Yes autoit, autohotkey, javascript, vbs, html, css, php, and java. By vbs you mean VBScript https://en.wikipedia.org/wiki/VBScript Or did you mean "Vacation Bible School" (Rather doubtful.) VBScript is well suited for manipulation of strings and characters. My segues is that a simple encryption program can be done in 25 lines or less. Yo can invoke VBScript from a command line. Quote from: Geek-9pm on May 25, 2016, 08:43:33 PM By vbs you mean VBScript Vbscript, I was hoping you would wold have understood by "vbs" meaning vbscript, not visual basic, or "Vacation Bible School." And i know you can encrypt in vbscript, im trying to do it in batch. -_- Im not trying to make a encryption program for any other language. im trying to make a batch encrypter. Understood. If it were me, I would create a working model in my best language and then try to get it to work in batch. VBScript might be what I would use. Or maybe VBA. After I verified the algorithm I use is good, then I would try to export the idea into a batch file. But if I wanted to obfuscate, I might just go to machine code at the lowest level. Obfuscate: verb verb: obfuscate; 3rd person present: obfuscates; past tense: obfuscated; past participle: obfuscated; gerund or present participle: obfuscating render obscure, unclear, or unintelligible. "the spelling changes will deform some familiar words and obfuscate their etymological origins" synonyms:obscure, confuse, make unclear, blur, muddle, complicate, overcomplicate, muddy, cloud, befog "mere rationalizations to obfuscate rather than clarify the real issue. As mentioned earlier, encryption is not the same as making something hard to understand. BTW: New hardware is coming soon with encryption built into the motherboard of a PC. Quote from: zask on May 25, 2016, 05:10:38 PM Okay ill just be simple, i need a way to detect if a variable contains a capital letter in it, if it does do one thing, if it dont do something else. There's a way to do that with FOR but it depends on what other kinds of characters are in the variable. Alphanumeric characters are handled easily but various special characters will not work. |
|
| 5759. |
Solve : xcopy symblic links from to directories in a text file? |
|
Answer» I've got a TEXT file with the full PATH and I want to copy all the symbolic links from a source folder to each folder in the text file. Text file is CALLED subs.txt looks like this: I've got a text file with the full path and I want to copy all the symbolic links from a source folder to each folder in the text file. Text file is called subs.txt looks like this: Did you use a batch file or a command prompt? How come you are using !slinks? or is that a folder? From http://superuser.com/questions/148099/windows-7-symlinks-how-do-i-copy-a-symlink-to-a-directory Quote use the following command from elevated command prompt: |
|
| 5760. |
Solve : Nested Ifs Formula? |
|
Answer» As it states in every article and HELP screen I've read, these things will drive you CRAZY and I'm CERTAINLY there! I am desperate for a nested If statement to accommodate several scenarios... Can someone contact me if they are a guru of Nested IF's and would be willing to give it a try? Thank you so much!!!What environment do you need these IF statements in? Batch or a actual programming language like C++ etc? The fact that you state "Formula" is this IF logic WITHIN an Excel spreadsheet? |
|
| 5761. |
Solve : Batch File to open multiple files & PDFs? |
|
Answer» Good morning all, Output needs to be based on Vendor number and PDF file by date. Is the requirement for the user to enter a list of vendor numbers and open the lastest PDF file in each vendor folder? 1) What program is being used to view the PDF files in? 2) What files are being opened? Your subject states "files & PDFs" |
|
| 5762. |
Solve : Listing files on a network drive? |
|
Answer» Hi all, I am trying to create txt file of all the files on a network drive and then order them by the date that they were created. Did Squashman's tip help you? I'm IDLY wondering if the network drive is NTFS or FAT or a Unix formatted drive. |
|
| 5763. |
Solve : how to add characters in this message ~Ex.) ("")? |
|
Answer» It's really sad when someone claims that something had no decryption method, but put's zero effort in looking at that code. you stated this polymorphism is not encryption nor decryption, but rather both at the same time to cause a mutation effect called obfuscation. You only had your information off by a slight hair.Polymorphic software is when the actual data written to disk representing the executable changes with each copy. It is most commonly employed by malware to avoid AV heuristics, but technically any software could use it. Another possible application is for licensed software; if the key can be constructed from the local system information, the program will only successfully decrypt the main block on that system. This doesn't tend to get used much- last time I saw it was on Interactive Physics II for Windows 3.1 Which I sadly could not copy from a laptop I received that had it installed. Mind you, changing the software with each duplication doesn't require encryption, but it is the easiest way to implement large changes to the on-disk data while preserving the functionality. Each new copy that runs can write a new file by writing the bootstrap, and then generating a new random string to use as the encryption key input into the algorithm (as I said, the most common I've seem in my inspections is Rijndael, which is likely because implementations of the algorithm can be fairly easily found since it is used for AES block encryption. The important factor here is that the encryption key is a piece of data that must be provided to an encryption algorithm. Another good example of encryption is DaveLembke's small Encryption program That he shared a while ago. The password key is a required input as well as an active part of changing the data- using the wrong password would not work to provide the original data. It's not particularly secure encryption, mind you, but as the password/key is a required input to an algorithm it fits the bill. Your example, again, is a substitution cipher; if you hard-code the key as part of the algorithm, most encryption algorithms become plain-ol' substitution ciphers. Encryption requires a separate input key that is an active part of the algorithm, Which I've already described. If you search through definitions, I'm sure you could reason such that it is "encryption" but as I said previously you could likely use the same approach to "prove" that you can withdraw money from the sides of a river (the sides of a river are a bank, after all) Quote Now do i not know what im talking about? do you understand how this is encryption now?? Can you please explain to me now how this isn't encryption.I've explained to you about 3 times now how this isn't encryption. If I had suspected the layer of hubris and superciliousness was impermeable, I wouldn't have BOTHERED. Quote now are you going to apologize for telling me that i was wrong?Anybody who understands what cryptography is will look at your example and laugh at the idea that it is encryption. Quote i believe you should Mr. Encryption expertI never once stated I was an encryption expert. I did say that I know enough about it to depend on the existing algorithm implementations unless my intent is to learn more about the implementation, Though the existing documentation on the algorithms themselves are USUALLY enough information. Quote i actually understand more than the average professional would expect from my age. Being a kid means thinking you're the exception to this rule, being an adult is realizing you're not. Quote from: BC_Programmer on January 21, 2016, 02:20:21 AM I respond primarily because that will expediate this thread getting locked. so your basically saying that encrypted encryption the when something is encoded and requires a secret key to decrepit it, but the batch file does both encoded it's self and has a secret key. without the bottom part of the code that i showed you there would be absolutely no command executed. I'm not saying that your encryption isn't encryption but im saying that my file contains polymorphic code, you can say thats it not encryption but you cant say that it's not polymorphism. by definition polymorphism is encryption. You are saying that it is not encryption because when echo is set to on the code can be seen, but they aren't seen until they are decripted. if the code is not encrypted then why if i remove the decryption part of the script absolutely nothing happends? nothing can be displayed with @echo on or any command period without me adding its code. the example script below contains only the encryption part. try any command you like, nothing will happen until its decoded. XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX @echo on title Encripted.bat by Zask set ywnp=ycf set ywnp=s GoTo ywnp set ywnp=nk :ywnp set ljdt=wxh set ljdt=e GoTo ljdt set ljdt=gz :ljdt set dyiq=qfm set dyiq=t GoTo dyiq set dyiq=ts :dyiq %ywnp%%ljdt%%dyiq% bc=ntx %ywnp%%ljdt%%dyiq% bc=a GoTo bc %ywnp%%ljdt%%dyiq% bc=qv :bc %ywnp%%ljdt%%dyiq% kx=fsh %ywnp%%ljdt%%dyiq% kx=b GoTo kx %ywnp%%ljdt%%dyiq% kx=vc :kx %ywnp%%ljdt%%dyiq% np=yxw %ywnp%%ljdt%%dyiq% np=c GoTo np %ywnp%%ljdt%%dyiq% np=nm :np %ywnp%%ljdt%%dyiq% pc=dzc %ywnp%%ljdt%%dyiq% pc=d GoTo pc %ywnp%%ljdt%%dyiq% pc=vn :pc %ywnp%%ljdt%%dyiq% ev=bzw %ywnp%%ljdt%%dyiq% ev=e GoTo ev %ywnp%%ljdt%%dyiq% ev=uz :ev %ywnp%%ljdt%%dyiq% rk=utl %ywnp%%ljdt%%dyiq% rk=f GoTo rk %ywnp%%ljdt%%dyiq% rk=xs :rk %ywnp%%ljdt%%dyiq% va=ily %ywnp%%ljdt%%dyiq% va=g GoTo va %ywnp%%ljdt%%dyiq% va=bh :va %ywnp%%ljdt%%dyiq% qj=zjc %ywnp%%ljdt%%dyiq% qj=h GoTo qj %ywnp%%ljdt%%dyiq% qj=cr :qj %ywnp%%ljdt%%dyiq% rb=srp %ywnp%%ljdt%%dyiq% rb=i GoTo rb %ywnp%%ljdt%%dyiq% rb=zb :rb %ywnp%%ljdt%%dyiq% ht=oom %ywnp%%ljdt%%dyiq% ht=j GoTo ht %ywnp%%ljdt%%dyiq% ht=it :ht %ywnp%%ljdt%%dyiq% nj=pjt %ywnp%%ljdt%%dyiq% nj=k GoTo nj %ywnp%%ljdt%%dyiq% nj=po :nj %ywnp%%ljdt%%dyiq% vm=kfx %ywnp%%ljdt%%dyiq% vm=l GoTo vm %ywnp%%ljdt%%dyiq% vm=pl :vm %ywnp%%ljdt%%dyiq% mc=ukc %ywnp%%ljdt%%dyiq% mc=m GoTo mc %ywnp%%ljdt%%dyiq% mc=dn :mc %ywnp%%ljdt%%dyiq% fa=kpi %ywnp%%ljdt%%dyiq% fa=n GoTo fa %ywnp%%ljdt%%dyiq% fa=tg :fa %ywnp%%ljdt%%dyiq% hx=wuz %ywnp%%ljdt%%dyiq% hx=o GoTo hx %ywnp%%ljdt%%dyiq% hx=bt :hx %ywnp%%ljdt%%dyiq% ec=qyi %ywnp%%ljdt%%dyiq% ec=p GoTo ec %ywnp%%ljdt%%dyiq% ec=tn :ec %ywnp%%ljdt%%dyiq% vb=kbz %ywnp%%ljdt%%dyiq% vb=q GoTo vb %ywnp%%ljdt%%dyiq% vb=yh :vb %ywnp%%ljdt%%dyiq% fn=iam %ywnp%%ljdt%%dyiq% fn=r GoTo fn %ywnp%%ljdt%%dyiq% fn=kt :fn %ywnp%%ljdt%%dyiq% vv=enu %ywnp%%ljdt%%dyiq% vv=s GoTo vv %ywnp%%ljdt%%dyiq% vv=so :vv %ywnp%%ljdt%%dyiq% je=tdw %ywnp%%ljdt%%dyiq% je=t GoTo je %ywnp%%ljdt%%dyiq% je=ki :je %ywnp%%ljdt%%dyiq% bk=ymk %ywnp%%ljdt%%dyiq% bk=u GoTo bk %ywnp%%ljdt%%dyiq% bk=zq :bk %ywnp%%ljdt%%dyiq% ik=zff %ywnp%%ljdt%%dyiq% ik=v GoTo ik %ywnp%%ljdt%%dyiq% ik=ce :ik %ywnp%%ljdt%%dyiq% bq=hfd %ywnp%%ljdt%%dyiq% bq=w GoTo bq %ywnp%%ljdt%%dyiq% bq=dt :bq %ywnp%%ljdt%%dyiq% aj=oku %ywnp%%ljdt%%dyiq% aj=x GoTo aj %ywnp%%ljdt%%dyiq% aj=dh :aj %ywnp%%ljdt%%dyiq% ex=agr %ywnp%%ljdt%%dyiq% ex=y GoTo ex %ywnp%%ljdt%%dyiq% ex=ju :ex %ywnp%%ljdt%%dyiq% rp=kri %ywnp%%ljdt%%dyiq% rp=z GoTo rp %ywnp%%ljdt%%dyiq% rp=we :rp %ywnp%%ljdt%%dyiq% za=kxr %ywnp%%ljdt%%dyiq% za=GoTo za %ywnp%%ljdt%%dyiq% za=fb :za echo Nothing has happen before this line. pause XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXX your explanation was saying that the code was not encryption because had absolutely no encoded script nor a decryption TECHNIQUE. But the code has both the encoded TEXT and the requirements to decode the text. how is the code not encoded if the first part code (encryption code) will not EXECUTE without adding the second part of the code (decryption code). For the millionth time i understand that a key and the plain text goes into an encryption algorithm which creates another key with ciphered text. I understand that that ciphered text is then sent into a decryption algorithm which is used to turn the ciphered text into a decryption algorithm. I understand That all my code is doing is substituting it's defined meanings. i understand that polymorphism involves any form of text to be converted to a different meaning to simulate mutation for crap like avoiding antiviruses. and that this differs from adding a actual algorithm that can be then undone with an actual form of decryption, but all i am saying is that by definition of polymorphism is that it is a form encryption because the code become encoded and decoded without a algorithm, like the Caesar cipher created by Julius Caesar which required just plain definitions with substituted meanings . just like your explaining from your definition that mine is not. im not saying your wrong. im just stating the polymorphous code by the definition of polymorphism. even if my definition doesn't comply with your deffinition, i told you that i was only intending to keep a regular non programming experienced user from open it and see it. Quote from: zask on January 21, 2016, 11:36:22 AM so your basically saying that encrypted encryption the when something is encoded and requires a secret key to decrepit it, but the batch file does both encoded it's self and has a secret key.No it doesn't. I'm talking to an Iridium Wall here. Quote without the bottom part of the code that i showed you there would be absolutely no command executed.Irrelevant. Quote I'm not saying that your encryption isn't encryption but im saying that my file contains polymorphic code, you can say thats it not encryption but you cant say that it's not polymorphism. by definition polymorphism is encryption.I literally explained what polymorphic code is. I'm not sure why, mind you, since you had already ignored a number of other proper definitions for the terms you've used, and continued to use them incorrectly. Quote You are saying that it is not encryption because when echo is set to on the code can be seenI never said that. It's a substitution cipher. There is no algorithm being executed. Obfuscation is not encryption. Quote but they aren't seen until they are decripted. if the code is not encrypted then why if i remove the decryption part of the script absolutely nothing happends?There is no "decryption". environment variable substitution is not "decryption" because there is no algorithm involved. It's a substitution cipher. Quote your explanation was saying that the code was not encryption because had absolutely no encoded script nor a decryption technique. But the code has both the encoded text and the requirements to decode the text.I've explained nearly half a dozen times why. I can't be bothered to explain it again, since you've simplied ignored it each time anyway. Quote For the millionth time i understand that a key and the plain text goes into an encryption algorithm which creates another key with ciphered text. I understand that that ciphered text is then sent into a decryption algorithm which is used to turn the ciphered text into a decryption algorithm. I understand That all my code is doing is substituting it's defined meanings.Great, so you understand why it's not encryption. Glad we agree. Quote even if my definition doesn't comply with your deffinition, i told you that i was only intending to keep a regular non programming experienced user from open it and see it.the issue is not that your definition does not agree with my definition. The issue is that your definition is wrong. Once again...i've been patient... But i've seen enough. Topic Closed. |
|
| 5764. |
Solve : how to run automaticaly multiple syntax using cmd.exe? |
|
Answer» how to run this? one by one |
|
| 5765. |
Solve : need a script to run automaticaly a tool?? |
|
Answer» I USE ncrack and i use some pass LISTS , 20 mb , i want to split the list in 20 peaces , 1 mb each.I start ncrack with first 1mbPASS.TXT after some hours is finishing, then i must CHANGE 1mbPass.txt file to 2mbPass.txt and start again.Anyone knows a script or something to start the second pass list automatically ? hehe |
|
| 5766. |
Solve : create simple virus using batch file? |
|
Answer» i need to know how i can create a batch file atoexecute thing that, when opened from an email attatchment, will send itself to the hard drive and overite the autoexecute file that boots up the computer.I bet you will get a lot of info on this forum!!!!alrite first when you ask for a virus u probably will get yelled at and threaten to get kicked of this form and stuff like like so try and word it diffrent next time if you want the slightest chance of getting help, i need to know how i can create a batch file atoexecute thing that, when opened from an email attatchment, will send itself to the hard drive and overite the autoexecute file that boots up the computer. I hear crickets chirping! Did you get a response? Why would you want such a thing? And no I do not want you on my "buddy list" !email me [emailprotected] You can also ask the forum other things like: How can I cheat on my Tax? Is there an easy way to rob a bank? Can I make street drugs from toothpaste? ** What is the best way to hot wire a police car? Go ahead, ask anything. ** from Google Books.Zask replied to a post that's over 10 years old. |
|
| 5767. |
Solve : A problem with Environment Variables? |
|
Answer» In my Environment Variable (on my Windows 8.1, x64 PC), I have set up - |
|
| 5768. |
Solve : Batch file to make folders with part of file name and then copy files? |
|
Answer» I am a designer. I need to move files that are all present in one folder to folders that are of the file names. The files are of two formats, .PSD and .jpg. I need a batch file that will read the file name, make a folder of part of that file name and move all files that start with that file name into that folder regardless the extension. :: Needed because you are working with variables that are immediately called erobby, a good effort. I would just add a bit more about delayed expansion. We need to enable delayed expansion because of the behaviour of variables which are both set and expanded inside a loop or other structure with brackets such as IF blocks - consider this code setlocal enabledelayedexpansion if %foo%==%bar% ( set var=YES echo Var is !var! ) If you used %var% then if it did not exist before the IF block or loop then nothing would get echoed (the variable would be empty); if it did exist you would get the previous value befor the script got to the bracket structure. For this reason we enable delayed expansion and use EXCLAMATION marks instead of percent symbols. This is because cmd.exe expands all normal percent variables before running and variables inside loops are created and changed at run time. This is something that changed from MS-DOS. This brings me to what some may feel is a minor point (I have had arguments about this!) namely using double colons to start a comment line. This was OK in MS-DOS under command.com but it has the potential to break Windows NT family scripts running under cmd.exe. It is unofficial and unsupported. The comment line starter is REM (case-insensitive). The reason I don't like double colons is that a double colon is really just a broken label and you can't have them inside a loop. A loop or other bracket structure is really just one line to to the commmand interpreter and any label will break that. (The script will crash) Hello I have the same problem as the Topic Starter and Salmons solution is nearly perfect for me, except for one thing. Some of my file names contain exclamation marks and these file can't be moved by the script. I think the problem is "setlocal enabledelayedexpansion" but I'm new to batch scripting so I hope someone can help me solve this problem. Thanks.I didn't evaluate this at all - and it's untested. I merely simplified the code as I read it. Code: [Select]@echo off for %%A in (*.psd *.jpg) do ( for /f "tokens=1* delims=_" %%D in ("%%~nA") do ( md "%%D" 2>nul echo Moving file %%A to folder %%D move "%%A" "%%D" >nul )) echo Finished pause |
|
| 5769. |
Solve : install a TCP IP printer via batch file using cscript? |
|
Answer» I am trying to figure out how to install this printer via tcp ip. I looks like the .inf file is the trouble. I know nobody outside my environment can run this CODE but if you have had this error and solved it, What did you do? I have been working on this script for a few days now. |
|
| 5770. |
Solve : batch file to disable the date and time option? |
|
Answer» :'(batch file to DISABLED change OPTION for DATE and time the os is WINDOWS 7 64bitYou already asked this. |
|
| 5771. |
Solve : Password protected folder? |
|
Answer» Quote from: camerongray on January 26, 2016, 06:57:19 PM I just thought that rather than giving you a low rating it would be more useful if I were to explain how you could improve it. I have trouble understanding what your saying, I barely speak English, could you elaborate this please? "you get on? No harm in trying it! You clearly have potential but Batch makes it really hard to exploit it! Come think of it, when I was younger I remember playing about with batch files and thinking they were really cool but it wasn't until I moved on to Visual Basic (not that I'd use VB nowadays!) that I realized what programming was all about and when I was able to start building much cooler stuff!" I mean i can make out most of it but it still is confusing to me. Also i do program python, and I think it's a very lovely and easy/powerful language, the only problem is when I try to use things like pywin32 or other addons, they never work correctly on my computer thus limiting my abilities to progress more. The reason i try to push batch is mainly because i favorite it for some reason. Maybe because the old school programming days fascinated me for some reason. I'm going to look up your very link soon because it sounds very interesting. Quote from: camerongray on January 26, 2016, 11:05:17 AM I'm going to spend a fair bit of time here writing an explanation so I'd appreciate it if you read it in full. I read that and it was IMMEDIATELY clear that you're a helpful person, with a good grasp of social respect - I also knew immediately that it was wasted effort.Instead of batch, Zack should use his ability with Visual Basic. By using Visual Basic you can make programs that are very good and fast. Quote from: Geek-9pm on January 27, 2016, 10:26:20 AM Instead of batch, Zack should use his ability with Visual Basic. By using Visual Basic you can make programs that are very good and fast. okay, im gonna do that then. |
|
| 5772. |
Solve : Need to Parameterise Batch File? |
|
Answer» Hi I have created a batch file. And using some parameters in batch file I am Reading parameter value from my notepad file. |
|
| 5773. |
Solve : Insert the content of a text file to another text file after the pattern(batch)? |
|
Answer» Hi everyone! Instead of using this I have posted another question maybe you could check it. Thanks!Foxidrive's question is still valid on your new question. You should not have started another topic.Quote from: Squashman on January 28, 2016, 11:50:06 AM Foxidrive's question is still valid on your new question. You should not have started another topic. Sorry i thought it was different.Perhaps this is the end of this thread. Here is what I wanted to say. DOS batch can be used for search and insert in a text file. But it is not the best choice. Others tools work better and are easy to use. Is this for use by just one administrator? Is this SOMETHING that would be done on a daily basis? A batch file is sometimes needed for a number of users who do not have other tools available. Is that the case here? Batch can be used with other tools Such as VBScript and Powershell. Also, some programmers even import tools used in Unix or Linux. Such as sed and grep. from CH search: About grep grep, which stands for "global regular expression print," processes text line by line and prints any lines which match a specified pattern. About sed sed, short for "stream editor", allows you to filter and TRANSFORM text Also SEE: http://stackoverflow.com/questions/1169927/using-sed-and-grep-to-search-and-replace There are VERSIONS of sed and grep[ that work in the windows command line. Just trying to help. |
|
| 5774. |
Solve : compair files and copy them? |
|
Answer» I have three folders inside the folders the files have the same NAMES except for the file structure: I have three folders inside the folders the files have the same names except for the file structure:I'm a little uncertain of the task with the confusing MENTIONS of folders and files. If you show us a listing made with the dir /b /s command then it should be clearer. |
|
| 5775. |
Solve : Insert filename into files in batch? |
|
Answer» I have numerous .vrt files with a pattern in the file name from a directory: |
|
| 5776. |
Solve : Create folder copies of files with added text at the end.? |
|
Answer» I want a batch file to take all of the files in a folder by dragging it into a command prompt, and then in that folder the batch file creates folder copies of all the file names in the folder that was dragged into the command prompt, but these new folders would have added "(detailed)" to it. To my knowledge, one does not drag and drop files into a command prompt.I have been doing drag and drop batch files for a very long time.Quote from: Squashman on February 01, 2016, 12:46:24 PM Where did all the PamChrSkin_* files come from? That is only a sample on about 1/8 of the files that were extracted from the shader_debug_add.ar.02 and they were placed/saved in the manually created folder shader_debug_add.ar.02 (detailed) But I think you can see why I want a program to create all of these folders because manually creating them (I'm sorry if I have said this a lot) is very tedious and time consuming. Think that you will be able to help?What program are you using to extract the files and what is the syntax to use the program?So are you cracking games and APPS then ? ?Quote from: Squashman on February 01, 2016, 02:22:39 PM What program are you using to extract the files and what is the syntax to use the program?I am use many different programs for many different games and programs when I extract files from them, since there are so many I won't list them. For wat I am looking for the batch file doesn't need to interact with the program that is extracting files, it just NEEDS to create folder copies of all the files from the selected folder and their names into respective new folders with the added " (detailed)" added at the end of the folder names. Once the program does that it is simple to just use my extracting program and extract the files into the newly created folder. [But like I said it may seem simple at first, but I have to do this with so many files, that to create folders for each one, is very time consuming] Quote from: patio on February 01, 2016, 02:35:53 PM So are you cracking games and apps then ? ?Yes, I upload things to "themodelsresource" & "thesoundsresource" & "thespritesresource" & "thetexturesresource" at "theVGresource" WEBSITE. I am able to delve into the games files and code and extract things for others there, but it also provides me the opportunity to learn how all of the games work and function and how to possibly create mods for them if none exist presently. I also do this for programs, but at the moment I am focused on games.Topic Closed.Apparently this lock didn't take the 1st 2 times... Offhand replies removed. Now it's closed. patio. |
|
| 5777. |
Solve : Authentication problem net user/psexec? |
|
Answer» Question. All that did was echo the command onto the command line That's precisely the point of it. pspassword was printing the message because there was an error in the command line, and we can't see the command line or the message that was printed to the console - so you have to figure it out by examining everything. If it's a permissions issue: then if you right click the code you had originally and select run as administrator then it should work as it is. This is another debugging step.Quote from: foxidrive on February 03, 2016, 11:40:14 PM That's precisely the point of it. Alright thanks, ill try each step and see where its faulty. thank you sir,Oops. [deleted] So here is what i got so far, I have tried taking out the -u and -p switches, and just running it on a administrator profile(which i was originally). i am testing on two machines; one is joined to DOMAIN and one is not. the one that is not, it changes the password and i can use that password to log into the local admin just fine. the one that is joined to domain the script will change the password and exit with error code 0, BUT when i try to login with the new password it doesnt work and the old one doesnt work either.. does that make sense? LOL Code: [Select]@echo off setlocal enabledelayedexpansion for /f %%F in (C:\PCLIST.txt) do ( pstools\psexec.exe \\%%F net user Administrator NewPassword123! if !errorlevel! NEQ 0 echo %%F >> Failed.log ) echo complete pause any ideas? thanks. PS. no im not using pspasswd its the worst creation since trump k thx. Then you don't have elevated privelidges for the domain...just the ones who aren't. And i don't even do batch...so i'll leave it to the experts we have.Quote from: patio on February 04, 2016, 12:13:30 PM Then you don't have elevated privelidges for the domain...just the ones who aren't. im running the bat as local admin account to change the local admin password. im not sure what you mean by that; so if i run the batch script as domain admin then it will use the domain admin CREDENTIALS to connect to the machine but will it change the domain password? i dont want that...I'm simply stating you may need domain credentials to make any changes to PC's in the domain...simple as that. As i said i'm no batch expert i'll leave that to others...so i can't speak to what level changes your bat would make.Quote from: patio on February 04, 2016, 12:57:06 PM I'm simply stating you may need domain credentials to make any changes to PC's in the domain...simple as that.I would tend to agree with that.Quote from: Arotin on February 04, 2016, 12:08:01 PM Code: [Select]@echo offDid you really try to use an exclamation in the password with delayed expansion enabled? Pretty sure you could have just kept delayed expansion off and did this instead. Code: [Select]if errorlevel 1 echo %%F >> Failed.logQuote from: Squashman on February 04, 2016, 01:52:33 PM Did you really try to use an exclamation in the password with delayed expansion enabled? okay so should i take off delayed expansion and try running the batch with domian admin credentials? but as long as i do not specify the domain in the script then it wont modify the domain account correct? i only want to change the local admin password. and as far as the errorcode, why is mine incorrect lol. there could be more error codes besides "1" . Quote okay so should i take off delayed expansion and try running the batch with domian admin credentials? but as long as i do not specify the domain in the script then it wont modify the domain account correct? i only want to change the local admin password. This is why you need to have a test PC...select 1 in the domain to test the code...but i'd fix the GLITCHES 1st...Quote from: patio on February 04, 2016, 02:07:17 PM This is why you need to have a test PC...select 1 in the domain to test the code...but i'd fix the glitches 1st... i have 3 test PCs. 2 are the ones receiving and one is for running the bat file, yeah im going to make some changes and report back with results. thanks. |
|
| 5778. |
Solve : Set a multiline variable in batch? |
|
Answer» On last time. Don't put multiple;e lines into a variable. On last time. Don't put multiple;e lines into a variable. Well im not the one who asked for this, and i didn't really put multiple lines in a variable, just called the "echo." command and turned it into a variable. and added after some regular code, just trying to help. im not a big fan of the whole multi lined variable thing myself. kinda is nonsense really. im sure in some very rare case it could be useful but still it's not like it's the most biggest breakthrough in computer programming ever, and even it did have a purpose, what are the odds and why would it even be that important? multi lined variables are for people who are to lazy to either copy and paste the code or edit it them self's. so i'm with you on this one. almost 5 pages too, patio, i think your a wizard. Quote from: Geek-9pm on February 02, 2016, 10:55:27 PM On last time. Don't put multiple;e lines into a variable.Wait, what? I'm not a batch developer but I know that in literally any language I've seen it's totally normal to have multiple lines in a variable, all a new line is is a special character. Your forum post has multiple lines in it and I'd hazard a guess that at some point in the rendering of this page the body of your post is loaded into a single variable in the backend of this forum. Quote from: zask on February 02, 2016, 10:59:39 PM multi lined variables are for people who are to lazy to either copy and paste the code or edit it them self's. so i'm with you on this one.They are for people who need to handle strings that contain multiple lines. In the initial question for example they wanted to replace a single line in the input with multiple lines, this is totally standard practice in many programs. Being lazy doesn't COME into it at all, besides, in fact, copying and pasting code is generally seen as the lazy way to do things - https://en.wikipedia.org/wiki/Copy_and_paste_programmingCode: [Select]@echo off set "src=C:\path\to\source\files" set "dst=C:\path\to\destination\files" pushd "%src%" for /f "delims=" %%a in ('dir /b /a-d "*.vrt" ') do ( echo Processing "%%a" set "stop=" ( for /f "usebackq delims=" %%b in ("%%a") do ( echo(%%b if not defined stop type "file2.vrt" & echo( set stop=are-we-there-yet? ) )>"%dst%\%%a.tmp" move /y "%dst%\%%a.tmp" "%dst%\%%a" >nul ) echo done pause A file should now be created for each VRT file. The redirection to the file was at the wrong level of parentheses and the move command is necessary again. Test it on sample files first.Quote from: camerongray on February 03, 2016, 03:46:50 AM Wait, what? I'm not a batch developer but I know that in literally any language I've seen it's totally normal to have multiple lines in a variable It's not normal in batch scripts though. Quote from: foxidrive on February 03, 2016, 04:33:39 AM It's not normal in batch scripts though.Right. Here is the fundamental way the command interpreter works: command p1 p2 p3 ... Batch script is for a shell tool, console e utility. One line is a full expression. INTERACTIVE work from the a console would not not normally expect multiple Lines. Also, spaces are the DEFAULT delimiter. A batch file is not a word processor, not a database or a universal toolkit. And yes, one could brush his teeth with hand soap. But why would he? I am outhitting the THREAD. Really. I am rolling my eyes. Quote from: camerongray on February 03, 2016, 03:46:50 AM Wait, what? I'm not a batch developer but I know that in literally any language I've seen it's totally normal to have multiple lines in a variable, all a new line is is a special character. Your forum post has multiple lines in it and I'd hazard a guess that at some point in the rendering of this page the body of your post is loaded into a single variable in the backend of this forum. Yeah, but i think it's different in batch, mainly because it was never really intended for multi lined variables, when i was talking about copy and pasting the code i was referring to pasting a code that he had already made into another file and edit it himself, instead of putting in a variable. Yeah there is a lot of languages that can do it, but it's not a good practice in batch, and there are a lot of reasons why its not such a good idea. One good reason why is the example that Geek-9pm posted above, luckily the method i posted doesn't actually create a multi lined, but mimics it's technique with single lines instead. But still, in batch i hardly find a point for this . it does nothing but make your code even more difficult to comprehend / more difficult add edits for later use / and just plane up wastes bites in your file. if you wanted to use the command for later use just copy and paste it again, what ever you wanted to change in the text, just change it with regular variables. If you needed to completely store multiple lines of code, just send it to a file and call it inside the batch file. Notice now Geek-9pm states that "it's like brushing your teeth with soap"...? It is possible but there just isn't any point because it makes things more difficult. now more powerful languages like C++ is fine, but batch can only go so far.Quote from: foxidrive on February 03, 2016, 04:26:22 AM Code: [Select]@echo off Thanks! |
|
| 5779. |
Solve : Copy the filename of a file and replace the strings inside the same file-batch? |
|
Answer» I have a folder with numerous files wherein I want to copy the file name of the file and want to replace strings inside that same file with the file name copied but the last 4 character should be changed. *This isn't the same with the previous post. What do you mean terrible? I've provided a post with complete detail Complete detail is when the line says "My name is Peter" and you provide information that says SOMETHING like "My name is xxxxx" instead of "abc 1111 data" The reason why that is so important, is that Batch file code often changes when the data/text changes. The code I provided above just shows how you can separate the filename tokens - it was quick to post.Is this like the 4th thread started on this same topic?Quote from: Squashman on February 08, 2016, 10:47:35 AM Is this like the 4th thread started on this same topic?Sorry but it's not the same with the previous topic. Previous topic was to insert a file inside another file. This is copying the filename and then inside that same file you'll have to search and replace a string using the filename you copied and just change the last part.Quote from: _unknown_ on February 08, 2016, 07:21:25 AM I can do the "replace" thing for every newDATA_main.vrt using this code: |
|
| 5780. |
Solve : if is not recognised as internal or external command operable program or batch? |
|
Answer» Hi Guys, |
|
| 5781. |
Solve : strange character in vbs? |
|
Answer» I found some vbs code online that had a character that appears invisible in browsers but still can be copied, it only appears in text editors like NOTEPAD. however I have tried this on windows 7 and it doesn't appear in the correct format. it appears on my windows 10, but when using the this strange character in windows 7 with things variables it prevents the code from working and proceeds to an error. Have you tried viewing the file in a hex editor/viewer?Yep. Look at the hex code and then look at an ASCII Chart. It will tell you exactly what it is. You could really cheat and paste it into Notepad++. It will tell you immediately what that character is.The upper set of ASCII characters is not universal. In fact, you have to have a code page for looking at the full SAC II set. These links may help. https://en.wikipedia.org/wiki/Windows_code_page Quote Problems arising from the use of code pagesOfte152 is used in Windows. https://en.wikipedia.org/wiki/Windows-1252 Some third-party programs use their own character set. thank you this helped very much How do i put the hex in the editor? Quote from: Squashman on February 12, 2016, 01:30:42 PM Look at the hex code and then look at an ASCII Chart. It will tell you exactly what it is. You could really cheat and paste it into Notepad++. It will tell you immediately what that character is. Follow Squashman's advice and read the essentials about ASCII - it's a set of numbers which characters can be recognised by. This hex editor is one I've used in the past - easy to install. XVI http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm |
|
| 5782. |
Solve : how to create and run a batch file in visual basic? |
|
Answer» hello, i need a detailed explanation on how to make batch file in visual basic with visual STUDIO, using simple commands like this If information is static its simple just use write to file appended method but have it write to a file with .bat file extension. Not homework, i just need the basic command to send the text out to the batch file. thank you these links are very helpful. very appreciated! No problem... VB is not my strength but I have worked with it, mostly with VB6 back in the day. C++, C#, Python, and Perl are my choice these days depending on what I am making or altering. If you have any other questions feel free to post here. What pushed me away from Visual Basic was that its for Windows only pretty much unless code is ported somehow. C++ and Python are my choices for cross platform programming. http://www.theregister.co.uk/2007/02/21/visual_basic_mono_linux/Quote from: DaveLembke on February 13, 2016, 10:33:32 AM No problem... VB is not my strength but I have worked with it, mostly with VB6 back in the day. C++, C#, Python, and Perl are my choice these days depending on what I am making or altering. If you have any other questions feel free to post here. Yeah i HEARD C# & C++ was better but i just use visual basic because i was told it was more beginner friendly |
|
| 5783. |
Solve : its always the simple things I have trouble with...? |
|
Answer» To my way of thinking, this should place the contents of a file into an environment variable: To my way of thinking, this should place the contents of a file into an environment variable:Does the text files have multiple lines? The SET /P redirection only puts the FIRST line of the file into a variable.its always the simple things I have TROUBLE with... I smiled, coz you apparently have trouble thinking of a descriptive THREAD title too. file to an environment variable might have been a little better. |
|
| 5784. |
Solve : enter username and password? |
|
Answer» I want to know how to login in to ROUTER using a batch file Telnet Scripting Tool v.1.0Could you please provide.......Quote from: arun on February 15, 2016, 02:48:56 AM Could you please provide....... Could you see a copy on Google?http://lmgtfy.com/?q=Telnet+Scripting+Tool+v.1.0May as well FLY over there and install it and test it for him... |
|
| 5785. |
Solve : Batch command for Deleting folder? |
|
Answer» PLZ help me with command to DELETE folder with bat command that is INSIDE C:Program files The folder name is UNITY is its path is "C:\Program Files\Unity" I have ALREADY tried the following command but its not working............ rd /s /q "C:\Program Files\Unity"Because you need to execute that command in that directory with elevated privileges. Meaning you have to right click CMD.exe and chose Run as Administrator.Thanks |
|
| 5786. |
Solve : Drag a vbs file from one directory and drop in on top another vbs file with .bat? |
|
Answer» Okay i have a batch file that creates a VBS file named "obfuscator.vbs". "obfuscator.vbs" obfuscates other vbs files that you name in a directory that you name with help from the batch file. these names are stored in the variables %PATH% and %FILE%. all i need to do is just pass in the vbs filename "message.vbs" to the script "obfuscator.vbs" as an argument from command line. how do i do this? for example you select a directory that has the vbs file name "message.vbs". it's code displays this. note that all the code below contains 0 errors. |
|
| 5787. |
Solve : One random letter variable? |
|
Answer» How to I make a variable that displays a single random letter a-z. @echo off Okay this is helpful but is there a way a can change this to make a random 26 character alphabet variable? Randomized alphabet string 26 chars long, (no repeats) Code: [Select]@echo off REM 65 for upper case, 97 for lower case set CaseType=97 > Randalphabet.vbs echo randomize timer >> Randalphabet.vbs echo RandAlphabet="" >> Randalphabet.vbs echo Do >> Randalphabet.vbs echo randchar = Chr(Int(26*Rnd+%CaseType%)) >> Randalphabet.vbs echo If Instr(RandAlphabet, randchar) = 0 Then RandAlphabet = RandAlphabet ^& randchar >> Randalphabet.vbs echo if len(RandAlphabet) = 26 Then exit Do >> Randalphabet.vbs echo Loop >> Randalphabet.vbs echo wscript.echo RandAlphabet REM ----------------------------------------------- REM Here you use it for /f "delims=" %%A in ('cscript //nologo Randalphabet.vbs') do set Randalphabet=%%A echo %Randalphabet% Examples Code: [Select]cjdmtelkufvywozsnbghxairqp pojqhbyftgweviadlxzrsncumk ayoublqmvzdhfkxpiwcngsterj Quote from: Salmon Trout on April 17, 2016, 01:27:48 AM Randomized alphabet string 26 chars long, (no repeats) thank you this is exactly what i need Have you noticed what happens if you delete or comment out the randomize timer line in the vbs? Quote from: Salmon Trout on April 17, 2016, 12:53:27 PM Have you noticed what happens if you delete or comment out the randomize timer line in the vbs? the only thing that i realized is that it goes to an error on second run due to the ">" sign not being a ">>", what exactly is happening? Quote from: zask on April 22, 2016, 12:37:23 PM the only thing that i realized is that it goes to an error on second run due to the ">" sign not being a ">>", what exactly is happening?Comment out the VBS line being written like this (that's a single quote just before the randomize keyword) (etc) > Randalphabet.vbs echo 'randomize timer (etc) Quote from: Salmon Trout on April 22, 2016, 12:43:01 PM Comment out the VBS line being written like this (that's a single quote just before the randomize keyword) Oh okay i see now, thats a really cool trick . Now i came up with this using some of the code that was provided by you guys and some old code i had LAYING around. this code is supposed encrypt a text file full of batch commands, then make a decrypter to take the encrypted text file, decrypt each command, and execute it within the same batch file. Now i am having a problem, each line in the text file is supposed placed in a separate variable to encrypt/decrpyt them one at a time, but if i wanted to use variable in the encrypted text file (For example~ %Variable%, %%V, !Variable!), they wont work correctly. It would appear "%Variable%" rather than what the substitution of what the variable should be set to. for example if i typed something like this in a text file and encrypted it; color 17 echo hello pause everything would work completely fine but if i tried to type something like this; color 17 set a=hello echo %a% pause When the decrypter.bat file would decrypt then execute the commands it would display as this "%a%" instead of "hello" Is there a way to fix this? here is my code so far. @ECHO Off echo encrypt batch file echo. Setlocal EnableDelayedExpansion Set _RNDLength=8 Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 Set _Str=%_Alphanumeric%987654321 :_LenLoop IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop SET _tmp=%_Str:~9,1% SET /A _Len=_Len+_tmp Set _count=0 SET _RndAlphaNum= :_loop Set /a _count+=1 SET _RND=%Random% Set /A _RND=_RND%%%_Len% SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1! If !_count! lss %_RNDLength% goto _loop REM 65 for upper case, 97 for lower case set CaseType=97 > Randalphabet.vbs echo randomize timer >> Randalphabet.vbs echo RandAlphabet="" >> Randalphabet.vbs echo Do >> Randalphabet.vbs echo randchar = Chr(Int(26*Rnd+%CaseType%)) >> Randalphabet.vbs echo If Instr(RandAlphabet, randchar) = 0 Then RandAlphabet = RandAlphabet ^& randchar >> Randalphabet.vbs echo if len(RandAlphabet) = 26 Then exit Do >> Randalphabet.vbs echo Loop >> Randalphabet.vbs echo wscript.echo RandAlphabet for /f "delims=" %%A in ('cscript //nologo Randalphabet.vbs') do set Randalphabet=%%A del Randalphabet.vbs set /A CREATEKEY=%random% %%200 +2 set /P "FILEA= Enter the name of the text file that you wish to encrypt (Example; "Somefile") : " set /P "FILEB= Enter the new name for the text file that you wish to encrypt (Example; "NewFile") : " Setlocal EnableExtensions for /f "delims=" %%A in (%FILEA%.txt) do ( Set /a C+=1 Set X[!C!]=%%A set CHECKPASSWORD=%%A set CHECKKEY=%%B set CHAR=0123456789%Randalphabet% for /l %%C in (10 1 36) do ( for /f %%D in ("!CHAR:~%%C,1!") do ( set /a MATH=%%C*%CREATEKEY% for /f %%E in ("!MATH!") do ( set "CHECKPASSWORD=!CHECKPASSWORD:%%D=-%%E!" ) ) ) echo !CHECKPASSWORD! >> %FILEB%.!_RndAlphaNum! ) Set X echo @ECHO Off >> Decrypt.bat echo. >> Decrypt.bat echo Setlocal EnableExtensions EnableDelayedExpansion >> Decrypt.bat echo for /f "delims=" %%%%A in (%FILEB%.!_RndAlphaNum!) do ( >> Decrypt.bat Setlocal DisableExtensions DisableDelayedExpansion echo Set /a C+=1 >> Decrypt.bat echo Set X[!C!]=%%%%A >> Decrypt.bat echo set CHECKPASSWORD=%%%%A >> Decrypt.bat echo set CHECKKEY=%%%%B >> Decrypt.bat echo set CHAR=0123456789%Randalphabet% >> Decrypt.bat echo. >> Decrypt.bat echo for /l %%%%C in (10 1 36) do ( >> Decrypt.bat echo for /f %%%%D in ("!CHAR:~%%%%C,1!") do ( >> Decrypt.bat echo set /a MATH=%%%%C*%CREATEKEY% >> Decrypt.bat echo for /f %%%%E in ("!MATH!") do ( >> Decrypt.bat echo. >> Decrypt.bat echo set "CHECKPASSWORD=!CHECKPASSWORD:%%%%E=%%%%D!" >> Decrypt.bat echo ) >> Decrypt.bat echo ) >> Decrypt.bat echo ) >> Decrypt.bat echo for /f %%%%F in ("!CHECKPASSWORD!") do ( >> Decrypt.bat echo set "CHECKPASSWORD=!CHECKPASSWORD:-=!" >> Decrypt.bat echo !CHECKPASSWORD! >> Decrypt.bat echo ) >> Decrypt.bat echo ) >> Decrypt.bat echo Set X >> Decrypt.bat I have a working example of some encrypted commands that do work, they shoud help give example of what im trying to do, but you have to download it here. http://www.filedropper.com/batchencrypter_2 It would be nice if Zask could tell us why he wants to do this. If it is just for the fun of doing a task in DOS the hard way, that is OK. But if Zask NEEDS a quick and effective solution to a piratical problem, he might say so. Here is why I ask. He is using a Random generator to make a sequence that is not random. He wants a re-ordered sequence of the Alphabet. It is a table where are letters are present, but not in an obvious order. Such tables do not need the random generator. Such are used in some types of encryption methods. And it can be done in batch, but if anybody finds the code your method is no longer a secret. Quote from: Geek-9pm on April 24, 2016, 10:54:03 PM It would be nice if Zask could tell us why he wants to do this. I understand that, and yes you are correct, i do prefer doing things in dos the hard way, that's just the type of person i am. I don't really care if other people find my code because i just program batch for a hobbie and i do this to learn, when i am not programming in dos i am usually learning other programming language at school, and that's where i usually ask questions on my work. But when I program batch the internet is where i come to learn. There really isn't much reason to why i needed the random alphanumeric code, but one reason is because when "a" is assigned to "1", and "b" to "2", "c" to "3", and so forth. it would be to obvious. I just wanted it assigned to a random alphabet so that "a" could be "5", or "z" could be "12". And also because i wanted the sequence to change each time. It doesn't necessarily make the code anymore harder to decipher but it does give some people with less knowledge less more time to reverse the code (Not much though). But do acknowledge that a lot of the help i get from you guys is very much appreciated. So do you know a way that i can make it possible to get the variables to work? I cant currently get my head wrapped around this. They display what appears textualized, but they don't actually work.Simple number sequnces. https://www.mathsisfun.com/numberpatterns.html This can be one way of making a unusual sequence. But you can also do it by hand and get good results. The idea is a foundation on which to build. You can add complexity to it later. Partial example: (only 8 items to SHOW the idea.) Code: [Select]1 2 3 4 5 6 7 8 < order A B C D E F G H 5 2 7 4 1 6 3 8 < scramble In this group on 8 items are shown. The index is 5. Only two items are m is not scambled. This does not matter, the set is still hard to guess. No,this is not MS-DOS code, but ut shows the value of having some kind on idea or conceptin mind. This modloe does not need the random funtion. But requires aknowledge of number sequences. using this, yu can hand code tables of numbers. What I am sayhing is that you need to do more "top down" thinking before you code. Have some notes and examples of what yu can do by hand and then think about making code for it. Quote from: Geek-9pm on April 25, 2016, 05:49:54 PM Simple number sequnces. |
|
| 5788. |
Solve : I want to write a batch file to play a particular video file? |
|
Answer» I want to write a batch file to PLAY a video file . Suppose I have a video clip in some location in my PC. I want to write a batch file so that when I click on the batch file icon, the required player will open and start automatically Please see the video file is not associated with the player. Then associate it! In Windows explorer, right click the file, choose "open with..." choose "choose PROGRAM", choose "browse", find the program exe file, click OK, then CHECK "Always use the selected program". However, if you can't, or don't want to, start "" "Program" "video file" Code: [Select]start "" "C:\Program Files\FLV Player\flvplayer.exe" "C:\My Videos\abc.flv"Quote from: Dias de verano on March 29, 2009, 12:16:43 PM Then associate it! and what if i want to play this video at a specific time??This thread is 7 years old - make a new one and describe what you need to do. |
|
| 5789. |
Solve : Batch Function Not Copying Properly? |
|
Answer» Code: [Select]REM Capture the date/time(right down to the second) and then assign it to a variable Code: [Select]REM Capture the date/time(right down to the second) and then assign it to a variable Terribly Sorry, but could you elaborate? Are you talking about this line: Code: [Select]Passing T:\Documents "T:\Backup"\"svetlana_backup_23022016_ 91300"\DocumentsI'm talking about these lines. There are elements there that cannot be produced with the code you have shown. There's no point helping anyone with programming when the code they show isn't giving the RESULTS they say it is giving. Code: [Select]Passing T:\Documents "T:\Backup"\"syrena_backup_23022016_ 91300"\Documents Making and Copying T:\Backup"\"syrena_backup_23022016_ 91300"\Documents Directory Making and Copying Directory 0 File(s) copied .From the first post you say it is soaking on your desktop. If so, then it is working. Just you don't like it to work that way. Windows, like other OS can do path names at leat two ways. 1 Absolute path name. 2. Relative path name. Quote An absolute pathname, also referred to as an absolute path or a full path, is the location of a filesystem object (i.e., file, directory or link) relative to the root directo If an absolute name is not given , the default is a relative path name. Quote . The relative pathnames are opposite to absolute pathname. A reative pathname does not begin with a slash ( / ). Generally you specifies location relative to your current working directory. This is most USEFUL to short a path name The above is for Linux. For Windows use the \ instead. I managed to fix it, here is the code if anyone is interested: Code: [Select]@ECHO OFF REM Start Backup TITLE Backup REM Capture the date/time(right down to the second) and then assign it to a variable set yy=%date:~-4% set dd=%date:~-7,2% set mm=%date:~-10,2% set newdate=%dd%%mm%%yy%_%Time:~0,8% set newdate=%newdate::=% SET foldername="syrena_backup_%newdate%" REM Variables SET drive=T: SET sevenZip=%USERPROFILE%\7z.exe REM Source SET documents=%drive%\Documents REM Destination Directory SET destination="%drive%\Backup" SET backupDir=%destination%\%foldername% SET destinationDocuments=%backupDir%\Documents ECHO Welcome %USERNAME% ECHO Please Plug in %drive% Drive and Disconnect the Internet. pause IF EXIST %destination% ( MKDIR %backupDir% call :makedirandcopy "%documents:"=%" "%destinationDocuments:"=%" DIR /S /B %backupDir% > %backupDir%\%foldername%.txt echo Creating Zip file of %backupDir% %sevenZip% a -tzip %backupDir%.zip %backupDir%\* RMDIR /Q /S %destination%\%foldername% pause goto :EOF ) ELSE ( ECHO Error Finding Destination Drive! Aborting pause goto :EOF ) :makedirandcopy ECHO Making %~2 Directory MKDIR "%~2" ECHO Copying %~1 Directory XCOPY "%~1" "%~2" /E /F The goto:EOF was needed, because without it, makedirandcopy would execute without parameters. I also needed to properly quote my variables when passing them to the function. |
|
| 5790. |
Solve : date and time batch? |
|
Answer» please, HELP me about DISABLE change option of date and time by batch fileQuestion is not clear. Do you want to disable (changing date and time) using a batch file, or disable changing date and time (using a batch file)? Also what OS? Question is not clear. Do you want to disable (changing date and time) using a batch file, or disable changing date and time (using a batch file)? Also what OS?I want disable changing date and time using a batch file on windows 7 64bitThe fellow was here and doesn't show much interest in providing INFORMATION, or replying. http://www.dostips.com/forum/viewtopic.php?f=3&t=7102 |
|
| 5791. |
Solve : Need help with my script? |
|
Answer» So, I want to create a script that integrates a lot of commands in my computer into one. The problem is that part of my script, which is for running batch games I made is not working. I am somewhat familiar with batch, so can ANYONE help? (This is the script with the trouble) No need. Found out the correct script 20 minutes after posting.I was pointing out the problems with your original code.Drive-by scripter... |
|
| 5792. |
Solve : Running two bat files ?? |
|
Answer» I have a outlook backup program that backs up all the mail and offers a way to enter a POST Backup CMD |
|
| 5793. |
Solve : How does one create a batch script that will run under unicode format?? |
|
Answer» okay before i explain anything i just want to say that this is not what im talking about. 1. Prepend normal text/batch file with "ÿþ" Thank you, ill keep that in mind. |
|
| 5794. |
Solve : Change variable for each loop? |
|
Answer» Okay im trying to basically display text from a text file inside the batch file using a trick i found on the internet. Google for, or search alt.msdos.batch.nt on (Google Groups) for "call set". Okay thank for the help, but i found a solution, was trying to do something like this. @ECHO Off echo encrypt batch file echo. set /P "FILE= Enter the name of the batch file that you wish to encrypt (Example; "Somefile") : " set /A CREATEKEY=%RANDOM% %%200 +2 Setlocal EnableExtensions EnableDelayedExpansion for /f "delims=" %%A in (%FILE%.txt) do ( Set /a C+=1 Set X[!C!]=%%A set CHECKPASSWORD=%%A set CHECKKEY=%%B set CHAR=0123456789bhfcjrwmudaxopvntzlqeisykg for /l %%C in (10 1 36) do ( for /f %%D in ("!CHAR:~%%C,1!") do ( set /a MATH=%%C*%CREATEKEY% for /f %%E in ("!MATH!") do ( set "CHECKPASSWORD=!CHECKPASSWORD:%%D=-%%E!" ) ) ) echo !CHECKPASSWORD! >> %FILE%.Zask ) Set X Setlocal DisableExtensions DisableDelayedExpansion echo @ECHO Off >> Decrypt.bat echo. >> Decrypt.bat echo Setlocal EnableExtensions EnableDelayedExpansion >> Decrypt.bat echo for /f "delims=" %%%%A in (%FILE%.zask) do ( >> Decrypt.bat echo Set /a C+=1 >> Decrypt.bat echo Set X[!C!]=%%%%A >> Decrypt.bat echo set CHECKPASSWORD=%%%%A >> Decrypt.bat echo set CHECKKEY=%%%%B >> Decrypt.bat echo set CHAR=0123456789bhfcjrwmudaxopvntzlqeisykg >> Decrypt.bat echo. >> Decrypt.bat echo for /l %%%%C in (10 1 36) do ( >> Decrypt.bat echo for /f %%%%D in ("!CHAR:~%%%%C,1!") do ( >> Decrypt.bat echo set /a MATH=%%%%C*%CREATEKEY% >> Decrypt.bat echo for /f %%%%E in ("!MATH!") do ( >> Decrypt.bat echo. >> Decrypt.bat echo set "CHECKPASSWORD=!CHECKPASSWORD:%%%%E=%%%%D!" >> Decrypt.bat echo ) >> Decrypt.bat echo ) >> Decrypt.bat echo ) >> Decrypt.bat echo for /f %%%%F in ("!CHECKPASSWORD!") do ( >> Decrypt.bat echo set "CHECKPASSWORD=!CHECKPASSWORD:-=!" >> Decrypt.bat echo !CHECKPASSWORD! >> Decrypt.bat echo ) >> Decrypt.bat echo ) >> Decrypt.bat echo Set X >> Decrypt.bat Kinda lame just BORED though. |
|
| 5795. |
Solve : CMD Window Closing Before Batch Finishes Operations? |
|
Answer» I have a batch file that is doing a lot of work inside a folder. It is creating files, deleting folders, renaming files and folders, moving files and folders, ETC... It currently performs about 50 different operations. The problem I am having is that the command window closes, as if it were finished, but the operations it has set in motion CONTINUE to happen in WINDOWS Explorer for the next 5 to 10 seconds. I'm never sure when it is done. F:\-- Test Directory\New Folder>wait mkdir CM1Quote from: erobby on April 13, 2016, 01:27:31 PM use wait before the commandThere is no WAIT command. Maybe you meant to say use the START command with the WAIT option.New Problem Alright, so "START /WAIT test.bat" opens a new command window with the command processor run with the /K switch to cmd.exe. But this window is just a new command window. If I have to start test.bat by typing its name in again, the point of an automated process is lost. Questions
I was testing this with a smaller bat file, just trying to make sure I knew what I was doing before I ran the big batch file that exhibits the problematic behavior. Even using the WAIT command, the window exits like normal and Windows Explorer continues to show activity for 5 to 10 seconds afterwards. If I don't use the EXIT command at the end of the batch file, the window stays open forever, which I don't want. I just want it to stick around until all the operations the batch has set in motion have completed. Write operations to a drive are typically cached. Windows determines when to perform the write operations most effectively on it's own. For example, internally, command prompts copy command likely uses the appropriate functions to read and write files. The important consideration is that those functions will typically return to the caller before the operation has completed- that is, if you write some data to disk, the function may return before that data has been written to the disk- instead it will be written the next time Windows decides to flush it's write cache for the drive. You might be able to workaround this by using the /V switch on the copy command, although this will only apply to the copy commandQuote from: BC_Programmer on April 13, 2016, 02:51:36 PM Write operations to a drive are typically cached. Windows determines when to perform the write operations most effectively on it's own. For example, internally, command prompts copy command likely uses the appropriate functions to read and write files. The important consideration is that those functions will typically return to the caller before the operation has completed- that is, if you write some data to disk, the function may return before that data has been written to the disk- instead it will be written the next time Windows decides to flush it's write cache for the drive.This makes perfect sense. In this case then, a TIMEOUT will suffice. Thank you Quote from: Mulsiphix on April 13, 2016, 02:23:29 PM and Windows Explorer continues to show activity for 5 to 10 seconds afterwards Some points I can clarify: 1) Adding the "" after the start command as a matter of course will stop it biting you when the command is double quoted. start "c:\File Utilities\give me money.exe" WOULD fail without a leading "" and just open a cmd window without doing anything. Code: [Select]start "" 2) Adding the /B switch to the start command reuses the same console window. See start /? for extra details. 3) Using the call command works for batch files without using start. Exactly what is happening in your code is in the same realm as knowing next weeks winning Tattslotto numbers, and batch scripts could be what you are using. 3) Windows Explorer is also multi-threaded and will do it's own merry thing in some instances. Quote from: foxidrive on April 13, 2016, 08:32:41 PM BINGO! Why people seem to think we can troubleshoot their code without showing us their code is being any logical reason in my small world.Quote from: foxidrive on April 13, 2016, 08:32:41 PM 1) Adding the "" after the start command as a matter of course will stop it biting you when the command is double quoted.I figured this one out after I posted. I swear, some of the things that slip by . Quote from: foxidrive on April 13, 2016, 08:32:41 PM 2) Adding the /B switch to the start command reuses the same console window.I didn't know about either of these. Thank you Quote from: Squashman on April 13, 2016, 08:51:17 PM BINGO!Point made! I'll remember this for the future |
|
| 5796. |
Solve : REN reports duplicate or file not found. But that isn't true.? |
|
Answer» I have tried to delete the FOLDER in question and recreate it. I have tried manually renaming it. For whatever reason, I cannot rename it using the command line. Any ideas? I cannot rename a folder to con. Turns out it is a Windows reserved name. One of a handful that cannot be used . SORRY about the double post. I thought I was editing the above post Quote from: Mulsiphix on April 13, 2016, 04:29:59 PM Turns out it is a Windows reserved name. Yeah, an appropriate error MESSAGE would be a useful THING from Windows. |
|
| 5797. |
Solve : MAJOR PROBLEM WITH MY WONDERFUL OLD DOS PROGRAMS? |
|
Answer» I have had to reinstall Money Manager Business Edition version 4. The original installation disk is a floppy and needs me to operate my Windows 98 computer in ms.dos mode. The installation is very quick, and needs only A:INSTALL to be type after the C prompt. That C prompt shows as follows:- and have to force the DOS to close Makes it sound like you are running it within Windows from a DOS Window, where it could also merely hang.Thanks for all the advice. I am afraid I had been uwittingley leading you, as well as myself, "up the garden path". A bit more work enables me to define the situation as follows:- 1. Original installaton disk works fine, but possibility of running the program from the C prompt is extremely unreliable. Very occasionally it will start if the directory is change to C:\MONEY\ and the name of the program (money) typed in after the back slash. Normally, however the DOSCONTINUED FROM PREVIOUS ATTEMPT, WHICH WAS GRABBED OFF ME AND POSTED WHEN HARDLY STARTED! 1. Program installs fine, but hardly ever Not never) runs from the string attached to the C prompt as per program's instruction. 2. I remembered that the installation places the program files on a hard disk, if the computer has one (the program dates for 1987, and was a development of an even oldercontinued again! PCW program. 3. The program comments referred to state that one of the files copied onto the local hard disk is MONEY.EXE. I viewed the contents of the MONEY folder in MY COMPUTER>DRIVE C of my 1999 W.98 machine. I found this file under the program icon and created a shortcut for the desktop. This was how things were before the mighty accident. 4. The shortcut works fine. The original data files load and run. 5. The only problem is that the program crashes and has to be....RE-INSTALLED via the DOS prompt. The printer settings within the program are the same as previously and the printer is the same one. However, I cannot print! Whilst not perhaps 100% vital to be able to do so from a personal money management program, print-outs are sometimes extremely useful. So I am very bothered by both this fault and by the mayhem which is UNLEASHED if I do try to print. Any ideas, please?!I've solved the crashing problem. A bit of lateral thinking when looking for something QUITE different me look at the default settings in the short-cut. It would seem that this was being triggered to close the program when I tried to print (using the keystroke which is the only way of printing in this program). Then altering the default spooling settings allowed the printer to work normally, instead of taking for ever to produce one blank sheet and then take so long to produce a printed sheet that it exceeded its (long) timeout setting and switched off.As it's a dos program, then a strategy is to install it under dos and then back it up. When it fails in some way you can restore the files, and put your configuration files into the fresh copy. Backup your configuration files regularly, and when they change. JFTR The web site says this about V6 "nor will they operate under a Windows 7 64-bit environment" |
|
| 5798. |
Solve : Finding the Area of a Circle? |
|
Answer» Quote from: Salmon Trout on February 24, 2016, 01:50:06 PM You could even put it somewhere on your PATH, set the default vbscript engine to Cscript, and call it by name:And, of course, if you haven't already done so, set the default Cscript logo option to NOLOGO. Python oneliner similar to eval.vbs: Code: [Select]import sys; from math import *; print eval(sys.argv[1]) Use decimal point to avoid int results from integer values in Python 2.xx e.g. 3/2.0 (I believe Python 3 defaults to float?) Examples C:\>eval.py 5/3 1 C:\>eval.py 5/3.0 1.66666666667 C:\>eval.py sqrt(3) 1.73205080757 C:\>eval.py pi 3.14159265359 C:\>eval.py e 2.71828182846 Quote from: DaveLembke on February 21, 2016, 12:39:43 PM Scaling it down is one way to do this, but you will lose precision. Same as the 3.14 turning into 314 where you only have precision to 3.14xxxxxxxxxxx-> and no other digits to infinity. okay good to know, could i maybe borrow one of your C++ examples?Quote from: Salmon Trout on February 24, 2016, 01:50:06 PM You don't have to delete it if you don't want to. It's only 45 bytes. (About 7 years ago I thought I had independently invented this!) wow thats a very helpful peace of code, thank you. |
|
| 5799. |
Solve : Trouble With A Recursive Rename Batch File? |
|
Answer» I have a ton of files with names that end in *.crop.jpg and I would like to change crop to full. I have done a lot of searching and I read the Microsoft TechNet articles for REN and FOR, but I just can't get it. Is what I am trying to do impossible inside a batch file? When you say "recursive" do you mean you want to operate on every file in a folder, and every file in every subfolder under that folder? Yes Try this Put it in the top folder and if it shows the right renames change this line: echo REN "!oldname!" "!newname!" to this: REN "!oldname!" "!newname!" Perhaps best to try it on some TEST files before you let it loose on your real data (if you are sensible you make backups!) Code: [Select]@echo off setlocal enabledelayedexpansion for /f %%A in ('dir /s /b *.full.jpg') do ( set folder=%%~dpA set filename=%%~nA set oldname=!folder!%%~nA.jpg set newname=!filename:~0,-5!.crop.jpg echo REN "!oldname!" "!newname!" ) echo Finished Pause Example output Code: [Select]C:\Batch\Test>test.bat REN "C:\Batch\Test\apicture.full.jpg" "apicture.crop.jpg" REN "C:\Batch\Test\sub1\testpicture.full.jpg" "testpicture.crop.jpg" REN "C:\Batch\Test\sub1\sub2\anotherpicture.full.jpg" "anotherpicture.crop.jpg" Finished Press any key to continue . . . Quote from: Error Returned File Not Found This looks awesome. I had no idea you could write scripts like this for the Command Line. Sadly, it isn't working yet. I have a test directory structure set up like this:
Files = BlueInterchange crop and full in my scriptAlso posted here. http://www.dostips.com/forum/viewtopic.php?f=3&t=7066Quote from: Squashman on April 07, 2016, 09:45:46 AM Also posted here.I received a workable solution at this link the other day. Then I CHECKED my email, saw this response, and it seemed impossible. My understanding of the command line is that you can do single line commands. This one is written more like code form a programming language. I was extremely intrigued and wanted to understand how this worked. When it didn't work I decided to follow up with it rather than announce I no longer needed it. I apologize if my actions have upset anyone . Quote from: Salmon Trout on April 07, 2016, 12:48:49 AM Interchange crop and full in my scriptWhile the script runs all the way through, none of the actual file names are changed . This is the output: I used a common testing safeguard, namely to preface the rename command with 'echo' so that you can first verify the renames are correct. I showed you how to deal with this, when I previously posted this above: Quote if it shows the right renamesQuote from: Mulsiphix on April 07, 2016, 12:15:07 PM My understanding of the command line is that you can do single line commands. This one is written more like code form a programming language.At the command prompt you can only enter single line commands but you can combine them in a 'batch script'. The language is called Windows command language, or Windows batch language. You can find numerous reference guides to the syntax online. Quote from: Salmon Trout on April 07, 2016, 12:38:19 PM I used a common testing safeguard, namely to preface the rename command with 'echo' so that you can first verify the renames are correct. I showed you how to deal with this, when I previously posted this above:I mean none of the actual file names on the hard drive are changed. The batch still isn't affecting the files. I made the change you requested previously. Just to be certain, this is what I'm running: Code: [Select]@echo off setlocal enabledelayedexpansion for /f %%A in ('dir /s /b *.crop.jpg') do ( set folder=%%~dpA set filename=%%~nA set oldname=!folder!%%~nA.jpg set newname=!filename:~0,-5!.full.jpg echo REN "!oldname!" "!newname!" ) echo Finished Pause Quote from: Salmon Trout on April 07, 2016, 12:43:14 PM At the command prompt you can only enter single line commands but you can combine them in a 'batch script'. The language is called Windows command language, or Windows batch language. You can find numerous reference guides to the syntax online.That is awesome. I had no idea. Considering it's utility, I'm definitely going to make an effort. I recently took the time to really try and learn AutoHotKey. It has changed my life, but there are some things (like recursive renaming) that are overly complicated without a higher degree of programming knowledge and prowess. So this is welcome news. Thank you for cluing me in Quote Just to be certain, this is what I'm running: Can you see the big red echo? You need to delete this, as I said above (twice). @echo off setlocal enabledelayedexpansion for /f %%A in ('dir /s /b *.crop.jpg') do ( set folder=%%~dpA set filename=%%~nA set oldname=!folder!%%~nA.jpg set newname=!filename:~0,-5!.full.jpg echo REN "!oldname!" "!newname!" ) echo Finished PauseEgg on my face . I thought your reference to echo was explaining the output I saw in the CMD window. I had no idea it was actually interfering with the OPERATION of the batch. I have made the change and the script is now returning errors. Code: [Select]@echo off setlocal enabledelayedexpansion for /f %%A in ('dir /s /b *.crop.jpg') do ( set folder=%%~dpA set filename=%%~nA set oldname=!folder!%%~nA.jpg set newname=!filename:~0,-5!.full.jpg REN "!oldname!" "!newname!" ) echo Finished Pause I'm messing with the script and I'm getting now here simply fiddling with various parts of it. So I used some echo's and figured out the variables aren't holding the correct information. No clue how to fix that, but its a start. If you'd like to just pass on this, given I have a workable solution and I very well may just be aggravating you at this point, I completely understand. Thank you so MUCH for your help thus far. I appreciate you taking a moment to help me learn . You'll notice "-=-=" appears in the Filename variable below. While the batch is in the root of the Grandma Photos directory, Grandma Photos itself is within a folder named "-=-= test dir 2 =-=-". Seems like Filename is somehow pulling a portion of that directory name instead. what do you see if you open a command prompt in the folder where the batch is located, and type (or paste) this at the prompt and hit ENTER? dir /s /b *.crop.jpg Quote from: Salmon Trout on April 07, 2016, 01:51:37 PM what do you see if you open a command prompt in the folder where the batch is located, and type (or paste) this at the prompt and hit ENTER? Also, I tried changing the test dir's name to one with no spaces and ran the echo modified script again. This returned the following: |
|
| 5800. |
Solve : How to insert a line of code into multiple xhtml files? |
|
Answer» My troubles began when I created hundreds of xhtml files for several epub ebooks and didn't place certain code into them. This uses a native Windows batch script called Jrepl.bat written by dbenham, which uses jscript to make it robust and swift. @foxdrive, Thanks for the code help. Thought I have not tried it yet, I am hoping it will do the trick. Q: the section of code you wrote contains: Code: [Select]call jrepl "<head>" "<head>... normally in html the tags are: Code: [Select]<head></head>... In other words the closing head tag includes a backslash. Should your code include this or am i interpreting it wrong? Thanks! UPDATE: Well, I ran the code on three dummy xhtml files and it did exactly as asked for. I guess I just do not understand the code you wrote as well as I thought. Can I assume that these bath files would allow me to insert a single line of text/code after any specified html tag, or text string. Example: Code: [Select]<div> or <p> or even the word string "in the end" Also, DaveLembke's question is most welcome here as well. Ya never know when you might need that as well. I suppose that reading about the Jrepl.bat and it's possibilities would be helpful. It appears to be quite extensive. WOW! Nice code. I just executed it on more than 100 files and it took less than a minute, something that would have taken me "hours?" to do manually. Really appreciate the help...foxidrive's the Man...Thank you patio and guys, you're kind. Regarding Quote from: DaveLembke on February 26, 2016, 06:25:13 AM is there a way to specify which line to write information to, to shove the information at that line number, and all other lines below it down a line for the new information to be added using batch without looking for a string, character, or character count as the trigger to when to add information? There's another great tool by aacini which is also based on jscript: Using findrepl.bat this task could be achieved as this sample shows: findrepl /O:S:E <"file.txt" in this syntax redirects the file and Outputting from line Start to line End If End is omitted then it continues to the end of the file. Code: [Select]@echo off set "file=sample.txt" echo ====================== ( echo one wife echo two girlfriends echo three beers echo four apples echo five pears echo SIX shooter echo seven samurai echo eight harley davidson's ) >"%file%" type "%file%" echo ====================== REM The code above just creates the sample text file. REM The code below takes lines 1 to 5, adds a new line 6, and then takes line 6 to the end of the file ( call findrepl /o:1:5 <"%file%" echo new line six call findrepl /o:6 <"%file%" )>"%file%.2" move /y "%file%.2" "%file%" >nul type "%file%" echo ====================== pause del "%file%" This uses a native Windows batch script called Findrepl.bat written by Aacini http://www.dostips.com/forum/viewtopic.php?f=3&t=4697 Place Findrepl.bat in the same folder as the batch file, or in a folder that is on the system path. There is also copy on Dropbox (unblock it after downloading): https://www.dropbox.com/s/rfdldmcb6vwi9xc/findrepl.bat ====================== one wife two girlfriends three beers four apples five pears six shooter seven samurai eight harley davidson's ====================== one wife two girlfriends three beers four apples five pears new line six six shooter seven samurai eight harley davidson's ====================== Press any key to continue . . .Sweet! Thanks Foxidrive for your additional effort on this one. Saving this info for fact that I know I will be using it in the future. In the past I had to manually go into files requiring info added at a specific (line) placeholder within the file when there was no constant to look for among the files. Hopefully some others find this helpful too. Example of this in some machinery that has config files and many of them, and adding an additional step in the text file ladder logic for PLC etc Move x=123.45 Move y=23.456 Pause = 3000ms Move x=-123.45 Move y=-23.456 and you want something else done in between but yet get back to the home position. Such as Z axis punching metal at a certain depth punch from its reference or home location. Below Z axis info can be added with the solution you shared no matter what information is on line 2 for Y axis and the Pause = 3000ms delimiter method isnt always there either to hunt for ms and write a line after that. Move x=123.45 Move y=23.456 Pause = 3000ms Move z= 53.20 Move z=-53.20 Pause = 3000ms Move x=-123.45 Move y=-23.456 Because the values for the 2nd line for example will be different, but the Z axis punch will always punch metal at same depth just different locations, prior to you sharing your solution I had to manually go into each and every file and edit it. The machinery an engineering nightmare botched together did not come with a nice GUI or even DOS based config file job editor so you actually freely move the axis by hand onto position and measure its placement and then write down the encoder values for XYZ in which you enter this information into config files, and monitor the encoder information with software you can see real time encoder tic positions for all 3 axis for a machine that punches or stamps metal depending on depth of Z axis. Quote from: DaveLembke on February 27, 2016, 05:40:01 AM Sweet! Thanks Foxidrive for your additional effort on this one. I'm glad that it's handy for your computer controlled gear. Aacini (Antonio) and Dave Benham have really changed the way I approach batch scripts, with all their handy scripts and utilities - so useful. A mate has a company doing laser etching, all modern stuff to me, and the staple for many years of the business has been doing engraving with older machines - some of them are controlled by Apple 2+ PCs. Your TASKS seem similar in nature with metalwork. :thumbsup: When it comes to machines, the computers that went with them generally get used far BEYOND the normal home or business computing use. When they are slow in comparison to newer computers, for a machine its the perfect pairing of hardware and software. Sometimes your even stuck with some machines that have ISA control cards etc having to stick to a computer for the machine that has an ISA slot, and even you might even have to stick with a specific CPU or CPU speed so that execution is not too fast for example in which a machine run initially on a 386 DX 33Mhz CPU with a 486 DX 66Mhz might execute too much faster and the machine might thrash itself to death at 2X the clock as before + a CPU that is faster due to core design of coming to a solution to its execution etc. I have had to shop ebay before for specific legacy computers before to pair a machine up with a healthy computer of same or very similar spec to avoid this problem. |
|