zeta_immersion Posted April 3, 2016 Share Posted April 3, 2016 Global $SourceDir = @WindowsDir & '\Pictures\' Global $TargetDir = 'C:\Temp' Run(@ComSpec & ' /k xcopy /y /c' & $SourceDir & $TargetDir , "", @SW_MAXIMIZE) Why can I not use $SourceDir as a variable in the @ComSpec ? Link to comment Share on other sites More sharing options...
InunoTaishou Posted April 3, 2016 Share Posted April 3, 2016 Quote C:\WINDOWS\system32\cmd.exe /k xcopy /y /cC:\WINDOWS\Pictures\C:\Temp Because your string turns into that. no space after /c, no space after Pictures\. So the exact switch is /cC:\Windows\Pictures\C:\Temp. I don't know of any switch like that. Link to comment Share on other sites More sharing options...
zeta_immersion Posted April 3, 2016 Author Share Posted April 3, 2016 wired - my mistake in missing the space the reason I made the post was for someone to confirm I declared the macro function properly and I have used it in the Run command the right way. Previously the error I received was variable $SourceDir used before being declared Link to comment Share on other sites More sharing options...
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