Viper999 Posted August 15, 2005 Posted August 15, 2005 Goodmorning. I am having trouble assining the result of a funtion to a variable in a batch file. I am using compname.exe to generate a computername(compname.exe /d ?s) I want to assign this to a variable so it can be used with sysprep and the UserData section. Here is what I haveSet strComputername = compname.exe /d ?secho Computername ="%strComputername%" > sysprep2.infLater the sysprep2.inf will be combined using the copy command, but I need this problem resolved. Thanks in advance for any help you provide it is greatly appreciated.
Gogol Posted August 15, 2005 Posted August 15, 2005 You can use ...set "cmd=compname /d ?s"for /f "Tokens=1*" %%a in ('%CMD%') do set strComputername=%%aecho Computername ="%strComputername%" > sysprep2.infHTH
Viper999 Posted August 15, 2005 Author Posted August 15, 2005 That worked like a champ ... Do you have a guide or book you can direct me to so I can understand exactly what you are doing ? I appreciate your help...Thanks,
Gogol Posted August 15, 2005 Posted August 15, 2005 To start, "type for /?" at promptSome exemples here ...http://users.telenet.be/mydotcom/howto/scr...scripts.htm#forBatch Function Libraryhttp://www.commandline.co.uk/lib/treeview/index.phpFinaly ... good reference for cooking scriptshttp://www.jsifaq.com/reghack.htmHTH
Thinkster Posted August 16, 2005 Posted August 16, 2005 Take a look at my thread as it sound similar to what you want to do...Customized Sysprep
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now