Jump to content

Yzöwl

Patron
  • Posts

    4,113
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

Everything posted by Yzöwl

  1. I still don't get why it is a requirement! After you've imported the reg settings, unless you actually change the location of %windir%, then having the data contain the variable serves no purpose, (especially since it is only for data to be read/executed once only at login.). Another thing you may like to look into if you are still insistent upon this pointless exercise is to import the registry data including variable as REG_SZ and see if the variable is read appropriately when read/invoked within the system.
  2. It enables extended error reporting.
  3. Here's another example for testing, it has been included because the jaclaz version will not actually expand the variables to the console for viewing. @ECHO OFF & SETLOCAL SET "Prefix=2F16-" FOR /L %%A IN (1,1,32) DO CALL :SUB 10%%A ENDLOCAL & GOTO :EOF :SUB SET "Num=%1" ECHO ON ECHO=IF /I "%COMPUTERNAME%"=="%Prefix%%Num:~-2%" REGEDIT /s myreg%Num:~-2%.reg @ECHO OFF An actual working version would look a little like this: @ECHO OFF & SETLOCAL SET "Prefix=2F16-" FOR /L %%A IN (1,1,32) DO CALL :SUB 10%%A ENDLOCAL & GOTO :EOF :SUB SET "Num=%1" IF /I "%COMPUTERNAME%"=="%Prefix%%Num:~-2%" REGEDIT /s myreg%Num:~-2%.reg
  4. I use PDF-Xchange Viewer, as my reader. I think you'll be pleasantly surprised with it.
  5. The line you had was sending the letter y to a file with a name starting cacls. The one I gave was simply my interpretation of what I thought you meant to do which was to send a y as a response to the cacls command. In real terms I'm not aware of a reason why cacls would wait for a Y | N response so you should be able to start the line at cacls You would also have to ensure that users.txt existed %Pfad% was defined, (Probably %USERPROFILE%\..), and of course that the %USERNAME% from users.txt actually existed.
  6. I would think that the most likely problem is with your installation inf file. Likely problems:You cannot use a network path for /f The network location specified in /f cannot be found. There is an error generated from the inf file. As far as the batch file goes, I'd personally prefer to see you keep everything in there instead of using a reg file merge, and possibly if using WMIC, sticking with it instead of using NET.EXE as well, e.g: @ECHO OFF REM Delete old printers except for Microsofts XPS Document Printer WMIC PRINTER WHERE "PortName <> 'XPSPort:'" DELETE REM Stop printer spooler if started WMIC SERVICE WHERE "Name='Spooler' AND State='Running'" CALL StopService REM Registry data changes SETLOCAL SET "KEY=HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports" REM Delete old registry data REM REG DELETE "%KEY%" /VA /F REM Add new registry data REG ADD "%KEY%" /VE /F REG ADD "%KEY%" /V COM1: /D "9600,n,8,1" /F REG ADD "%KEY%" /V COM2: /D "9600,n,8,1" /F REG ADD "%KEY%" /V COM3: /D "9600,n,8,1" /F REG ADD "%KEY%" /V COM4: /D "9600,n,8,1" /F REG ADD "%KEY%" /V FILE: /F REG ADD "%KEY%" /V LPT1: /F REG ADD "%KEY%" /V LPT2: /F REG ADD "%KEY%" /V LPT3: /F REG ADD "%KEY%" /V Ne00: /F REG ADD "%KEY%" /V Ne01: /F REG ADD "%KEY%" /V Ne02: /F REG ADD "%KEY%" /V Ne03: /F REG ADD "%KEY%" /V \\juniorfs\JSchoolFL1 /F REG ADD "%KEY%" /V \\juniorfs\JSchoolVillach /F ENDLOCAL REM Start printer spooler WMIC SERVICE WHERE "Name='Spooler'" CALL StartService PAUSE...
  7. I'd like to highlight two things to you Andy. Please make sure that you make yourself aware of the Forum Rules, (particularly Rule 1.a) Taking note of the red text in the information box at the top of the WindowsXP Forum, would have also been prudent on this occasion. Topic Moved!
  8. Why do you feel that registry value data of type REG_EXPAND_SZ is necessary?
  9. I would suggest because of this! Without the "echo y >" part the command works just fine inside the ELSE. Has anyone an idea why this is the case and knows a solution? I'm assuming your fix would be to replace the echo y > with echo y |
  10. I remember in the distant past, a topic for batches/infs for 'right click - create ISO' it also had option(s) for data and boot ISOs.
  11. It doesn't even require a title, (just the quotes for one): START "" /wait "%TEMP%\RD\UPDATE\UPDATE.EXE" /q /n /z In fact it's very likely that you dont even need to use start at all! "%TEMP%\RD\UPDATE\UPDATE.EXE" /q /n /z
  12. Correct, but as I intimated earlier, keeping to a short/single command is not necessarily better/faster!
  13. It works fine on all of my operating systems!Try the following exactly as is, (as a verification check): @ECHO OFF & SETLOCAL ENABLEEXTENSIONS FOR /F "TOKENS=*" %%# IN ('IPCONFIG /ALL^|FIND "DHCP Server"') DO ( SET "DHCPSERVER=%%#" & CALL SET "DHCPSERVER=%%DHCPSERVER:*: =%%") ECHO=[%DHCPSERVER%] PING -n 6 127.0.0.1 1>NUL
  14. Yes you could also forget the counting too! FOR /F "TOKENS=*" %%# IN ('IPCONFIG /ALL^|FIND "DHCP Server"') DO SET "DHCPSERVER=%%#" & CALL SET "DHCPSERVER=%%DHCPSERVER:*: =%%"
  15. Just as long as you are aware that shorter scripts are not necessarily quicker/less resource intensive. BTW on Win2k, XP and Vista, in a console window the code you've chosen, which can be shortened as I had earlier, pre-edit, to delims=cdehprsv: ", uses "tokens=14, not 15. The results are not guaranteed to work in a manner I'd accept as safe for general use since there are 'hidden' characters in the ipconfig /all output.
  16. @jaclaz I think that number would be 15 @patronu, I would suggest that you forget about trying to make short or single line scripts and try one of these ideas: @Echo off & SetLocal EnableExtensions For /F "tokens=2 delims=:" %%# In ('IPConfig /all^|Find "DHCP Server"') Do ( Call :Addy %%#) Pause & Goto :Eof :Addy Set DHCPServer=%1 Echo=[%DHCPServer%] @Echo off & SetLocal EnableExtensions For /F "tokens=2 delims=:" %%# In ('IPConfig /all^|Find "DHCP Server"') Do ( For %%$ In (%%#) Do Set DHCPServer=%%$) Echo=[%DHCPServer%] Pause
  17. It seems like a problem caused by the OS I used, I've narrowed it down to be more specific and ran it on a Win2k system. Please see my previous edited post!
  18. Still you're not looking at the problem correctly, as stated by jaclaz and myself, the assigned dynamic address can have a differing number of characters. You can of course try something different with your for loop if you are trying to capture all the numbers and dots which make up the assigned address but without any whitespace. Try this: @Echo off For /F "tokens=14 delims=cdehprsv: " %%# In ( 'IPConfig /all^|Find "DHCP Server"') Do Set "_=%%#" Echo=net use x: \\%_%\testMake sure that the delims ends with <colon><tab><space>.
  19. It still isn't necessary to use such variable expansion techniques, just do it the other way around!FOR %%# IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( IF EXIST %%#:\install_usb.txt SET drive_path=%%#:\) ECHO=software_path=%drive_path%software\ For your additional question, let me just ask two things Why don't you want to capture all of the non-whitespace characters? How do you know that the DHCP Server will contain that specific number of characters?
  20. You've already set up the environment you need, just set the additional varaible within it! FOR %%# IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO ( IF EXIST %%#:\install_usb.txt ( SET drive_path=%%#:\ SET software_path=%%#:\software\))
  21. This works perfectly for me! shortcut /f:"%userprofile%\Start\Programs\Command Lines\Append.lnk" /a:c /t:"%systemroot%\system32\cmd.exe" /p:"/k append /?"
  22. The error message you were receiving was because the intended shortcut location does not exist!\Command Lines vs \Command Line The example you've given is also wrong! On my current Vista PC, the following would do as you require shortcut /f:"%userprofile%\Start\Programs\Command Lines\Ping.lnk" /a:c /t:"%systemroot%\system32\cmd.exe" /p:"/k ping"However using the Syntax suggested in the ReadMe.txt file you'd need this: shortcut /f:"%userprofile%\Start\Programs\Command Lines\Ping.lnk" /a:c /t:"^%systemroot^%\system32\cmd.exe" /p:"/k ping"Depending upon how you invoke the command and you particular system you may need to choose either one of the two!
  23. With this: What is happening? Or I must use another system? The first error example is because you are using the wrong parameters. You are asking the application to create, (/a:c), a shortcut but have not provided it with a target for that shortcut, (/t:). The second example returns to one of your previous posts. You are asking for a shortcut to be created inside a location which does not exist, (\Command Lines).You need to firstly 'make the directory' for the location of that shortcut.
  24. In my provided .inf file it is shown as a quoted string under infotip.If you're still talking about using OptimumX's shortcut.exe did you look at the syntax/parameter list provided in the ReadMe.txt and try: /D:description : Defines the description (or comment) for the shortcut.
×
×
  • Create New...