Search Results

Search found 25663 results on 1027 pages for 'script programmer'.

Page 4/1027 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Give the path to the inserted USB key to a script

    - by Xavier Nodet
    I'd like to run a given Perl script whenever I connect my camera to my PC, so that this script will download all the photos on it. But as the drive letter for the camera may change depending on what's already connected, I need to pass this drive letter as an argument to the script. Is this doable? Thanks. PS: if this is not possible, an answer to this other question would be very helpful.

    Read the article

  • Script execution flow stopped?

    - by vijay.shad
    Hi all, Now my script is able to start server, But I am still have some problem with my script. When the start server command is executed, the control does not pass the line and does not execute further of that line. Please tell me what is the problem and how can I get smooth execution of the my script.

    Read the article

  • cannot unset env variables from script

    - by w00t
    Hi, I am trying to unset all environment variables from within a script. The script runs fine but if I run env it still shows all the variables set. If I run the command from CLI, it works and the variables are unset. unset `env | awk -F= '/^\w/ {print $1}' | xargs` Have any idea how to run this from a script? Also, have any idea how to source /etc/profile from a script? This doesn't work either. I need to set variables with same names but different paths, depending on the instances my users need.

    Read the article

  • Script _name_ for this shop?

    - by Michael
    Those two web shops are using same script I guess. http://www.ipmart.com and http://www.gsm-traders.com anybody knows what kind of script they are using? Or at least recommend some script similar to this?

    Read the article

  • javax script how to call a function in JavaScript from Java

    - by Dan Howard
    Hi All, I'm trying to call a function in JavaScript via Java. This works fine when directly reading a script as a string but I'm using CompiledScripts. When I do this with a compiled script it gives me method not found if I also add bindings. Without bindings it works but of course the function fails because it needs the bindings. Any ideas? CompiledScript script = ... get script.... Bindings bindings = script.getEngine().createBindings(); Logger scriptLogger = LogManager.getLogger("TEST_SCRIPT"); bindings.put("log", scriptLogger); //script.eval(bindings); -- this way fails script.eval(); // -- this way works Invocable invocable = (Invocable) script.getEngine(); invocable.invokeFunction(methodName); TIA

    Read the article

  • exim redirect mail to a script

    - by DevilWAH
    I am looking to set up a mail relay so that any mail sent to for example @example.com gets parsed be a PHP script. I know to do this for indervidual address I could do some thing like (from the following web site http://evolt.org/incoming_mail_and_php) Con figure an Aliases such as script: |/our/script.php then any emails sent to [email protected] will be passed to the script given.. but how can I make it that every email to @example.com is passed to the script? thank you

    Read the article

  • run script as another user from a root script with no tty stdin

    - by viktor tron
    Using CentOs, I want to run a script as user 'training' as a system service. I use daemontools to monitor the process, which needs a launcher script that is run as root and has no tty standard in. Below I give my four different attempts which all fail. : #!/bin/bash exec >> /var/log/training_service.log 2>&1 setuidgid training training_command This last line is not good enough since for training_command, we need environment for trqaining user to be set. : su - training -c 'training_command' This looks like it (http://serverfault.com/questions/44400/run-a-shell-script-as-a-different-user) but gives 'standard in must be tty' as su making sure tty is present to potentially accept password. I know I could make this disappear by modifying /etc/sudoers (a la http://superuser.com/questions/119376/bash-su-script-giving-an-error-standard-in-must-be-a-tty) but i am reluctant and unsure of consequences. : runuser - training -c 'training_command' This one gives runuser: cannot set groups: Connection refused. I found no sense or resolution to this error. : ssh -p100 training@localhost 'source $HOME/.bashrc; training_command' This one is more of a joke to show desparation. Even this one fails with Host key verification failed. (the host key IS in known_hosts, etc). Note: all of 2,3,4 work as they should if I run the wrapper script from a root shell. problems only occur if the system service monitor (daemontools) launches it (no tty terminal I guess). I am stuck. Is this something so hard to achieve? I appreciate all insight and guidance to best practice. (this has also been posted on superuser: http://superuser.com/questions/434235/script-calling-script-as-other-user)

    Read the article

  • Difference between coder and programmer in common examples, rules

    - by MInner
    Real definition is a kind of definition based on out-of-subjects axioms, rules. (Subjective, I know.) It's easy to speak about 'difference ..' with person, who's in programming. But usually it's quite hard to show difference to the person who have never used to write program. How do you think - which examples, analogies, logical chains are best for showing this kind of difference. The only example, which comes to mind is - economist (coder) and mathematician (programmer). How do you feel about it?

    Read the article

  • I wanted to be a programmer

    - by Henrik P. Hessel
    Hello, let me ask your opinion. I'm 25 now, living in Germany. I started with QBASIC, did some Java in Highschool, and after School I created some Websites in PHP. Now, because my Company is Microsoft Gold Partner, I've to use Microsoft all the time. C#, MSSQL, ASPX and Sharepoint <- I really hate it! So, in my spare I concentrate to gain more knowledge (C++, Java, Silverlight or WPF), because it feels that I'm so far behind, in comparison for example to you guys, or other older employees in my company. Do think that my behaviour is useful? Should I focus my time to become i.e. a pure C# Programmer? I did C# even before I started to learn some C++. Should I learn what do with pointers, memcpy and stuff like that, even if managed code brings us so much benefits? Or is it a waste of time, better invested in learning the latest technologies? rAyt

    Read the article

  • I need to run a PHP script via command line but this happens.

    - by user355367
    I need to run a scrip via command line but the files necessary for me to run it require me to be in the directory of the script. But I cannot do it for every command line i need to run. Their are over five thousand. Could someone tell me how to either format the list easily or add something to the format that would make it run. I have something like this.... php /path/to/the/script/01240/script.php php /path/to/the/script/03770/script.php php /path/to/the/script/02110/script.php php /path/to/the/script/02380/script.php php /path/to/the/script/03220/script.php php /path/to/the/script/02340/script.php php /path/to/the/script/03720/script.php php /path/to/the/script/03460/script.php php /path/to/the/script/0180/script.php php /path/to/the/script/02000/script.php php /path/to/the/script/01830/script.php php /path/to/the/script/0980/script.php php /path/to/the/script/0400/script.php php /path/to/the/script/02750/script.php php /path/to/the/script/0760/script.php php /path/to/the/script/02690/script.php ..... and it goes on for 5000 more lines.

    Read the article

  • Convert wife/husband/partner to a programmer.

    - by Stefan
    originally posted by Stefan: How many of you have had the thought of educate your partner and invite him/her to the beautiful world of programming? I once started to give my wife lessons twice a week, It was a competition between me and another programmer, we thought it would be nice to have our wives understand why we work as programmers and also have it as a hobby sitting all night long. Maybe we could get our wives to feel the power too? After a couple of months my wife didn't like the idea any more, it was too hard to understand she thought, same for my friends wife. So now we are thinking of some project that would be too fun for our wives to turn down just to get the spirit up again. It would be nice to hand over a project to my wife, "Can you debug this for me, please? There are some strange error on module xxx." :) Maybe I'm crazy, what do you think?

    Read the article

  • Pay for Graphic Designer vs Programmer

    - by FrankSinatra
    In a corporate web-design setup, who typically makes more per hour, the graphic designer or the programmer? By graphic designer, I mean somebody who builds mockups probably in photoshop, selects font-styles, colors, etc. Most things layout-wise are near pixel-perfect, but likely after the initial implementation by the programmer, there will be a lot of small changes directed by the graphic designer. By programmer, I mean somebody who is coding the CSS, the HTML, and light backend support, probably in PHP. The programmer will attempt to duplicate the mockups given the limitations of the medium, and consult with the graphic designer afterwards on what changes are tangible and which are not. Both probably have an undergraduate degree from a respected four-year institution.

    Read the article

  • "A good programmer can be as 10+ times more productive as a mediocre one"

    - by m3th0dman
    I had read an interview with a great programmer (it is not in English) and in it he said that "a great programmer can be as 100 times as good as a mediocre one" giving reason for why good programmers are very well paid and why programming companies give many facilities for their employees. The idea was that there is a very large demand for good programmers, because of the above reason and that's why companies pay very much to bring them. Do you agree with this statement? Do you know any objective facts that could support it? Edit: The question has nothing to do with experience; if you talk about one great programmer with 1 year experience then s/he should be 10 times more productive than a mediocre programmer with 1 year experience. I agree that from certain experience years onwards, things start to dissipate but that's not the purpose of the question.

    Read the article

  • How do I make the correct career decision in regards to product manager/QA vs programmer?

    - by Adel
    I'm curious about how to approach the issue of whether I should focus on programming or on QA/testing/product management. I know that the latter seems like a broad category( if so, think of it as "general IT support" for now). At the moment I'm stronger in QA/prod. mgt ; however I'd like to switch more to programming, and I see I may have this opportunity. Wouldn't it be easier to switch to QA/prod. mgt in the future, if I go into programming now; rather than trying the reverse-order(i.e. if I decided later to go into coding.. say around mid-30s then it'd likely be harder). Just looking for any advice or tips about how to see more clearly. Part of me is scared I can't handle the programming side, but part of me says since there's demand and I'm interested that it's still worth a shot.

    Read the article

  • "A good programmer can be as 10+ times more productive than a mediocre one"

    - by m3th0dman
    I had read an interview with a great programmer (it is not in English) and in it he said that "a great programmer can be as 100 times as good as a mediocre one" giving reason for why good programmers are very well paid and why programming companies give many facilities for their employees. The idea was that there is a very large demand for good programmers, because of the above reason and that's why companies pay very much to bring them. Do you agree with this statement? Do you know any objective facts that could support it? Edit: The question has nothing to do with experience; if you talk about one great programmer with 1 year experience then s/he should be 10 times more productive than a mediocre programmer with 1 year experience. I agree that from certain experience years onwards, things start to dissipate but that's not the purpose of the question.

    Read the article

  • What are your experiences as a programmer?

    - by jenf
    I haven't finished school yet and plan on studying Informatics and searching a job as a programmer. However I don't know any real programmers and so I don't have a real source for information on how their job actually is. I apologize if this question is subjective but I think that it is an important one to ask. What do you actually program (with)? Do you generally work with one programming language or more? Do you like working with it/them? Do you like your job? Is it kind of a hobby and a job at once?

    Read the article

  • How does a programmer without a degree gain experience? [on hold]

    - by user96872
    Having a few years of experience is a must for many programming jobs nowadays. If one does not have a college degree but would like to get some experience with programming (with some prior knowledge, say, in JavaScript, PHP and Python), what are some ways to gain the experience that employers seek? I know about personal projects, but how about team experience and everything that goes along with it? Would I need to volunteer somewhere?

    Read the article

  • Subscript out of range error in VBScript script

    - by user3912
    I'm trying to move my entire User folder in Windows Vista to a non-system partition. To do so with a minimum hassle I'm following the directions provided at Ben's Blog, specifically the VBScript he provides. However executing the script throws up an error which I can't resolve myself. Here's the VBScript code followed by the text file it works from, and finally my error message. How do I correct the problem? VBScript Code: '# Perform dir /a c:\users > c:\dir.txt '# place this script file in c:\ too '# double click to run it '# run resulting script.bat from recovery mode repprefix = " Directory of..." ' Modify to your language sourcedrive = "C:\" targetdrive = "D:\" altsourcedrive = "C:\" 'leave same as target drive unless otherwise indicated alttargetdrive = "E:\" 'leave same as target drive unless otherwise indicated inname = "dir.txt" outname = "script.bat" userroot = "Users" set fso = CreateObject("Scripting.FileSystemObject") ' construct batch commands for saving rights, then link, the recreating rights Function GetCommand(curroot, line, typ, keyword) ' first need to get source and target pos = Instr(line, keyword) + Len(keyword) tuple = Trim(Mid(line, pos)) arr = Split(tuple, "[") oldtarget = Replace(arr(1), "]", "") oldlink = curroot & "\" & Trim(arr(0)) ' need to determine if we are pointing back to old disk newlink = replace(oldlink, sourcedrive, targetdrive) if(Instr(oldtarget, sourcedrive & userroot)) then newtarget = Replace(oldtarget, sourcedrive, targetdrive) else newtarget = oldtarget ' still pointing to original target end if ' comment out = "echo " & newlink & " --- " & newtarget & vbCrLf ' save permissions out = out & "icacls """ & replace(oldlink, sourcedrive, altsourcedrive) & """ /L /save " & altsourcedrive & "permissions.txt" & vbCrLf ' create link newlink = replace(newlink, targetdrive, alttargetdrive) if typ = "junction" then out = out & "mklink /j """ & newlink & """ """ & newtarget & """" & vbCrLf else ' typ = "symlink" out = out & "mklink /d """ & newlink & """ """ & newtarget & """" & vbCrLf end if 'set hidden attribute out = out & "attrib +h """ & newlink & """ /L" & vbCrLf ' apply permissions shortlink = Left(newlink, InstrRev(newlink, "\") - 1) 'icacls works strangely - non-orthogonal for restore out = out & "icacls """ & shortlink & """ /L /restore " & altsourcedrive & "permissions.txt" & vbCrLf GetCommand = out & vbCrLf End Function Sub WriteToFile(file, text) ForWriting = 2 Create = true set outfile = fso.OpenTextFile(file, ForWriting, Create) Call outfile.Write(text) Call outfile.Close() End Sub outtext = "ROBOCOPY " & altsourcedrive & userroot & " " & alttargetdrive & userroot & " /E /COPYALL /XJ" & vbCrLf & vbCrLf set intext = fso.OpenTextFile(inname) while not intext.AtEndOfStream line = intext.ReadLine() if Instr(line, repprefix) then curroot = Replace(line, repprefix, "") elseif Instr(line, juncname) then outtext = outtext & GetCommand(curroot, line, "junction", juncname) elseif Instr(line, linkname) then outtext = outtext & GetCommand(curroot, line, "symlink", linkname) end if Wend outtext = outtext & "icacls " & altsourcedrive & userroot & " /L /save " & altsourcedrive & "permissions.txt" & vbCrLf outtext = outtext & "ren " & altsourcedrive & userroot & " _" & userroot & vbCrLf outtext = outtext & "mklink /j " & altsourcedrive & userroot & " " & targetdrive & userroot & vbCrLf outtext = outtext & "icacls " & altsourcedrive & " /L /restore " & altsourcedrive & "permissions.txt" Call intext.Close() Call WriteToFile(outname, outtext) MsgBox("Done writing to " & outname) dir.txt: Volume in drive C is ACER Volume Serial Number is 08D7-C0CC Directory of c:\users 07/16/2009 12:29 PM {DIR} . 07/16/2009 12:29 PM {DIR} .. 11/02/2006 09:02 AM {SYMLINKD} All Users [C:\ProgramData] 11/02/2006 09:02 AM {DIR} Default 11/02/2006 09:02 AM {JUNCTION} Default User [C:\Users\Default] 08/21/2008 08:37 AM 174 desktop.ini 11/02/2006 08:50 AM {DIR} Public 07/19/2009 08:54 PM {DIR} Steve 1 File(s) 174 bytes 7 Dir(s) 5,679,947,776 bytes free Error Message: Windows Script Host Script: C:\user location.vbs Line: 25 Char: 2 Error: Subscript out of range: '[number: 1]' Code: 800A0009 Source: Microsoft VBScript runtime error (In the VBScript script that I'm using on my system, I believe that 'Line 25' corresponds to the line beginning with oldtarget = Replace(arr(1), "]", "").

    Read the article

  • Subscript out of range error in VBScript script

    - by SteveW
    I'm trying to move my entire User folder in Windows Vista to a non-system partition. To do so with a minimum hassle I'm following the directions provided at Ben's Blog, specifically the VBScript he provides. However executing the script throws up an error which I can't resolve myself. Here's the VBScript code followed by the text file it works from, and finally my error message. How do I correct the problem? VBScript Code: '# Perform dir /a c:\users > c:\dir.txt '# place this script file in c:\ too '# double click to run it '# run resulting script.bat from recovery mode repprefix = " Directory of..." ' Modify to your language sourcedrive = "C:\" targetdrive = "D:\" altsourcedrive = "C:\" 'leave same as target drive unless otherwise indicated alttargetdrive = "E:\" 'leave same as target drive unless otherwise indicated inname = "dir.txt" outname = "script.bat" userroot = "Users" set fso = CreateObject("Scripting.FileSystemObject") ' construct batch commands for saving rights, then link, the recreating rights Function GetCommand(curroot, line, typ, keyword) ' first need to get source and target pos = Instr(line, keyword) + Len(keyword) tuple = Trim(Mid(line, pos)) arr = Split(tuple, "[") oldtarget = Replace(arr(1), "]", "") oldlink = curroot & "\" & Trim(arr(0)) ' need to determine if we are pointing back to old disk newlink = replace(oldlink, sourcedrive, targetdrive) if(Instr(oldtarget, sourcedrive & userroot)) then newtarget = Replace(oldtarget, sourcedrive, targetdrive) else newtarget = oldtarget ' still pointing to original target end if ' comment out = "echo " & newlink & " --- " & newtarget & vbCrLf ' save permissions out = out & "icacls """ & replace(oldlink, sourcedrive, altsourcedrive) & """ /L /save " & altsourcedrive & "permissions.txt" & vbCrLf ' create link newlink = replace(newlink, targetdrive, alttargetdrive) if typ = "junction" then out = out & "mklink /j """ & newlink & """ """ & newtarget & """" & vbCrLf else ' typ = "symlink" out = out & "mklink /d """ & newlink & """ """ & newtarget & """" & vbCrLf end if 'set hidden attribute out = out & "attrib +h """ & newlink & """ /L" & vbCrLf ' apply permissions shortlink = Left(newlink, InstrRev(newlink, "\") - 1) 'icacls works strangely - non-orthogonal for restore out = out & "icacls """ & shortlink & """ /L /restore " & altsourcedrive & "permissions.txt" & vbCrLf GetCommand = out & vbCrLf End Function Sub WriteToFile(file, text) ForWriting = 2 Create = true set outfile = fso.OpenTextFile(file, ForWriting, Create) Call outfile.Write(text) Call outfile.Close() End Sub outtext = "ROBOCOPY " & altsourcedrive & userroot & " " & alttargetdrive & userroot & " /E /COPYALL /XJ" & vbCrLf & vbCrLf set intext = fso.OpenTextFile(inname) while not intext.AtEndOfStream line = intext.ReadLine() if Instr(line, repprefix) then curroot = Replace(line, repprefix, "") elseif Instr(line, juncname) then outtext = outtext & GetCommand(curroot, line, "junction", juncname) elseif Instr(line, linkname) then outtext = outtext & GetCommand(curroot, line, "symlink", linkname) end if Wend outtext = outtext & "icacls " & altsourcedrive & userroot & " /L /save " & altsourcedrive & "permissions.txt" & vbCrLf outtext = outtext & "ren " & altsourcedrive & userroot & " _" & userroot & vbCrLf outtext = outtext & "mklink /j " & altsourcedrive & userroot & " " & targetdrive & userroot & vbCrLf outtext = outtext & "icacls " & altsourcedrive & " /L /restore " & altsourcedrive & "permissions.txt" Call intext.Close() Call WriteToFile(outname, outtext) MsgBox("Done writing to " & outname) dir.txt: Volume in drive C is ACER Volume Serial Number is 08D7-C0CC Directory of c:\users 07/16/2009 12:29 PM {DIR} . 07/16/2009 12:29 PM {DIR} .. 11/02/2006 09:02 AM {SYMLINKD} All Users [C:\ProgramData] 11/02/2006 09:02 AM {DIR} Default 11/02/2006 09:02 AM {JUNCTION} Default User [C:\Users\Default] 08/21/2008 08:37 AM 174 desktop.ini 11/02/2006 08:50 AM {DIR} Public 07/19/2009 08:54 PM {DIR} Steve 1 File(s) 174 bytes 7 Dir(s) 5,679,947,776 bytes free Error Message: Windows Script Host Script: C:\user location.vbs Line: 25 Char: 2 Error: Subscript out of range: '[number: 1]' Code: 800A0009 Source: Microsoft VBScript runtime error (In the VBScript script that I'm using on my system, I believe that 'Line 25' corresponds to the line beginning with oldtarget = Replace(arr(1), "]", "").

    Read the article

  • Part 14: Execute a PowerShell script

    In the series the following parts have been published Part 1: Introduction Part 2: Add arguments and variables Part 3: Use more complex arguments Part 4: Create your own activity Part 5: Increase AssemblyVersion Part 6: Use custom type for an argument Part 7: How is the custom assembly found Part 8: Send information to the build log Part 9: Impersonate activities (run under other credentials) Part 10: Include Version Number in the Build Number Part 11: Speed up opening my build process template Part 12: How to debug my custom activities Part 13: Get control over the Build Output Part 14: Execute a PowerShell script Part 15: Fail a build based on the exit code of a console application With PowerShell you can add powerful scripting to your build to for example execute a deployment. If you want more information on PowerShell, please refer to http://technet.microsoft.com/en-us/library/aa973757.aspx For this example we will create a simple PowerShell script that prints “Hello world!”. To create the script, create a new text file and name it “HelloWorld.ps1”. Add to the contents of the script: Write-Host “Hello World!” To test the script do the following: Open the command prompt To run the script you must change the execution policy. To do this execute in the command prompt: powershell set-executionpolicy remotesigned Now go to the directory where you have saved the PowerShell script Execute the following command powershell .\HelloWorld.ps1 In this example I use a relative path, but when the path to the PowerShell script contains spaces, you need to change the syntax to powershell "& '<full path to script>' " for example: powershell "& ‘C:\sources\Build Customization\SolutionToBuild\PowerShell Scripts\HellloWorld.ps1’ " In this blog post, I create a new solution and that solution includes also this PowerShell script. I want to create an argument on the Build Process Template that holds the path to the PowerShell script. In the Build Process Template I will add an InvokeProcess activity to execute the PowerShell command. This InvokeProcess activity needs the location of the script as an argument for the PowerShell command. Since you don’t know the full path at the build server of this script, you can either specify in the argument the relative path of the script, but it is hard to find out what the relative path is. I prefer to specify the location of the script in source control and then convert that server path to a local path. To do this conversion you can use the ConvertWorkspaceItem activity. So to complete the task, open the Build Process Template CustomTemplate.xaml that we created in earlier parts, follow the following steps Add a new argument called “DeploymentScript” and set the appropriate settings in the metadata. See Part 2: Add arguments and variables  for more information. Scroll down beneath the TryCatch activity called “Try Compile, Test, and Associate Changesets and Work Items” Add a new If activity and set the condition to "Not String.IsNullOrEmpty(DeploymentScript)" to ensure it will only run when the argument is passed. Add in the Then branch of the If activity a new Sequence activity and rename it to “Start deployment” Click on the activity and add a new variable called DeploymentScriptFilename (scoped to the “Start deployment” Sequence Add a ConvertWorkspaceItem activity on the “Start deployment” Sequence Add a InvokeProcess activity beneath the ConvertWorkspaceItem activity in the “Start deployment” Sequence Click on the ConvertWorkspaceItem activity and change the properties DisplayName = Convert deployment script filename Input = DeploymentScript Result = DeploymentScriptFilename Workspace = Workspace Click on the InvokeProcess activity and change the properties Arguments = String.Format(" ""& '{0}' "" ", DeploymentScriptFilename) DisplayName = Execute deployment script FileName = "PowerShell" To see results from the powershell command drop a WriteBuildMessage activity on the "Handle Standard Output" and pass the stdOutput variable to the Message property. Do the same for a WriteBuildError activity on the "Handle Error Output" To publish it, check in the Build Process Template This leads to the following result We now go to the build definition that depends on the template and set the path of the deployment script to the server path to the HelloWorld.ps1. (If you want to see the result of the PowerShell script, change the Logging verbosity to Detailed or Diagnostic). Save and run the build. A lot of the deployment scripts you have will have some kind of arguments (like username / password or environment variables) that you want to define in the Build Definition. To make the PowerShell configurable, you can follow the following steps. Create a new script and give it the name "HelloWho.ps1". In the contents of the file add the following lines: param (         $person     ) $message = [System.String]::Format(“Hello {0}!", $person) Write-Host $message When you now run the script on the command prompt, you will see the following So lets change the Build Process Template to accept one parameter for the deployment script. You can of course make it configurable to add a for-loop that reads through a collection of parameters but that is out of scope of this blog post. Add a new Argument called DeploymentScriptParameter In the InvokeProcess activity where the PowerShell command is executed, modify the Arguments property to String.Format(" ""& '{0}' '{1}' "" ", DeploymentScriptFilename, DeploymentScriptParameter) Check in the Build Process Template Now modify the build definition and set the Parameter of the deployment to any value and run the build. You can download the full solution at BuildProcess.zip. It will include the sources of every part and will continue to evolve.

    Read the article

  • Using Diskpart in a PowerShell script won't allow script to reuse drive letter

    - by Kyle
    I built a script that mounts (attach) a VHD using Diskpart, cleans out some system files and then unmounts (detach) it. It uses a foreach loop and is suppose to clean multiple VHD using the same drive letter. However, after the 1st VHD it fails. I also noticed that when I try to manually attach a VHD with diskpart, diskpart succeeds, the Disk Manager shows the disk with the correct drive letter, but within the same PoSH instance I can not connect (set-location) to that drive. If I do a manual diskpart when I 1st open PoSH I can attach and detach all I want and I get the drive letter every time. Is there something I need to do to reset diskpart in the script? Here's a snippet of the script I'm using. function Mount-VHD { [CmdletBinding()] param ( [Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$false)] [string]$Path, [Parameter(Position=1,Mandatory=$false,ValueFromPipeline=$false)] [string]$DL, [string]$DiskpartScript = "$env:SystemDrive\DiskpartScript.txt", [switch]$Rescan ) begin { function InvokeDiskpart { Diskpart.exe /s $DiskpartScript } ## Validate Operating System Version ## if (Get-WmiObject win32_OperatingSystem -Filter "Version < '6.1'") {throw "The script operation requires at least Windows 7 or Windows Server 2008 R2."} } process{ ## Diskpart Script Content ## Here-String statement purposefully not indented ## @" $(if ($Rescan) {'Rescan'}) Select VDisk File="$Path" `nAttach VDisk Exit "@ | Out-File -FilePath $DiskpartScript -Encoding ASCII -Force InvokeDiskpart Start-Sleep -Seconds 3 @" Select VDisk File="$Path"`nSelect partition 1 `nAssign Letter="$DL" Exit "@ | Out-File -FilePath $DiskpartScript -Encoding ASCII -Force InvokeDiskpart } end { Remove-Item -Path $DiskpartScript -Force ; "" Write-Host "The VHD ""$Path"" has been successfully mounted." ; "" } } function Dismount-VHD { [CmdletBinding()] param ( [Parameter(Position=0,Mandatory=$true,ValueFromPipeline=$false)] [string]$Path, [switch]$Remove, [switch]$NoConfirm, [string]$DiskpartScript = "$env:SystemDrive\DiskpartScript.txt", [switch]$Rescan ) begin { function InvokeDiskpart { Diskpart.exe /s $DiskpartScript } function RemoveVHD { switch ($NoConfirm) { $false { ## Prompt for confirmation to delete the VHD file ## "" ; Write-Warning "Are you sure you want to delete the file ""$Path""?" $Prompt = Read-Host "Type ""YES"" to continue or anything else to break" if ($Prompt -ceq 'YES') { Remove-Item -Path $Path -Force "" ; Write-Host "VHD ""$Path"" deleted!" ; "" } else { "" ; Write-Host "Script terminated without deleting the VHD file." ; "" } } $true { ## Confirmation prompt suppressed ## Remove-Item -Path $Path -Force "" ; Write-Host "VHD ""$Path"" deleted!" ; "" } } } ## Validate Operating System Version ## if (Get-WmiObject win32_OperatingSystem -Filter "Version < '6.1'") {throw "The script operation requires at least Windows 7 or Windows Server 2008 R2."} } process{ ## DiskPart Script Content ## Here-String statement purposefully not indented ## @" $(if ($Rescan) {'Rescan'}) Select VDisk File="$Path"`nDetach VDisk Exit "@ | Out-File -FilePath $DiskpartScript -Encoding ASCII -Force InvokeDiskpart Start-Sleep -Seconds 10 } end { if ($Remove) {RemoveVHD} Remove-Item -Path $DiskpartScript -Force ; "" } }

    Read the article

  • Silent application installation script

    - by Achu
    I use the following script to install application from the server: ECHO OFF IF EXIST "C:\SCRIPTS\drvsw01.cmd" GOTO :L1 C: LABEL System_Drive CD\ MD SCRIPTS COPY U:\Scripts\*.* C:\SCRIPTS\ install.exe -i silent -DLICENSE_ACCEPTED=true -f response_file ECHO "SCRIPTS FOLDER INSTALLATION SUCCESSFUL" :L1 ECHO "JAVA INSTALLATION" U:\Softwares\Java_Run_Time\jre-6u26-windows-i586.exe ECHO "JAVA INSTALLATION SUCCESSFUL" ECHO "OFFICE SOFTWARE INSTALLATION" ECHO "MS OFFICE INSTALLATION" U:\Softwares\Office_2007\setup.exe ECHO "MS-OFFICE INSTALLATION SUCCESSFUL" U:\Softwares\SaveAsPDFandXPS.exe ECHO "MS-OFFICE PDF%XPS Add in INSTALLATION SUCCESSFUL" ECHO "NETWORK SCAN GEAR INSTALLATION" U:\Softwares\ScanGear\english\DISK1\setup.exe ECHO "NETWORK SCAN GEAR INSTALLATION SUCCESSFUL" ECHO "7ZIP INSTALLATION" U:\Softwares\7ZIP\7z457.EXE E CHO "7ZIP INSTALLATION SUCCESSFUL" ECHO "IFAN VIEW INSTALLATION" U:\Softwares\IrfanView_4.5\iview425_setup.exe ECHO "IFAN VIEW INSTALLATION SUCCESSFUL" U:\Softwares\IrfanView\irfanview_plugins_425_setup.exe ECHO "IFAN VIEW PLUGINS INSTALLATION SUCCESSFUL" U:\Softwares\Firefox4\Firefox4.exe ECHO "FIREFOX INSTALLATION SUCCESSFUL" ECHO "FIREFOX PLUGIN INSTALLATION" U:\Softwares\Flash_Player_10\install_flash_player.EXE U:\Softwares\Flash_Player_10\install_flash_player_10_active_x.exe ECHO "FIREFOX INSTALLATION SUCCESSFUL" ECHO "ACROBAT READER 10 INSTALLATION" U:\Softwares\Adobe_Acrobat_Reader_10\AdbeRdr10.exe ECHO "ACROBAT 10 Installation SuccESSFUL" ECHO "INSTALLATION CD burner WINDOWS XP" U:\Softwares\CDburnerxpsetup.exe ECHO "Installation of CD burner Successful" ECHO "INSTALLATION IE8 for WINDOWS XP" U:\SOFTWARE\IE8\IE8-WindowsXP-x86-ENU.exe ECHO "INSTALLATION IE8 SUCCESSFUL" ECHO "THE USER ACCOUNT WOULD BE DELETED" NET USER USER /DELETE ECHO "USER ACCOUNT DELETE SUCCESSFUL" echo %ERRORLEVEL% Now, i want to make this script installing everything silently except MS-Office. Ms-Office b/c i have to customize installing only word, excel & powerpoint. How can i make this script silent? or are there a nice script for this? Thanks,

    Read the article

  • Script errors when run by launchd at startup, but not when run in Terminal

    - by Mechcozmo
    Hello. I'm attempting to create a RAM disk that loads the previous contents when the system starts up, and every six hours writes the contents to a disk image. Currently, when you run the script from the terminal ("sudo bash LogToRAM.sh") everything works fine. But when run from launchd during startup, it doesn't work. Here's the lines from the log; the first line just gives some idea as to where in the boot process we are: SecurityAgent[202] Showing Login Window com.mechcozmo.LogToRAM[51] + /Developer/usr/bin/SetFile -a V /Volumes/LogfileRAMdisk com.mechcozmo.LogToRAM[51] ERROR: File Not Found. (-43) on file: /Volumes/LogfileRAMdisk com.mechcozmo.LogToRAM[51] + /usr/sbin/asr -source '/Library/Application Support/LogToRAM/RAMdisk_store.dmg' -target /Volumes/LogfileRAMdisk/ -noverify Here is the script and plist file in question. Note that 'set -vx' is up at the top of the script; it give a lot of information about what is happening in the script. My current theory is that the /Volumes directory does not exist at this stage of the boot process, but that seems unlikely to be honest.

    Read the article

  • <script> Tag cannot be self closed?

    - by Joe Hopfgartner
    I had this code in my Website <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"/> <script type='text/javascript' src='/lib/player/swfobject.js'></script> swfobject was not working (not loaded). After altering the code to: <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script> <script type='text/javascript' src='/lib/player/swfobject.js'></script> It worked fine. The document was parsed as HTML5. I think its funny. Okay, granted a tag that is closed and a self closing tag are not the same. So i would understand if jquery couldnt load. Altough i find it rediciulous. But what i do not understand is that jquery loads but the following, correctly written tag, doesnt?

    Read the article

  • Linux Bash Script, Single Command But Multiple Lines?

    - by Jay LaCroix
    I have the following script I wrote by searching Google, and it backs up my Linux system to an archive: #!/bin/bash # init DATE=$(date +20%y%m%d) tar -cvpzf /share/Recovery/Snapshots/$HOSTNAME_$DATE.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev --exclude=/share/Archive / This works, but I am wondering if I can format the script to show the command over multiple lines, something like this, so it is easy to edit later: tar -cvpzf /share/Recovery/Snapshots/$HOSTNAME_$DATE.tar.gz --exclude=/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt --exclude=/media --exclude=/dev --exclude=/share/Archive / That way it is easier to read and edit later. Is it possible to format a Bash script this way?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >