Jump to content

sam240

Member
  • Posts

    14
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United States

Everything posted by sam240

  1. Well I was able to figure it out on my own. In case someone needs it. I created a batch file and added it to Local C:\support\fix.bat (I created a support folder) To only run once, open regedit goto HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce Create a new string and name it whatever you like and in DATA field, add the path to the batch file which in my case is C:\support\fix.bat and that worked like a charm. It automatically gets removed from registry after it runs so it does not run over and over again. @echo off SET FLAG=%TEMP%\Flag.txt IF EXIST %FLAG% GOTO END reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit /t REG_SZ /d "C:\Windows\system32\userinit.exe," /t > %FLAG% :END
  2. I'm trying to figure out what is the best way to run this reg on computers just once after log on. The problem is my imaged computers popup "Library" window every time a user logs into windows and this registry below fixes it. I have this in a batch file but how can I run it only once on the machine after logon? I know I can use Task Scheduler but Task Scheduler doesn't give me the option to run it only once and same with group policy. reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v Userinit /t REG_SZ /d "C:\Windows\system32\userinit.exe," /t I appreciate your help.
  3. Hello, This may be very simple but for some reason it's not working for me so I thought I come here for help. I'm running windows 7 64-bit and all I would like to do is run 3 batch scripts which install a software. I have 4 batch files named, 1.bat, 2.bat, 3.bat, 4.bat I use bat 1 to run the other 3 batch files which install programs as some suggested to use CALL method but it does not work on windows 7. 1.bat currently reads (PAUSE is so I can read the errors) Call 2.bat PAUSE Call 3.bat PAUSE CALL 4.bat PAUSE When I run 1.bat, I get the following errors C:\Windows>Call 2.bat '2.bat' is not recognized as an internal or external command, operable program or batch file. C:\Windows>PAUSE Press any key to continue . . . C:\Windows>Call 3.bat '3.bat' is not recognized as an internal or external command, operable program or batch file. C:\Windows>PAUSE Press any key to continue . . . C:\Windows>CALL 4.bat '4.bat' is not recognized as an internal or external command, operable program or batch file. C:\Windows>PAUSE Press any key to continue . . . what command can I use to execute these batch files probably one at a time. Any help will be appreciated. Thank you
  4. Well then that 1 did it. I never used that variable before. It always worked without it but I'm guess because of the script, it requires it.
  5. Well that did it. I also changed the %today% to %Today% not sure if that matters since Set Today has capital T.
  6. As jaclaz mentioned I just had to remove "%" from front of delims. This seems to work but now but I think it's not recognizing %today% from the imagex line. I get the following msg from imagex
  7. I did that very first and that's when I got the error. So I then I thought to replace it with jaclaz and still had the issue. I'm going to try it now and see if it works.
  8. change to FOR /F "tokens=2 %delims==" %%A IN ('FIND "TheLast"^<i:\lenovo\domain\blank\last.ini') DO SET Today=%%AWhen I used the SET Today= FOR /F "tokens=2 %delims==" %A IN ('TYPE i:\lenovo\domain\blank\last.ini ^| FIND "TheLast"') DO SET Today=%%A IF NOT DEFINED Today ECHO ERROR...&PAUSE imagex /apply i:\lenovo\domain\blank\%today%\image.wim I got an error which says " the syntax of the command is incorrect". This is exactly what my script is like. Upto diskpart /s diskpartscript2.txt it works fine right after the cls, it gives me the syntax of the command is incorrect error. I tried both jaclaz's and Yzowl's I was able to capture the image and it created an last.ini in this directory i:\lenovo\base\blank\last.ini and also created a folder with the image.wim inside the folder with date.
  9. change to FOR /F "tokens=2 %delims==" %%A IN ('FIND "TheLast"^<i:\lenovo\domain\blank\last.ini') DO SET Today=%%Aand IF NOT EXIST i:\lenovo\base\blank\%Today%\ MD i:\lenovo\base\blank\%Today%>i:\lenovo\base\blank\last.ini ECHO;TheLast=%Today% You guys are freaking genius! This made my life so much easier. Thank you so much jaclaz for the last.ini idea and thanks yzowl for tweaking it and also thank you MHZ for tweaking it. I did try jaclaz's script and that worked I haven't tried MHZ's script yet. I'll give it show tomorrow and get back to you. Each image takes a little time to capture so testing takes a while for each script.
  10. Not really-really. I mean there are several possibilities, one being that the batch (the one that creates the image in the %today% folder) also creates a hard link (I presume that you are using NTFS) in the main directory or, possibly even better/easier as hardlinks are a bit more difficult to manage, use a softlink (to the file) or a junction point from the %today% directory to a "fixed" place, let's say i:\lenovo\base\blank\last\ http://ss64.com/nt/mklink.html http://schinagl.priv.at/nt/hardlinkshellext/linkshellextension.html The poor man's way (or on non NTFS) would be to have the "imaging batch" write a simple plain text file, let's say last_to_be_deployed.ini and have the "deploy batch" to parse it and get the actual value of the %today%, i.e. the folder name from which to get the image, or you could get rid of the subdirectories have all the images in i:\lenovo\base\blank\ and assign a meaningful name to the images themselves, like naming the actual image to %today%.img and have the deploying batch use last created one (which would be another advantage as you wouldn't have a zillion of files all named "image.img" and only differentiated - besides creation timestamp - only by the name of the folder in which they are). There are endless possibilities. jaclaz Thank you for your help. this is what my script looks like for deploying "imagex /apply i:\lenovo\domain\blank\image.wim" and to be really honest, I have no expierence in scripting which is why I'm here. I tried your script above and it worked beautifully. It created a folder with today's date and create the new image in it.
  11. I like the idea, The only problem with this is that I have another batch file which deploys the captured image and that script pulls from the main folder such as i:\lenovo\base\blank\image.wim so say now the new image is in %Today% folder, I'll have to manually edit the script each time or copy and paste the image outside of the %Today% folder.
  12. Thank you! I'll give this a try. I don't mind just moving the file instead. What command should I use for moving instead of xcopy? Also I forgot to mention, I do not no nothing about programing or batch script lol I just do this for fun and to make my life easier at work.
  13. Hello Could someone please help me fix this batch script below. I would really apperciate your help. We use imagex from microsoft for our imaging. This batch script copies captures the image I prepare which works fine. The 3 steps that don't work are "REM" lines in the script. First REM should use the name as the current date Second REM should copy the previous image.wim file to an archive folder before deleting Third REM should delete the image. The way it works right now is the new image.wim file just gets overwritten on the previous image.wim and the script doesn't copy the previous image.wim file into the achrive folder before overwritting. Achrive is required just in case we need to go back to the old image. This is a windows 7 image. Please let me know if you need any additional information. echo off Title Capturing Laptop Base Image REM SET date="%date:~10,4%-%date:~4,2%-%date:~7,2%" REM START /wait xcopy i:\lenovo\base\blank\image.wim i:\lenovo\base\blank\archive\%date%\ REM START /wait del i:\lenovo\base\blank\image.wim cls imagex /compress fast /capture D: i:\lenovo\base\blank\image.wim "Laptop Base Image" /verify PAUSE exit
×
×
  • Create New...