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.
| 851. |
Solve : batch script to align the columns in a text file.? |
|
Answer» Hello, Below is my problem: Yes Sir, I've gone through this link a while ago. A tried a bit but my code failed with syntax errors as I was not using them properly. Could you please guide me with this?So you tried using this function already? Why didn't you ask for help on the Dostips.com forum if you couldn't get it too work? Code: [Select]echo off &setlocal enabledelayedexpansion if exist Newfile.txt del Newfile.txt for /F "tokens=1-3" %%G in (file.txt) do ( call :Format "[-6][-18][-4]" %%G %%H %%I >>Newfile.txt echo !line! ) goto :eof :Format fmt str1 str2 ... -- outputs columns of strings right or left aligned :: -- fmt [in] - format string specifying column width and alignment, i.e. "[-10][10][10]" :$created 20060101 :$changed 20091130 :$categories Echo :$source http://www.dostips.com SETLOCAL set "fmt=%~1" set "line=" set "spac= " set "i=1" for /f "tokens=1,2 delims=[" %%a in ('"echo..%fmt:]=&echo..%"') do ( set /a i+=1 call call set "subst=%%%%~%%i%%%spac%%%%%~%%i%%" if %%b0 GEQ 0 (call set "subst=%%subst:~0,%%b%%" ) ELSE (call set "subst=%%subst:~%%b%%") call set "const=%%a" call set "line=%%line%%%%const:~1%%%%subst%%" ) endlocal&set "line=%line%" GOTO :EOF output Code: [Select]C:\BatchFiles\Format>type file.txt 96782 0000015.00 QRP 100266 0000015.00 QRP C:\BatchFiles\Format>format_SSIS.bat C:\BatchFiles\Format>type newfile.txt 96782 0000015.00 QRP 100266 0000015.00 QRP C:\BatchFiles\Format> Quote from: ssis_sql_dev on January 07, 2015, 02:15:14 PM Hello, Below is my problem: The numbers are different - is that part of the task? Quote from: ssis_sql_dev on January 07, 2015, 02:15:14 PM how to enhance this code to make sure that, when there is a 5 digit value shows up, it will be like the one I need. What do you mean by this? Will there be 4 digit numbers for example? The task is not clear from what you have written. |
|
| 852. |
Solve : Run a batch recursively? |
|
Answer» Hello, |
|
| 853. |
Solve : Compare xml files with same name in 2 differnt folders? |
|
Answer» HI every1 , Can some1 help me with a batch code for the description below: Quote ==>I have many xml files in two different folders.ANY SUGGESTIONS? THANKS IN ADVANCE Replace the variable values with the names of the folders you wish to compare and the destination. IT WILL NOT PROMPT WHEN OVERRIDING FILES, so be careful. Code: [Select]echo off setlocal EnableDelayedExpansion set folder1=Folder1 set folder2=Folder2 set folder3=Diff if not exist %folder3% md %folder3% cd %folder1% for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder2% cls echo Processing File "%%A", Please Wait . . . if not exist %%A ( cd ..\%folder1% move %%A "..\%folder3%\%%A" >nul 2>&1 ) else ( fc %%A "..\%folder1%\%%A" >nul 2>&1 if "!errorlevel!"=="1" ( move %%A "..\%folder3%\%folder2% - %%A" >nul 2>&1 move "..\%folder1%\%%A" "..\%folder3%\%folder1% - %%A" >nul 2>&1 ) ) cd ..\%folder1% ) pause Lemonilla Thanks a lot This code works perfectly fine for me Quote But this code moves only files from folder1 which are not in folder2 after comparison to folder3 ,Can u SUGGEST a code which will move the files in folder2 to folder3 at the same time which are not in folder1,I mean to ask u to perform the move operation in both the folders at the same time which are not same..Not sure where to quote is from, but this should work as well. I have not tested this. Code: [Select]echo off setlocal EnableDelayedExpansion set folder1=Folder1 set folder2=Folder2 set folder3=Diff if not exist %folder3% md %folder3% cd %folder1% for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder2% cls echo Processing File "%%A", Please Wait . . . if not exist %%A ( cd ..\%folder1% move %%A "..\%folder3%\%%A" >nul 2>&1 ) else ( fc %%A "..\%folder1%\%%A" >nul 2>&1 if "!errorlevel!"=="1" ( move %%A "..\%folder3%\%folder2% - %%A" >nul 2>&1 move "..\%folder1%\%%A" "..\%folder3%\%folder1% - %%A" >nul 2>&1 ) ) cd ..\%folder1% ) cd ..\%foldere% for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder1% cls echo Processing File "%%A", Please Wait . . . if not exist %%A ( cd ..\%folder2% move %%A "..\%folder3%\%%A" >nul 2>&1 ) else ( fc %%A "..\%folder2%\%%A" >nul 2>&1 if "!errorlevel!"=="1" ( move %%A "..\%folder3%\%folder1% - %%A" >nul 2>&1 move "..\%folder2%\%%A" "..\%folder3%\%folder2% - %%A" >nul 2>&1 ) ) cd ..\%folder2% ) pause It does a second pass though the files to make sure that all the files in the other folder exist in the first. As I said, I have not tested it as I am not at home. Hopefully it's what he wanted.hi thanks lemonilla:-) i had already tried the same way as yo MENTIONED , but it dint work properly i guess , i ll TRY tomorrow in office and let yo no,. . . . thanks again . . . There was a spelling mistake, fixed it: Code: [Select]echo off setlocal EnableDelayedExpansion set folder1=Folder1 set folder2=Folder2 set folder3=Diff if not exist %folder3% md %folder3% cd %folder1% for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder2% cls echo Processing File "%%A", Please Wait . . . if not exist %%A ( cd ..\%folder1% move %%A "..\%folder3%\%folder1% - %%A" >nul 2>&1 ) else ( fc %%A "..\%folder1%\%%A" >nul 2>&1 if "!errorlevel!"=="1" ( move %%A "..\%folder3%\%folder2% - %%A" >nul 2>&1 move "..\%folder1%\%%A" "..\%folder3%\%folder1% - %%A" >nul 2>&1 ) ) cd ..\%folder1% ) cd ..\%foldere% for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder1% cls echo Processing File "%%A", Please Wait . . . if not exist %%A ( cd ..\%folder2% move %%A "..\%folder3%\%folder2% - %%A" >nul 2>&1 ) else ( fc %%A "..\%folder2%\%%A" >nul 2>&1 if "!errorlevel!"=="1" ( move %%A "..\%folder3%\%folder1% - %%A" >nul 2>&1 move "..\%folder2%\%%A" "..\%folder3%\%folder2% - %%A" >nul 2>&1 ) ) cd ..\%folder2% ) pause ) cd ..\%folder1% ) Quote cd ..\%foldere%for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder1% In the above quoted code u have written it as "foldere" ?? "folder2" to be specified there This code also wont move file names with spaces in their names i believe? Pls correct me if i am wrong..Fixed, and Fixed. Code: [Select]echo off setlocal EnableDelayedExpansion set folder1=Folder1 set folder2=Folder2 set folder3=Diff if not exist %folder3% md %folder3% cd %folder1% for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder2% cls echo Processing File "%%A", Please Wait . . . if not exist "%%A" ( cd ..\%folder1% move "%%A" "..\%folder3%\%folder1% - %%A" >nul 2>&1 ) else ( fc "%%A" "..\%folder1%\%%A" >nul 2>&1 if "!errorlevel!"=="1" ( move "%%A" "..\%folder3%\%folder2% - %%A" >nul 2>&1 move "..\%folder1%\%%A" "..\%folder3%\%folder1% - %%A" >nul 2>&1 ) ) cd ..\%folder1% ) cd ..\%folder2% for /f "delims=" %%A in ('dir /b') do ( cd ..\%folder1% cls echo Processing File "%%A", Please Wait . . . if not exist "%%A" ( cd ..\%folder2% move "%%A" "..\%folder3%\%folder2% - %%A" >nul 2>&1 ) else ( fc "%%A" "..\%folder2%\%%A" >nul 2>&1 if "!errorlevel!"=="1" ( move "%%A" "..\%folder3%\%folder1% - %%A" >nul 2>&1 move "..\%folder2%\%%A" "..\%folder3%\%folder2% - %%A" >nul 2>&1 ) ) cd ..\%folder2% ) pause I think this should solve the task in the first post: Code: [Select]echo off set "a=c:\folder1" set "b=c:\folder2" set "c=c:\folder3" md "%c%" 2>nul cd /d "%a%" & for %%z in (*.xml) do if not exist "%b%\%%z" move "%%z" "%c%" cd /d "%b%" & for %%z in (*.xml) do if not exist "%a%\%%z" move "%%z" "%c%" pause Quote from: foxidrive on June 09, 2014, 08:54:24 AM I think this should solve the task in the first post: Not quite though, It should also compare the two if they do exist, so you'd need something like else fc "%%Z" "%a%\%%Z" || move "%%z" "%c%\%%z" at the end of your cd lines Quote from: Lemonilla on June 09, 2014, 01:15:12 PM Not quite though, It should also compare the two if they do exist The task is to move files if they don't exist in both folders, right? Quote from: foxidrive on June 09, 2014, 07:56:23 PM The task is to move files if they don't exist in both folders, right?Quote ==>Some xml files are present in both the folders which are the same with same file name.So if they exist in both, compare the two and move them if they are different. Thus you need to use 'fc'.Thanks Lemonilla and foxi :)U both have done the right way as u have quoted .... and have done it at right time... all the codes wud b useful... Quote from: Lemonilla on June 09, 2014, 09:12:34 PM So if they exist in both, compare the two and move them if they are different. Thus you need to use 'fc'. No need for that - no mention was MADE about comparing files. I think we have different interpretations of the task. Quote from: foxidrive on June 10, 2014, 05:52:34 AM No need for that - no mention was made about comparing files. I think we have different interpretations of the task.I looked at it again, and can see where we interpreted things differently. |
|
| 854. |
Solve : DOS For Loop with Incorrect Number of Tokens? |
|
Answer» I have a script which is passed only one parameter, I am issuing the _PARM as I see it being passed by some application for testing. I am expecting a total of 6 PARAMETERS to be passed. Now if for some reason if there is no sixth parameter, the "if" code for %%F DOES NOT GET executed, and it just drops through. Any ideas how to address this? I cannot used IF DEFINED, it does not work.... The quotes are required as shown in _PARM: |
|
| 855. |
Solve : Changing suffix of filename? |
|
Answer» down vote favorite I've got a file that GETS copied daily from one sql system to the another sql server for restore purposes. The file name contains the name of the sql backup ALONG with the current date/time. I would like to strip out the date/time and rename as follows: Typical File copied daily: Server100_PRD_FULL_20140530_000850.bak --But not SURE how to rename the suffix that contains the date. Would like to rename copied files as above to:SPDBSPSFS100_FS84PRD_FULL.BAK Appreciate help. Thanks See if this helps: Code: [Select]echo off set "file=Server100_PRD_FULL_20140530_000850.bak" for /f "tokens=1-3 delims_=" %%a in ("%file%") do set "file=%%a_%%b_%%c.bak" echo("%file%" It depends on how you get your file - you've stated that you want to strip out the date_time and also that you want to GIVE it a different filename. I'm not sure exectly what you are after.Thanks....one NOTE the file name changes daily ( as per date/time file created) so today would be: Server100_PRD_FULL_20140530_000850.bak tomorrow Server100_PRD_FULL_20140531_000850.bak ThanksIt is not clear what you want to do, and how you go about doing it. Which drive, folder, is it on a network and do you need to log into the LAN?The script Foxi gave you is the base code to remove the date. Pretty sure you can extrapolate from there on how to rename your file from there. |
|
| 856. |
Solve : malware scanner script? |
|
Answer» i needed a quick an easy way to upload a script to download several AV software and run them mostly without user input. My scripting abilities are amature, but i can usually botch something together and make it work. My script is below i am having an issue on the Line :JRT right after the call for key.vbs i need it to wait until JRT.exe to finish before moving onto anything else. Then once JRT.exe is done move on thru the script automatically. Feel FREE to offer anything to clean this up to work better. |
|
| 857. |
Solve : To search and send "Interpretation (Interpret) Passed" Exactly from Html files? |
|
Answer» Hi Friends, And stop PM'ing people for answers Please...+1 or maybe that is +2 or +3 already.Starting to sound alot more like Homework to me..... Sorry all for the troble and thanks for the help... will let you people no if its working in a while since my server is down..Hi Foxi, The code that you suggested DOESNT work . Its not copying anything, Any other suggestions ? Thanks in advance.Place pause as the last line. Are there any messages on the screen? I tried as yo you said Foxi and also i get many lines as mentioned below on the screen ... FINDSTR: Cannot open % You pasted it into a CMD window, right? Quote from: Venkat on May 29, 2014, 04:06:48 AM I tried as yo you said Foxi and also i get many lines as mentioned below on the screen ...I don't get that error when I run it.He's DONE his own editing.... Please post what you have so far... Quote from: patio on May 29, 2014, 07:26:47 AM He's done his own editing....Another +1 for you! |
|
| 858. |
Solve : How to make batch file do a random choice?? |
|
Answer» HEY, I'm trying to make a batch file that can randomly choose between TWO scripts. For example, the first option can be 'echo you win', and the second can be 'echo you lose'. Is it possible for the batch file to randomly choose on of them? Thanks, Whitebeard1See if this is the SORT of thing you need. Code: [Select]echo off :loop set /a num=%random% %% 2 if %num% equ 0 (echo you win) else (echo you lose) pause goto :loop Thanks a BUNCH! Exactly what I need. |
|
| 859. |
Solve : Creating a text-based game .bat? |
|
Answer» Hello all! I am new to these forums, and I thought this would be a great introduction for both parties. I am creating a text-based adventure game as a .bat file, just for fun, and would like to share. I am looking for constructive criticism and advice, as I hope that this little project gives me a more advanced knowledge of .bat scripting. |
|
| 860. |
Solve : find replace a string with new line? |
|
Answer» Hi All, |
|
| 861. |
Solve : Batch code to find and replace strings in xml files and move them to new folder? |
|
Answer» HI i need a BATCH CODE to find and replace the below two tasks(Task_RunOwt,Task_RunDbdIo) if found with another task(Task_RunGenericIo) in around 1500 xml files..is it possible??? The changed files should be moved to different folder after replacing the strings... old tasks to be replaced: 1) Quote <task>2) Quote <task>NEW Task Which has to be substituted in place of above two tasks if found in the xml files: Quote <task> Points to be noted: Quote *uid,pass,fail and incomplete tags and its content in the xml code should remain unchanged,only the code in between the uid and pass tags should be replaced with following It would be of great help if this works out...Thanks in advance...Does it have to be in batch? I know repl.bat uses java script, and might be what you are looking for. https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat You'll have to ask Squashman or Foxidrive for more info on it, as I haven't used it much. Quote from: Venkat on June 28, 2014, 04:36:52 PM Hi i need a BATCH CODE to find and replace the below two tasks(Task_RunOwt,Task_RunDbdIo) if found with another task(Task_RunGenericIo) in around 1500 xml files. I have a few questions: Will any xml file contain both Task_RunOwt and Task_RunDbdIo tasks? Will any xml file contain more than one of the tasks? Are all 1500 xml files in a single folder? Hi Lemonilla, Quote Does it have to be in batch? It is not mandatory to be in a batch , Any code is fine which makes the replacement of 2 tasks task in xml file to RunGenericIo Task.i ll check that link which u sent and let u no if it works.Hi Foxi, Quote Will any xml file contain both Task_RunOwt and Task_RunDbdIo tasks? 1)I dont think any Xml file contains both the tasks Task_RunOwt and Task_RunDbdIo in a single XML File , But even if thats the scenario ,replacement has to be done with Task_RunGenericIo since other two tasks are deprecated. 2)Yup every Xml file has many different tasks which has Task_RunOwt and Task_RunDbdIo repeated no. of times or only once. 3)All 1500 xml files are not in single folder,they are in different folders of same directory. 4)Task_RunOwt and Task_RunDbdIo tasks are deprecated in the tool i work with, so i need them get replaced with Task_RunGenericIo which is used for writing data in volumes of Client Orcs mentioned.. Quote https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat Will this code help me out Foxi/SquashMan??? Is so pls tell me.. |
|
| 862. |
Solve : help installing gnu package linux in windows / DOS? |
|
Answer» Hi, I'm TRYING to install the package "myfitter" on windows, the DOCUMENTATION instructions are for linux i think? so if someone knows what the equivalent dos commands are thatd be super awesome. |
|
| 863. |
Solve : Batch file find/replace text (allow user to enter data)? |
|
Answer» I am trying to create a batch file that will replace text within a text file. |
|
| 864. |
Solve : DOS - Find multiple strings in the same line? |
|
Answer» I have a file which I want to extract the LINE only if it contains two strings, any ideas how to do this? If my file contains the following strings as an example: |
|
| 865. |
Solve : Variable outside of the for loop? |
|
Answer» I am trying to use the variable outside of the For loop. The echo inside the loop GIVES the result as expected. it is not working when i echo the variable outside of the loop. below is the script. Please let me know what am MISSING. THANK you! |
|
| 866. |
Solve : Fast countdown timer for a batch game... ?? |
|
Answer» Hey guys! I was FINALLY able to get the save and load to function PROPERLY. Now, I need help making a quick countdown timer (quick as in wait time is no more than a minute(I'd prefer to have it in milliseconds, or something smaller than a second.))for when the player's character is mining. The wait time would decrease as they level up. Any thoughts?A plain BATCH solution - change the value of the delay variable |
|
| 867. |
Solve : How Create Formatted Output? |
|
Answer» How does one created a formatted output in DOS, that is, maintain the spaces and columns? Not even sure if it is possible.An example of what you are trying to do and what code you have tried so far would probably help us help you.He's gonna GET an A+ in class at this rate... I discovered what the issue is, it seems to be a notepad thing. Notepad is nicely formatting the alignment of the "echo" so I would think it is properly aligned. Now when I tried to paste the code here, it is all misaligned. So I guess my question is, is there a way to output a formatted report without using echo statements in DOS or some third-party product or writing a program to produce what I want?BB code tags should RETAIN any formatting but without seeing what your existing code is or what your input looks like and what you want the output to look like then this really becomes an exercise in futility. Not homework at all, I wish I was that young to go back to school :-) You're not old enough to know a proportional font from a monospaced font.I always want things to line up... The new code will line things up... Original code: Code: [Select]echo [USAGE]: %~1 arg1 arg2 arg3 arg4 arg5 arg6 >> %MAILLOG% echo arg1 : IDF : %IDF% >> %MAILLOG% echo arg2 : PARTNER : %PART% >> %MAILLOG% echo arg3 : PARM : %PARM% >> %MAILLOG% echo arg4 : FNAME : %FNAME% >> %MAILLOG% echo arg5 : FILENAME : %FILENAME% >> %MAILLOG% echo arg6 : FACTION [Y^|N] : %FACTION% >> %MAILLOG% New Code: Code: [Select]echo [USAGE]: %~1 arg1 arg2 arg3 arg4 arg5 arg6 >> %MAILLOG% echo arg1 : IDF.....................: %IDF% >> %MAILLOG% echo arg2 : PARTNER............: %PART% >> %MAILLOG% echo arg3 : PARM.................: %PARM% >> %MAILLOG% echo arg4 : FNAME...............: %FNAME% >> %MAILLOG% echo arg5 : FILENAME...........: %FILENAME% >> %MAILLOG% echo arg6 : FACTION [Y^|N]....: %FACTION% >> %MAILLOG% |
|
| 868. |
Solve : Batch game save and load codes.? |
|
Answer» Hey guys! 1.) when you defined your variables, you use this: set /a Magicattack =15 which defines the variable %Magicattack % not %Magicattack%. Lemonilla, you will be surprised to find that set /a var =15 doesn't behave the same as set var =15 The code you've shown will work just fine and not introduce a space. Thanks guys, but I found a different method which works consistently. \\m// (-_-) Quote from: Batch_gamer on June 23, 2014, 03:33:54 PM Thanks guys, but I found a different method which works consistently. \\m// (-_-) Pray tell us what it was... Quote from: patio on June 23, 2014, 04:18:26 PM You dont like passive aggressive responses. Batch_gamer I have been writing a game and was wandering what was the way you figured out how to save the game? Quote from: shiverbob on June 29, 2014, 09:41:57 AM Batch_gamer I have been writing a game and was wandering what was the way you figured out how to save the game? If you are holding all of your information in variables, I use: set >save1.txt and then to load I use: For /f "delims=" %%A in (save1.txt) do set %%A Also, next time either read through the whole thread, or make a new one. Quote from: Lemonilla on June 22, 2014, 07:41:36 AM 2.) Not sure how you are saving your game, but I usually use set >save1.txt. Then to load, you just go for /f "delims=" %%A in (save1.txt) do set %%A. This will redefine all of your variables to what they were when you saved. Be careful though, if you change an environment variable such as path between loads It will override those changes.I did and that method didn't work and I was wandering what the way he found... How are you holding the data? And what type of stuff do you want to carry over? Seems to work fine for me. Code: [Select] C:\windows\system32>t: T:\>set a=7 T:\>set b=17 T:\>set >log T:\> Code: [Select] C:\windows\system32>set AGSDESKTOPJAVA=C:\Program Files (x86)\ArcGIS\Desktop10.2\ ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\Lemonilla\AppData\Roaming asl.log=Destination=file CommonProgramFiles=C:\Program Files (x86)\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=LEMON ComSpec=C:\Windows\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Users\Lemonilla LOCALAPPDATA=C:\Users\Lemonilla\AppData\Local LOGONSERVER=\\LEMON LUA_DEV=C:\Program Files (x86)\Lua\5.1 LUA_PATH=;;C:\Program Files (x86)\Lua\5.1\lua\?.luac NUMBER_OF_PROCESSORS=4 OS=Windows_NT PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.wlua;.lexe PROCESSOR_ARCHITECTURE=x86 PROCESSOR_ARCHITEW6432=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=3a09 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files (x86) ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PROMPT=$P$G PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\LEMONI~1\AppData\Local\Temp TMP=C:\Users\LEMONI~1\AppData\Local\Temp USERDOMAIN=Lemon USERNAME=Lemonilla USERPROFILE=C:\Users\Lemonilla VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools \ windir=C:\Windows windows_tracing_flags=3 windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log C:\windows\system32>t: T:\>for /f "delims=" %A in (log) do set %A T:\>set a=7 T:\>set AGSDESKTOPJAVA=C:\Program Files (x86)\ArcGIS\Desktop10.2\ T:\>set ALLUSERSPROFILE=C:\ProgramData T:\>set APPDATA=C:\Users\Lemonilla\AppData\Roaming T:\>set asl.log=Destination=file T:\>set b=17 T:\>set CommonProgramFiles=C:\Program Files (x86)\Common Files T:\>set CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files T:\>set CommonProgramW6432=C:\Program Files\Common Files T:\>set COMPUTERNAME=LEMON T:\>set ComSpec=C:\Windows\system32\cmd.exe T:\>set FP_NO_HOST_CHECK=NO T:\>set HOMEDRIVE=C: T:\>set HOMEPATH=\Users\Lemonilla T:\>set LOCALAPPDATA=C:\Users\Lemonilla\AppData\Local T:\>set LOGONSERVER=\\LEMON T:\>set LUA_DEV=C:\Program Files (x86)\Lua\5.1 T:\>set LUA_PATH=;;C:\Program Files (x86)\Lua\5.1\lua\?.luac T:\>set NUMBER_OF_PROCESSORS=4 T:\>set OS=Windows_NT T:\>set PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.wlua;.lex e T:\>set PROCESSOR_ARCHITECTURE=x86 T:\>set PROCESSOR_ARCHITEW6432=AMD64 T:\>set PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel T:\>set PROCESSOR_LEVEL=6 T:\>set PROCESSOR_REVISION=3a09 T:\>set ProgramData=C:\ProgramData T:\>set ProgramFiles=C:\Program Files (x86) T:\>set ProgramFiles(x86)=C:\Program Files (x86) T:\>set ProgramW6432=C:\Program Files T:\>set PROMPT=$P$G T:\>set PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ T:\>set PUBLIC=C:\Users\Public T:\>set SESSIONNAME=Console T:\>set SystemDrive=C: T:\>set SystemRoot=C:\Windows T:\>set TEMP=C:\Users\LEMONI~1\AppData\Local\Temp T:\>set TMP=C:\Users\LEMONI~1\AppData\Local\Temp T:\>set USERDOMAIN=Lemon T:\>set USERNAME=Lemonilla T:\>set USERPROFILE=C:\Users\Lemonilla T:\>set VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Commo n7\Tools\ T:\>set windir=C:\Windows T:\>set windows_tracing_flags=3 T:\>set windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log T:\>set a=7 AGSDESKTOPJAVA=C:\Program Files (x86)\ArcGIS\Desktop10.2\ ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\Lemonilla\AppData\Roaming asl.log=Destination=file b=17 CommonProgramFiles=C:\Program Files (x86)\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=LEMON ComSpec=C:\Windows\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Users\Lemonilla LOCALAPPDATA=C:\Users\Lemonilla\AppData\Local LOGONSERVER=\\LEMON LUA_DEV=C:\Program Files (x86)\Lua\5.1 LUA_PATH=;;C:\Program Files (x86)\Lua\5.1\lua\?.luac NUMBER_OF_PROCESSORS=4 OS=Windows_NT PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.wlua;.lexe PROCESSOR_ARCHITECTURE=x86 PROCESSOR_ARCHITEW6432=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=3a09 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files (x86) ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PROMPT=$P$G PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\LEMONI~1\AppData\Local\Temp TMP=C:\Users\LEMONI~1\AppData\Local\Temp USERDOMAIN=Lemon USERNAME=Lemonilla USERPROFILE=C:\Users\Lemonilla VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools \ windir=C:\Windows windows_tracing_flags=3 windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log T:\> I have try a txt a dat a bat and it is about 6 virables that will be changed by buying stuff in game But there is some words and that number will change And the issue is not saving it loading (I have know idea what dat is) Fine you want a new thread you will get one Can we see the files? It could be that it isn't writing it properly, or in the wrong place. Try surrounding %%A in quotes like this: for /f "delims=" %%A in (save1.txt) do set "%%A" That should help if there are spaces.Yea if you can figure a way to do that with a computer without internet I am using a tablet Quote from: shiverbob on June 30, 2014, 01:30:55 PM Yea if you can figure a way to do that with a computer without internetYou are still able to connect here...run the above on a connected PC and see if it works. |
|
| 869. |
Solve : Space bar is permanently active? |
|
Answer» Hi, The game(s) have yet to be mentioned... Well, one of them is Volfied. After I run it, this intro screen disappears quickly as if I was pressing the space bar. When I start the game, (you should press space to cut these fields in the game), I can cut them freely without pressing the space bar. Also, when I press ESC to exit, I must keep pressing it really quickly a lot of times, because it skips the intro and SHOWS me the main main of the game. Same happens in other games. Quote from: DaveLembke on July 10, 2014, 03:52:02 PM There use to be some annoying virus's back in the day that were TSR's that would cause people to want to throw their computers out the 2nd story window. I just formated my HDD and installed everything fresh. Checking if it has some viruses is good idea, though. (Who knows what was on all these CD's and floppies) Past few days I was messing with my sound card drivers, broke system 3 times already. Finally I found good drivers, set everything and now this! I hope my Retro Gaming PC can be fully functional, because nothing beats original hardware. Quote Checking if it has some viruses is good idea, though. (Who knows what was on all these CD's and floppies) The last time I got bit by a DOS virus it was because I introduced a bunch of unknown content floppies from a yard sale computer I bought in which the seller sold the 286 computer with about 200 floppies and I was popping them in 1 by 1 and performing a DIR to see what was there and then if I saw anything interesting for EXE's I'd run them to see what they were etc. And if it was a cool game like Digger etc, I'd save it to my 320MB Connor HDD in a directory for DOS games etc. When I got so far into the pile and then eventually the DIR info was showing strange sizes and random ascii characters like ♦♥♣ etc where Directory info should be, i figured I had a bad disk and went on to the other. Then the other did the same and so I put in a prior disk that worked ok and that also did the same. I then used a floppy drive cleaner with the alcohol and ran that to clean it and tried again and still same issue. Swapped out the floppy drive thinking it was messed up somehow. Same results with a known good drive. I then made the mistake of taking the floppy disk to another system I had and it started doing same thing on that one. Nothing like unknowingly spreading a virus like fire among disks and systems. Now I had 2 infected systems and a pile of before problem happened disks and the unknown ones. Full format and reinstall of OS for both systems and then instead of introducting the floppies to an unprotected system with no antivirus running I brought them over to my newest system at the time that had an antivirus on it and scanned through the small pile I had and they were clean and then when I got to the known trouble floppy disks, it immediately detected and told me what virus it had and I was able to clean them. I then continued to go through my entire collection of floppies to make sure the virus was killed off. What a Pain that was!!!! The virus also corrupted some files on the floppies and so some data loss happened. The good thing is that I had a backup on floppies of the DOS game collection I had, but then had to copy the 30+ disks back to the freshly clean installed HDD.DaveLembke I completely understand you. These kind of problems made me switch to Linux. Back in the day (around 2000) I installed on this exact machine (see my specs for more info) Red Hat Linux 7.0 and everything worked great. After a month or so, I managed to set my modem as well! What a happiness that was. However, there were no my DOS games! So I constantly switched between Windows and Linux, just because of gaming, lol. Few months ago, after I remembered having this PC, I installed Debian GNU/Linux 7 (prior to this there was Windows XP installed, which ran horribly) and I even managed to make USB WI-FI card working on this machine. Though this was perfectly usable machine, I still wanted my native DOS Box. Wish Microsoft developed it's OS's more UNIX-like, hopefully these kind of problems wouldn't exist. Anyway, I'll try installing Anti-Virus tomorrow on this machine and let you know how it went through. Quote from: georgiy on July 10, 2014, 04:14:13 PM Well, one of them is Volfied. This is an emulator by the look of it. Does the problem occur in other games, like Doom and Duke Nukem that don't run in an emulator? Quote from: foxidrive on July 10, 2014, 08:08:10 PM This is an emulator by the look of it.What makes you say that?Eureka! I have found it. So I reformatted my HDD yet again and installed Windows 98 SE this time. I loaded the game on HDD and rebooted in DOS. And everything worked, space bar wasn't "jammed". Then I installed Anti-Virus, graphic card and sound card drivers. I rebooted again in DOS and keyboard was malfunctioning again. I returned in Windows and disabled sound card drivers completely. Rebooted again in DOS and everything worked. So then I became suspicious and re-enabled sound card drivers, but disabled only Gameport Joystick. It turned out that was the problem. I have no Joystick connected to my sound card, so that might be it, or the port itself might be damaged. Whatever it was, now it is working perfectly. Thanks everyone for constructive discussion. Mystery solved! Quote from: DaveLembke on July 10, 2014, 03:21:24 PM BTW your system specs state Pentium II 533Mhz.....the fastest Pentium II I was aware of was the 450Mhz. The Pentium III's were 533Mhz. Is this a typo and really a Pentium III 533 or is this a Pentium II 333 etc? Oops, lol! I mistyped it... twice! Yes, it is Pentium III! |
|
| 870. |
Solve : [Batch script] How to locate an .ini file with a name which starts with "nsc"? |
|
Answer» My script: Code: [Select]echo off for %%f in ('dir /s /b H:\nsc*') do ( set file=%%f set type=%file:~-3% if "%type%"=="ini" echo good&%file% >> H:\allfinding.txt ) WHY the cut string doesn't work?? as in the attachment implies, the code works seperately but not in a file batch? can somebody tell me why??? or any solution for finding the path of a file called "nsc*.ini" in C:\, behind several folder perhaps, thank you!!! [recovering disk SPACE, attachment deleted by admin]If you want to set and use variables inside a bracket structure you need delayed expansion and use exclamation marks (!) instead of percent signs (%) when you expand them. 1. Study the parts in red echo off setlocal enabledelayedxpansion for %%f in ('dir /s /b H:\nsc*') do ( set file=%%f set type=!file:~-3! if "!type!"=="ini" echo good&!file! >> H:\allfinding.txt ) 2. THIS IS IMPORTANT: what is the ampersand (&) doing here? Please explain what you think it will do. Quote good&%file% Did you mean good%file% .... ? I assume in the next example you want to concatenate the string good and the file name variable. 3. You don't really need the intermediate variables (file and type). You can get the file extension directly like this if %%f is a filename with extension, %%~xf is just the extension (with dot). Type FOR /? at the prompt to find out about the ~ variable modifiers. echo off for %%f in ('dir /s /b H:\nsc*') do ( if "%%~xf"==".ini" echo good%%f >> H:\allfinding.txt ) In fact it will all go on one line echo off for %%f in ('dir /s /b H:\nsc*') do if "%%~xf"==".ini" echo good%%f >> H:\allfinding.txt Finally, the script as it stands will ignore files whose extension is .INI or InI or .Ini or .iNi UNLESS you make the IF test case insenstive with the /i switch. for %%f in ('dir /s /b H:\nsc*') do if /i "%%~xf"==".ini" echo good%%f >> H:\allfinding.txt Anyhow why don't you just do this? dir /s /b H:\nsc*.ini >> H:\allfinding.txt Wow...that's what is said in a 2hour lecture Quote from: shiverbob on July 09, 2014, 01:53:39 PM Wow...that's what is said in a 2hour lecture No, a 1 minute brief explanation. Quote from: mangolzy on July 09, 2014, 09:17:28 AM or any solution for finding the path of a file called "nsc*.ini" in C:\ If the file is in C:\ or a folder under it, why does your script look in H:\ .... ? Very glad with this reply so effective, i am really a new hand, i try this to avoid some repetitive work. 1. once a variable is used twice, it should be !XXX! ? 2. oh that just my imagination of combine the string &...so it will be printed directly in fact 3. thank you for the improvement, but i have to find out all the file qualified, and make some modification in them, so it will be a simple batch... i think... i suddenly found out a fact that you are the one who help me with the replacement of configuration file ... u r really an expert!! so what i am doing now is to find out the path of the file i am going to modify, Code: [Select]echo off setlocal Enabledelayedexpansion set name=10.23.96.46 for /f "tokens=1* delims=:" %%a in ( ' findstr /n /r "^" "nsc.ini" ' ) do ( set var=%%b set var=!var:10.23.96.98=%name%! echo !var!>>newnsc.ini ) endlocal of cause, it does the change as planned...yeah,, it still has the problem of blank line, it will put out 10.23.96.98=10.23.96.46 when come across a blank line, is it possible to improve this?? thank u very much!! btw, how can you be so familiar with all these? Quote from: mangolzy on July 09, 2014, 03:08:16 PM btw, how can you be so familiar with all these?Practice makes perfect. Quote from: shiverbob on July 09, 2014, 01:53:39 PM Wow...that's what is said in a 2hour lectureI hope not, or I'll be really bored in class.Hello, I still have a problem, with this command line, Code: [Select]for %f in (dir /s /b H:\nsc*) do if /i "%~xf"==".ini" echo good%f >> H:\allfinding.txt why it ignore those files in a subfolder?? I mean with dir /s /b H:\nsc* itself, we have Code: [Select]H:\nscini1019551.docx H:\nsc.ini H:\nscini101951151.docx H:\NSClient++ REFERENCE Manual.pdf H:\nsclient.ini H:\nscnew.ini H:\nsc.vbs H:\nsc.exe H:\nsclient.bat H:\nscre.vbs H:\nscre.exe H:\nsclientpp.vbs H:\nsclientpp.exe H:\NSClient.txt H:\NSC H:\nscpplist.txt H:\nsc.log H:\nscfind.txt H:\Script\nsc.ini H:\Script\nsclient.ini H:\Script\nsc.vbs H:\Script\nsc.txt H:\NSC\nsclient.ini H:\NSC\nscnew.ini H:\NSC\nsc.ini H:\success_server_tse\nscpplist.txt H:\success_server_tse\nsclient.bat but with the for sentence, i got only Code: [Select]goodH:\nsc.ini goodH:\nsclient.ini goodH:\nscnew.ini I know it's a simple question ; but i have no experience at all.................. Thank you allTry this: Code: [Select]dir /s /b /a-d h:\nsc* |findstr /i "\.ini$" >h:\nsc-ini-files.txt and if you only want .ini files then this will work as well: Code: [Select]dir /s /b /a-d h:\nsc*.ini >h:\nsc-ini-files.txt Quote from: foxidrive on July 10, 2014, 05:38:36 AM Try this: Thank you for your reply first, but it doesn't match to my problem. YES, they help to find out all the path I want to know, but the problem lies in the for syntax, once i apply the dir.................... sentence in a for sentence, it returns only the files in H:\ BUT NOT IN H:\NSC by exemple. WHY i want this effect?? because i want to know all these paths and then make modification to these files, their paths should be in a for loop~~ or perhaps there are other solutions Code: [Select]echo off for /f "delims=" %%a in (' dir /s /b /a-d h:\nsc*.ini ') do ( echo "%%a" ) pause Quote from: mangolzy on July 10, 2014, 07:50:19 AM it returns only the files in H:\ BUT NOT IN H:\NSC by exemple. What does this mean? Did you mention H:\NSC in any of your posts? Is this a folder? Please explain. The code above will show any file that starts with NSC and ends in .INI Quote from: foxidrive on July 10, 2014, 08:19:07 AM Code: [Select]echo off thank you foxidrive!! it works like this: Code: [Select]echo off setlocal enabledelayedexpansion set newip=10.23.96.98 for /f "delims=" %%f in ('dir /s /b /a-d H:\nsc*.ini') do ( echo %%f pause for /f "tokens=1* delims=:" %%a in (' findstr /n /r "^" "%%f" ') do ( set var=%%b set var=!var:10.23.96.46=%newip%! echo !var!>>sucess.txt ) echo *********************finish one*******************>>sucess.txt echo good%%f>> H:\ok.txt ) endlocal i have the modification done in all the files concerned, the only one problem that left is, they don't treat the blank line correctly as i have said before~~ can you help me with this delicate problem too?? It is a real problem in batch scripting when people don't describe what they are TRYING to do. Run this and see if it is what you want to do, because I am guessing. Code: [Select]echo off setlocal enabledelayedexpansion set newip=10.23.96.98 for /f "delims=" %%f in ('dir /s /b /a-d H:\nsc*.ini') do ( set "var=%%~nxf" set "var=!var:10.23.96.46=%newip%!" >>success.txt echo %%~dpf!var! ) endlocal pause Quote from: foxidrive on July 10, 2014, 09:41:41 AM It is a real problem in batch scripting when people don't describe what they are trying to do. Let me make my problem clear: I want to search in the whole system all the file begins with nsc and type of .ini; once we found one path of this kind of file, we replace all the 10.23.96.46 with 10.23.96.98 in the file. that's all the functionality that i want, up to now with your help. there is no problem in locating all the files qualified, 1. but still a little problem in the treatment of file, that's to say in the replacement when i try to read the file line by line, then when it comes to a blank line, the code i provided yesterday, will fill in the blank line with "10.23.96.46=10.23.96.98" 2. do you know how to get the folder where a file is in with a completed path of this file?? that means: for a file H:\NSC\Test\nsc.ini, with the string "H:\NSC\Test\nsc.ini" How can we return a string like this "H:\NSC\Test\"?? Thank you again!There were 14 posts in this thread before you told US what you wanted. |
|
| 871. |
Solve : I need help appending preexisiting pdf file names with the current month, day? |
|
Answer» Below is the batch created... I tested it, but it seems that if there is a second or third underscore and strings afterwards then the batch leaves those file names alone. If they are PDF files then they will have been RENAMED to: Star - TN 07-11-14 Star - FL 07-11-14 Your filenames have variations so this code REMOVES the text in a different way. This uses a helper batch file called `repl.bat` (by dbenham) - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat Place `repl.bat` in the same folder as the batch file or in a folder that is on the path. Code: [Select]echo off :loop set /P "month=Enter the month to rename the texts ex.(01-12): " set /P "day=Enter the day to rename the texts ex.(01-31): " set /P "year=Enter the year to rename the texts ex.(2013 etc.): " echo( set "var=" set /p var=Is this correct? "%month%-%day%-%year%" Enter N for no or just press enter for yes: if defined var goto :loop dir *_*_*.pdf /b /a-d |repl "(.*)_.*_.*(\....)$" "ren \q$&\q \q$1 %month%-%day%-%year%$2\q" xi >renamepdf.bat call renamepdf.bat del renamepdf.bat echo done pause Great! It works! Thank you so much!!!!! |
|
| 872. |
Solve : Saying HELLO? |
|
Answer» Hello, I am just new in this page, and also in MS_DOS study. My request: could you advise me a good study text or course learning MS_DOS..? echo hello Was just waiting for someone to post that. I almost did, but didnt. The subject title was bait for that. Look at a lot of EXAMPLES and figure out what they do and how they work. Once you get a good grasp on the setup, USE the help command in cmd to get more specific information. And as with learning everything, ask questions.Thanks after all.....similar when I got into word, I would like see and edit text documents, but can not. A lot of wierd signs appear on the screen. Batch cannot edit .doc files, copy the text to a .txt and then edit it. |
|
| 873. |
Solve : VBScript: how to get the value from a function? |
|
Answer» Code: [Select]Dim datapath,filename,x,objFSO,myFile,objFile,strReadFile,outFile,objOutFile This is the start of your script. Try it on your computer. Excuse me? What have you changed??? How should i test, just with the codes you give?? Quote from: mangolzy on July 02, 2014, 06:28:22 AM Excuse me? What have you changed??? How should i test, just with the codes you give?? I changed nothing. It generates an error on my machine, which means your script won't even RUN past those lines.On line 32 tempFilePath is recursing on itself but doing nothing with the result. I suspect the line should be changed to: Code: [Select]tempFilePath = tempFilePath(strpath,keyword) It might also be desirable to have early exits within each if statement (Exit Function) IMMEDIATELY after setting the function result. |
|
| 874. |
Solve : batch file to search different OS on the network? |
|
Answer» Hi, Nmap is short for Network Mapper. It is an open source security tool for network exploration, security scanning and auditing. However, nmap command comes with lots of options that can make the utility more robust and difficult to follow for new users. You will need to look at the documentation to see how to go over network bridges or other things that may prevent cross over into another network on a different branch h of your network tree. Quote It was originally written by Gordon Lyon and it can answer the following questions easily:Does that help? Quote from: Geek-9pm on June 25, 2014, 12:23:11 AM Good. you need a special script. Somebody already did ot. You have to have some kind of permission to get the the computers on the network. Hi, do you think it's possible to connect to these machine on the network, and do some operations on it? i have already the ip adress of these machines so i can login manuelly with a group of username and password..... but for the moment, i have to do it repetetively .. that's why i am looking for the method to do it automatically thx!.You have to go outside of pure DOS. Network administrators use command line programs to get into other computers over the network. To automatic the process requires a set of SCRIPTS suitable to the taks. Such scripts can be extensions of NetBios or can be VBScript or even PowerShell applications. In any case, it is not called DOS. They are high-level programs that run from the command line. Or in Linux, we say from a console. Please read over another definition of a high level network tools http://www.darkreading.com/application-security/10-free-or-low-cost-network-discovery-and-mapping-tools/d/d-id/1141182? Quote One of the most useful adages for security professionals is "know thyself"--and when it comes to network security, the most fundamental task of knowing oneself is network discovery and mapping. Without up-to-date network diagrams and inventory lists, it is hard to even understand what you're protecting. The following tools can aid the process at little to no cost beyond man-hours. You need to learn how to use the high level tools to gather information about your network. I do not have current knowledge about working in a huge network. But I am trying to point you to the kind of tools needed for that kind of work. IMHO your learning Network Mapping Tools is a start in the right direction. Perhaps an IT person who is currently active can help you. EDIT: Had to replace a link.If one of these more learned options doesn't work, you could write a different script that runs on each OS to get the system data and copy it into a text file back to your computer. Then use (I believe it's) robocopy to copy all the files over and run each of them in time. The one that runs will allow you to tell which OS you have.I don't know about the op thing but I do know that you can get the ip through this in a command promt Shutdown i I am not sure of this works with a lot of computers I hope this helps requirement is IP corresponding to OS for around 3000 computers in the network. This is required for audit porpose. To check the no of OS and license. |
|
| 875. |
Solve : Alternative to SET /P on DOS 6.22? |
|
Answer» Hey GUYS, |
|
| 876. |
Solve : Any interest in a new DOS menu program?? |
|
Answer» Is anybody out there interested in a *new* DOS menu program? I'm planning the following features: can't get my mouse to work on dos borland c++ 3I don't UNDERSTAND why he mouse won't work in DOS, provided the drivers installed. From what I saw there, DOS drivers are not 32 bit drivers. So they do not work. That is what I think he said. The thread goes on to show some code in Turbo C that will FIX the problem. I have no idea if it is right. Sounds credible.XTRee Gold is fine for me...and i dont care about icons or color schemes etc... It just works... Quote from: patio on December 25, 2014, 08:34:20 PM XTRee Gold is fine for me...and i dont care about icons or color schemes etc...+1 |
|
| 877. |
Solve : windows run -> command prompt? |
|
Answer» I have a command that I normally run manually in a Windows run (Windows Key + R). It starts the program and everything is fine. "C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.54\deploy\League of Legends.exe" "8394" "LoLLauncher.exe" "" "SPECTATOR 185.40.64.163:80 HePSGcqnkxXliRBtWvn7WuZKxxxspYw9 1680414939 EUW1" I'm trying to make a program that does this for me (c++), cause I’m not sure how to make a windows run in c++ I’m trying to do this through the command prompt. When I enter: Quote start "C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.54\deploy\League of Legends.exe" "8394" "LoLLauncher.exe" "" "spectator 185.40.64.163:80 HePSGcqnkxXliRBtWvn7WuZKxxxspYw9 1680414939 EUW1" I get an ERROR (I translated it): Quote Cannot find the file 8394 Make sure you typed the name correctly, and try again Does anyone see what I’m doing wrong? Or have a better solution.Read Start /?. The first argument is Title Text, so start with a dummy "" parameter. You can use exec() to launch the program directly in C/C++. Quote from: BC_Programmer on September 12, 2014, 03:21:30 AM Read Start /?. The first argument is Title Text, so start with a dummy "" parameter. This is right - just adding that you can put it in a BATCH script. Code: [Select]echo off start "" "C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.54\deploy\League of Legends.exe" "8394" "LoLLauncher.exe" "" "spectator 185.40.64.163:80 HePSGcqnkxXliRBtWvn7WuZKxxxspYw9 1680414939 EUW1" I tried what you suggested Foxidrive. It does open the program, but just for a second and than returns an error. Should I change more things to the command or can I just COPY it from the Windows run box command? I'm not sure what the Windows run dialog exactly does. Quote from: cppeter on September 12, 2014, 05:23:28 AM I tried what you suggested Foxidrive. It does open the program, but just for a second and than returns an error. I don't know what error you saw, but try this in case the working directory needs to be set. Code: [Select]echo off start "" /D "C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.54\deploy" "League of Legends.exe" "8394" "LoLLauncher.exe" "" "spectator 185.40.64.163:80 HePSGcqnkxXliRBtWvn7WuZKxxxspYw9 1680414939 EUW1" It may be intentionally written into the game. It says you aren't suppose to launch the game this way in the Terms of Use. Getting past that, I would leave out the start command. The script will not continue until after league of legends is closed out, but it should run the exact same as it did from run.exe Code: [Select]"C:\Riot Games\League of Legends\RADS\solutions\lol_game_client_sln\releases\0.0.1.54\deploy\League of Legends.exe" "8394" "LoLLauncher.exe" "" "spectator 185.40.64.163:80 HePSGcqnkxXliRBtWvn7WuZKxxxspYw9 1680414939 EUW1" Also, check to make sure that 0.0.1.54 is still the correct directory. They like to change them up every once in a while. If you don't mind me asking, where did you get the "185.40.64.163:80 HePSGcqnkxXliRBtWvn7WuZKxxxspYw9 1680414939 EUW1" information? EDIT: IT also might not be working DUE to riot disabling spectating.I got the command from lolnexus.com. You can also find it on http://quickfind.kassad.in/ Both under the spectate buttons. Thank you Foxidrive, it worked you are my hero!! I was ready to give up and then you came with your brilliant idea. Quote from: cppeter on September 12, 2014, 12:07:54 PM Thank you Foxidrive, it worked Thanks, I'm glad to hear that. I've learned something new just now from your comment - the Run dialog sets the working directory to the path of the executable. I just tested it with some sample files - and this is why your command worked in the Run dialog but failed in the first batch file I posted. If anyone is interested you can create this batch file called one.bat in say c:\test and then in the Run dialog type c:\test\one.bat If you open a cmd prompt in c:\ and execute c:\test\one.bat then you will get one line echoed and errors, but not from the Run dialog. Code: [Select]echo off >"%~dp0\batch2.bat" echo echo batch 2^&pause echo batch 1 call "batch2.bat" del "%~dp0\batch2.bat" |
|
| 878. |
Solve : batch command for different file type? |
|
Answer» Hello |
|
| 879. |
Solve : delete some char on file name? |
|
Answer» Hello |
|
| 880. |
Solve : Reading docx files on MS-DOS? |
|
Answer» Hello everybody! How is possible reading docx files in MS-DOS..? Explain the task further. MS-DOS and plain CMD in Windows has no way of opening encoded files the same way that Word does in MSOffice. You can't read a Word File with a .BAT file but you can with a VBscript but without KNOWING what your intended task is it makes it KIND of HARD to help. http://lmgtfy.com/?q=vbscript+read+word+document |
|
| 881. |
Solve : Why does Ms DOS only use 640k ram?? |
|
Answer» It will not run PROGRAMS because it doesn't have enough memory, PLEASE HELP!!!!!What Programs are you trying to run?Falcon3Is that the max ram you can use? Or can I use more of what I have installed on the machine? Quote from: Extrememan321 on July 15, 2014, 06:26:44 PM Is that the max ram you can use? Or can I use more of what I have installed on the machine? How are you RUNNING it? How are you booting DOS? Do you have any memory managers installed (himem.sys, emm386.exe)? Quote from: BC_Programmer on July 15, 2014, 08:00:10 PM Do you have any memory managers installed (himem.sys, emm386.exe)? As mentioned you need to create high memory, XMS, EMS etc.MS-DOS was created to run on the 8088 CPU in the original IBM PC. The CPU only can address one mega byte. of memory. The upper area of memory was reserved for BIOS and memory mapped video. The design allowed a maximum of 640K of RAM for DOS. Now those limits have little meaning. With the introduction of the Intel 386 chip much larger memory was available. And by the way, the introduction of the 386 was vital to the birth of the Linux system. Quote from: Geek-9pm on July 15, 2014, 09:16:37 PM And by the way, the introduction of the 386 was vital to the birth of the Linux system.Well considering that was the most prominent chip in use at the time I guess you could say it was vital. Quote from: Squashman on July 16, 2014, 06:58:52 AM Well considering that was the most prominent chip in use at the time I guess you could say it was vital.The 286 was a dud. It piratically destroyed Digital Research. Intel changed the design in mid-stream. But The 386 was developed to be areal 32 bit CPU and backward compatible with the original 8086 instruction set. The History of the i386 CPU. It is working now thanksHow ? Quote from: Extrememan321 on July 16, 2014, 09:09:46 AM It is working now thanksQuote from: patio on July 16, 2014, 09:13:46 AM How ?As my Mother likes to say, "The Little Green Men inside fixed it!" Quote from: Extrememan321 on July 16, 2014, 09:09:46 AM It is working now thanks As the guys comment - it would be nice to see your solution as a forum like this is dedicated to provide an answer for a problem, and then OTHERS in the future can get help to similar ISSUES merely by searching. By providing your solution you will repay the forum and the helpers. |
|
| 882. |
Solve : Help needed - batch file that increments a number in a file? |
|
Answer» Hi, |
|
| 883. |
Solve : A beginner question? |
|
Answer» Please, answer this question for a dummy: I can see the different directories in a given POSITION, but once I type cd some directory I get :" the system can not find the specified route"... some time: "the system can not find specified FILE" |
|
| 884. |
Solve : Trim char on file names? |
|
Answer» Hello |
|
| 885. |
Solve : Bat script Delete any File Not Created Today? |
|
Answer» I'm having difficulty removing the time from the date modified date. The date modified displays like so... 07/12/2014 03:27 PM. I tried numerous things but no LUCK any help would be great. |
|
| 886. |
Solve : CALLed Function not returning values? |
|
Answer» I have a FOR LOOP which calls a FUNCTION with passed parameters. The parameters set inside the function is not being returned [see Resultant Output] when I echo var1 / var4 / var5, any ideas how to fix this? |
|
| 887. |
Solve : Insert text to a new last line? |
|
Answer» Hi, Hi, I have almost no idea what you mean, but I think you want the text ">>file.txt %~nG" At the end of the file %G. In that case, you need to escape the first two '>'. To do this simply prefix them with a carrot '^>'.Your problem seems to be that the last line doesn't always have a trailing CF/LF This is a solution to that - test it on some sample .txt files: remove - This is the last line as it's just to help see where it echos Code: [Select]echo off for /f "delims=" %%a in ('dir *.txt /a:-d /b') do ( findstr /v ".*$" "%%a" >nul && (>>"%%a" echo() >>"%%a" echo(%%a - This is the last line )As pointed out, the problem is the last line doesn't always have a trailing CF/LF causing the text (or filename) to be appended to the same line. I tried foxidrive's code, unfortunately it does not work. Also my files are on a network, so want to know if it is POSSIBLE to tweak the below line of code to add a CF/LF FOR %G in (*.fex) do echo FILENAME:%~nG>>%G Thankyou Quote from: atturhari on July 17, 2014, 10:47:08 PM I tried foxidrive's code, unfortunately it does not work. It works fine here. How does it fail for you? Quote from: foxidrive on July 18, 2014, 01:27:21 AM It works fine here. How does it fail for you? Was executing your program in CMD and just realized that i should use a single % instead of %%. Your program does the job perfectly. Thank you very very much Quote from: atturhari on July 18, 2014, 04:06:50 AM Was executing your program in CMD and just realized that i should use a single % instead of %%. You have to be kidding me... Who taught you to paste batch files into a cmd prompt? Quote from: foxidrive on July 17, 2014, 08:19:47 AM Your problem seems to be that the last line doesn't always have a trailing CF/LFQuote from: foxidrive on July 18, 2014, 04:22:58 AM You have to be kidding me... Hmm.. my honest answer, In cmd prompt, the code can be edited quickly and best for trail and error. Running as .bat file is TIME consuming involving multiple steps Quote from: atturhari on July 22, 2014, 05:50:33 AM Hmm.. my honest answer,You should TRY using Notepad++. You can edit and run your batch files within Notepad++. Quote from: atturhari on July 22, 2014, 05:50:33 AM Hmm.. my honest answer,Or you could always just not maximize everything. |
|
| 888. |
Solve : Write Command line to mapped network printer? |
|
Answer» Hello All, |
|
| 889. |
Solve : I need help loading? |
|
Answer» I can save perfectly but I can't load and have the variables CHANGE with it any help I will try. i t just shuts down What, the PC shuts down? Connect your tablet to the computer, and post the whole code. It is most likely be a directory discrepancy. Quote from: shiverbob on June 30, 2014, 02:48:22 PM Thanks Put a pause command as the last line.When I conect to thhe computer it wants me to install mpt and my tablet is a nook How are you running a batch file on a nook? It uses android. I'll work on a adb solution. Where is your file saved on the nook? something like this: Code: [Select]adb pull "%loc%" "%cd%\BatchFile.bat" I am not running the file through a nook I can but I USE a windows xp. It is a hp tower I don't know if that helps So if you are not running the batch file on the nook, but when you run it it doesn't work, and you cannot transfer it off the nook, what is it doing on the nook to begin with? If the file is actually on the hp tower and not the nook, then can't you move it over via flash drive to the computer you are posting from and then post the code?No the tower doesn't have internet this does and the file was never on the nook If it helps it is and hp tower with operating system of window xp home edition And I have no other computer that works right now I am in the middle of building one I am posting from the nook I tried the code and it says envirment VARIBLE not set? You aren't overriding %path% are you? If not, check to make sure that C:\windows\system32 is somewhere in that. It should be easy to do with Code: [Select]echo %path% | find "system32" if something shows up, you have it in there.I just TOOK away echo off and it says what it is supposed to say This weekend I will try UPDATING it to vista and see if that helps It is all saved to my desktop and I have know idea why its not working. It work on my friends computer and his was a windows 7 I will upload the code tomorrow I am going to be out of town |
|
| 890. |
Solve : Robocopy GUI download source? |
|
Answer» Hello, |
|
| 891. |
Solve : Create batch file to insert text into multiple txt files?? |
|
Answer» Hi All!! |
|
| 892. |
Solve : Move end of line marker in every line to a specific column? |
|
Answer» Hello, |
|
| 893. |
Solve : rename images in specified directory? |
|
Answer» Hi, |
|
| 894. |
Solve : repl help? |
|
Answer» So I started to really use repl, and It's made quite a few of my scripts run infinitely smoother. I'm running into some issues though. I'm attempting to gather Lat / Long coordinates from a .kml file (looks quite a lot like html to me). The issue that I've run into is that all the data in the kml is on the first line. to correct this, I was trying to use repl to add new line characters at specific places to allow me to gather the necessary information using a for loop. But for some reason, repl is erroring when I try. Both 'type "Cars French 1.kml" | repl "(</.*?>)" "$1\n" xi >file.txt' and 'type "Cars French 1.kml" | repl "<address>" "\n<address>" xi >file.txt' returned files, but did not add the newline character. Yes, they do, but they don't add a CR and LF as I assumed you had a reason for using \n alone. Change \n to \r\n and it will use normal Windows line endings. Look at the output files in Winhex and you will see the 0A which is the \n character. 0A is the DEFAULT line ending character for Unix/Linux, and Windows uses 0D 0A as the line ending characters, a Carriage Return and then a Line feed. The 0D is added by the \r in repl. In an Apple system the line ending is just a 0D or it used to be. The 0D 0A is hexadecimal notation for anyone not sure, and is shown as 13 10 in decimal ascii.Thanks, I didn't know that. |
|
| 895. |
Solve : batch file coding help? |
|
Answer» Hi im not too familiar with coding in .bat files just in general i havent done coding in a long time not since my school days. Anyways ive GOT a batch file running that basically hosts a dedicated server for a game i play at the time being and since the games is still being developed theres some things that havent been put in yet. Ive got it to work in my own coding but just wondering if i can increase the volume ? Bewdy. The volume depends on your current volume setting and I don't have a script to set a specific volume level. oh ok thanks my systems volumes at max but the windows sound is still fairly quiet for the pop up meh its cool but again many many thanks Quote from: razorpanda on July 28, 2014, 09:30:35 AM oh ok thanks my systems volumes at max but the windows sound is still fairly quiet for the pop up meh its cool but again many many thanks Try a different sound file - some are recorded at lower level - and you can normalize the sound file with the free Audacity. OTOH are your computer sounds normally low in volume? Quote from: foxidrive on July 28, 2014, 09:45:28 AM Try a different sound file - some are recorded at lower level - and you can normalize the sound file with the free Audacity. yea had a seperate sound file i USED much louder Nope my computer sounds are always at 100% max and i can FREELY change it with my speakers as my mic doesnt pick up my speakers so i dont bother with a headset just now that i have it all working its fantastic and the help was great. Just wondering now if im able to inject some messages into the program it starts up which i heard it was done or someone was able to send messages from the CMD to the game so that all players in the dedicated server was able to see the message so i think thats my next step but no idea how >.< |
|
| 896. |
Solve : Fix WMI remotely with list of hostnames? |
|
Answer» I am trying to create a script that will scan through a list of hostnames, do an NSLOOKUP to confirm if hostname is bad or GOOD. if good then copy the WMIfix to remote pc, and go run it on each machine's cmd. |
|
| 897. |
Solve : Combination Ping, NSLOOKUP and echo from txt file script? |
|
Answer» I am trying to ping a list of machines, do an nslookup on the ip addresses, then if hostname is same as original hostname, read from another txt file to output possible location of hostname. thank you for the reply. Looks perfect. If you are getting 1700 processes running then you have a loop that is neverending - quite possibly because you called your batch file nslookup or you have another problem in your code. Post it here as you have changed it for PEOPLE to look at. File is called hh.bat and i run it in cmd like hh.bat host.bat. everything works fine without the nslookup part. once nslookup lines are active and uncommented and the script hits it, processes goes up from 390, 1700 or even 3500 sometimes. Code: [Select]echo off if '%1'=='' GOTO Syntax echo Running Script and Saving Results to Results.CSV echo. echo Script Run %date% %time% >> Results.csv for /F %%i in (%1) do Call :StartPing %%i goto :EOF :StartPing PING %1 -n 1| FIND /i "TTL" > nul && goto Success PING %1 -n 1| FIND /i "timed" > nul && goto Timedout PING %1 -n 1 -w 400 | FIND /i "TTL" > nul || goto ErrorMsg :Success for /F "tokens=3" %%a in ('ping %1 ^| find /i "TTL"') do set Address=%%a for /F "tokens=2" %%a in ('ping -a %Address::=% ^| find /i "pinging"') do set HostName=%%a set IPAddress=%Address::=% echo %1, %IPAddress%,%Hostname% pause for /f "tokens=2" %%a in ('nslookup %IPAddress% ^| find /i "Name: " ') do set "nsNAME=%%a" echo "%nsname%" pause :: Get Location of machine cls :: replace tokens=3 with delims= to get the whole line for /f "usebackq tokens=3" %%a in ("home.txt") do ( echo "%%a" ) pause echo %1, %IPAddress%,%Hostname% >> Results.csv goto :EOF :Timedout Echo %1, Request timed out. Echo %1, Request timed out. >> Results.csv :ErrorMsg Echo %1, Ping request could not find host. Echo %1, Ping request could not find host. >> Results.csv goto :EOF :Syntax echo . . . goto :EOF :EOF echo this is the END OF FILE There is a system command called hh so pick another name, but that isn't the issue. Do you have a set of computer names in host.bat or IP addresses? When using IP addresses it works, but using computer names it fails because the ping command doesn't include "TTL=" even though it is successful - which is a new behaviour on me. Tested with the localhost in Windows 8.1 and it uses IPV6 in the ping SCREEN display. Your code is missing a goto :EOF here and there and FWIW the :EOF label is internal to CMD and isn't needed in the batch script. TRY this code - using a simple home.txt file with Code: [Select]a b reading c d file and in your hosts.bat just include a few computer names, and try it with a few IP addresses as a test too. Show us what it displays on the console if it still misbehaves. Make sure there are no ping.bat or nslookup.bat in the current directory or on the path. I didn't notice a problem with extra processes. Code: [Select]echo off if "%~1"=="" GOTO Syntax echo Running Script and Saving Results to Results.CSV echo. echo Script Run %date% %time% >> Results.csv for /F %%i in (%1) do Call :StartPing %%i goto :EOF :StartPing PING %1 -n 1| FIND /i "TTL" > nul && goto Success PING %1 -n 1| FIND /i "timed" > nul && goto Timedout PING %1 -n 1 -w 400 | FIND /i "TTL" > nul || goto ErrorMsg goto :EOF :Success for /F "tokens=3" %%a in ('ping %1 ^| find /i "TTL"') do set Address=%%a for /F "tokens=2" %%a in ('ping -a %Address::=% ^| find /i "pinging"') do set HostName=%%a set IPAddress=%Address::=% echo %1, %IPAddress%,%Hostname% for /f "tokens=2" %%a in ('nslookup %IPAddress% ^| find /i "Name: " ') do set "nsNAME=%%a" echo "%nsname%" :: Get Location of machine :: cls :: replace tokens=3 with delims= to get the whole line for /f "usebackq tokens=3" %%a in ("home.txt") do ( echo "%%a" ) echo %1, %IPAddress%,%Hostname% >> Results.csv goto :EOF :Timedout Echo %1, Request timed out. Echo %1, Request timed out. >> Results.csv goto :EOF :ErrorMsg Echo %1, Ping request could not find host. Echo %1, Ping request could not find host. >> Results.csv goto :EOF :Syntax echo . . . goto :EOF Interesting. Thank you for the feedback and updates. will test in the morning once i am back at the office again. i'll rename the main hh script to something very random. and apologies, there isn't any host.bat, it should have been host.txt... hh.bat -> to be renamed to qwe.bat = contains main script host.txt -> just a list of computer names home.txt -> ip addresses - office location (eg. 172.16.1.55 - Reception) Quote from: foxidrive on July 30, 2014, 02:10:27 AM Excellent! script is working like a charm. can now even put a if state to tell me if hostname is bad or good, as well as location. Just excellent stuff! Thanks a million!one other issue I have picked up is when the script reaches the get location part... Code: [Select]for /f "usebackq tokens=3" %%a in ("home.txt") do ( echo Your machine is located at "%%a" ) cls echo "%%a" it echos out every line in the home.txt, instead of only looking for the specified IP address in home.txt and echo only the location home.txt looks like this... Code: [Select]172.16.4.15 - Reception 172.16.5.155 - Server Room It should only echo either the entire line where it finds the IP or only the Reception or Server Room part. any suggestions on this?Instead of this: Code: [Select]:: Get Location of machine :: cls :: replace tokens=3 with delims= to get the whole line for /f "usebackq tokens=3" %%a in ("home.txt") do ( echo "%%a" ) Try this: (untested) Code: [Select]:: Get Location of machine :: cls findstr /b/e "%~1" "home.txt" Thank you for the reply. i have added your suggested code as suggested, but how do i echo from that findstr command? or how can i put the result of findstr in some variable?It already echos it to the console, and you can get the information into a log file like this, if that is what you want to do. Code: [Select]findstr /b/e "%~1" "home.txt" >>"file.log"when i put it just as is then my command line tells me FINDSTR: // ignored that could be because i have 2 hostnames in host.txt. however, when removing 1 hostname from host.txt it does not echo anything out.Test it with the extra lines below and tell me what was echoed when the error appears on the screen. It seems like the %~1 term has slashes in it. Code: [Select]echo "%~1" findstr /b/e "%~1" "home.txt" >>"file.log" pause it only echos out the hostname found in host.txt Code: [Select]Computer1, 172.16.4.115,computer1.localdomain.net HOSTNAME is GOOD "Computer1" FINDSTR: // ignored Press any key to continue . . . |
|
| 898. |
Solve : batch file to give the output of programs and features with name, version detail? |
|
Answer» Hi , So i just need the logic, to capture the output of appwiz.cpl/ program filesCan't be done with batch. Quote from: Aditi gupta on August 06, 2014, 09:55:20 PM To run this batch file baground, i will call batch via VB script.Then why didn't you search GOOGLE for a Vbscript solution. Here is what I found. http://www.vbsedit.com/scripts/apps/user/scr_226.asp |
|
| 899. |
Solve : I need a turn system? |
|
Answer» With my saving problem fix. I need a turn system for my game that I am in the middle of and it needs a turn system for it work. Any help I will try |
|
| 900. |
Solve : A batch based profile manager GUI? |
|
Answer» Hello all I have decided to BRUSH up on my batch skills a bit and do something new to make me think a bit; so im just gonna share the experience with you guys as I go about it. Although im already a quarter of the way done (mabey) |
|