copying file from UNC path to startup folder on Windows 7 machines
I have sucessfully figured out how to copy a file to "machinenameC$ProgramDataMicrosoftWindowsStart MenuProgramsstartup" however I want to run this as part of an existing startup batchfile. I would like it to be able to find out if the file already exists and if so, ignore it. I'll admit I am a total noob at this and I know there is some sort of paramater or switch that would do this. can anyone assist?
script is:
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
I would like it to say
IF "File.txt" exists in "CProgramDataMicrosoftWindowsStart MenuProgramsStartup"
Then ignore.
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
windows-7 boot cmd.exe
add a comment |
I have sucessfully figured out how to copy a file to "machinenameC$ProgramDataMicrosoftWindowsStart MenuProgramsstartup" however I want to run this as part of an existing startup batchfile. I would like it to be able to find out if the file already exists and if so, ignore it. I'll admit I am a total noob at this and I know there is some sort of paramater or switch that would do this. can anyone assist?
script is:
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
I would like it to say
IF "File.txt" exists in "CProgramDataMicrosoftWindowsStart MenuProgramsStartup"
Then ignore.
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
windows-7 boot cmd.exe
add a comment |
I have sucessfully figured out how to copy a file to "machinenameC$ProgramDataMicrosoftWindowsStart MenuProgramsstartup" however I want to run this as part of an existing startup batchfile. I would like it to be able to find out if the file already exists and if so, ignore it. I'll admit I am a total noob at this and I know there is some sort of paramater or switch that would do this. can anyone assist?
script is:
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
I would like it to say
IF "File.txt" exists in "CProgramDataMicrosoftWindowsStart MenuProgramsStartup"
Then ignore.
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
windows-7 boot cmd.exe
I have sucessfully figured out how to copy a file to "machinenameC$ProgramDataMicrosoftWindowsStart MenuProgramsstartup" however I want to run this as part of an existing startup batchfile. I would like it to be able to find out if the file already exists and if so, ignore it. I'll admit I am a total noob at this and I know there is some sort of paramater or switch that would do this. can anyone assist?
script is:
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
I would like it to say
IF "File.txt" exists in "CProgramDataMicrosoftWindowsStart MenuProgramsStartup"
Then ignore.
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartup"
windows-7 boot cmd.exe
windows-7 boot cmd.exe
edited Dec 4 '14 at 11:51
Der Hochstapler
68.2k50230286
68.2k50230286
asked Jul 22 '14 at 14:11
LaurenceLaurence
11
11
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Here you go replace copy file cmmand with your copy command
Edit replace PATHFILE with the destination you are checking.
if NOT EXISTS PATHFILE ( copy file command here )
Thanks for assistance, I tried this but it fell over with this error: CProgramDataMicrosoftWindowsStart was unexpected at this time. looks like it does not like the space between Start menu, any ideas? So this is my command: if NOT EXISTS CProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt (copy "\serverpathfile.txt" "CProgramDataMicrosoftWindowsStart Menuprogramsstartup)
– Laurence
Jul 22 '14 at 14:54
try putting quotes around the path in the if statement? for example "C:ProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt"
– redrage
Jul 22 '14 at 15:13
@Laurence The actual syntax isif [not] exist <some command here>. Notice there's no ending "S".
– and31415
Jul 22 '14 at 16:59
whoops my bad.. yeah no S :-)
– redrage
Jul 22 '14 at 17:00
add a comment |
if exist "C:ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt" (
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt"
)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f786400%2fcopying-file-from-unc-path-to-startup-folder-on-windows-7-machines%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here you go replace copy file cmmand with your copy command
Edit replace PATHFILE with the destination you are checking.
if NOT EXISTS PATHFILE ( copy file command here )
Thanks for assistance, I tried this but it fell over with this error: CProgramDataMicrosoftWindowsStart was unexpected at this time. looks like it does not like the space between Start menu, any ideas? So this is my command: if NOT EXISTS CProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt (copy "\serverpathfile.txt" "CProgramDataMicrosoftWindowsStart Menuprogramsstartup)
– Laurence
Jul 22 '14 at 14:54
try putting quotes around the path in the if statement? for example "C:ProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt"
– redrage
Jul 22 '14 at 15:13
@Laurence The actual syntax isif [not] exist <some command here>. Notice there's no ending "S".
– and31415
Jul 22 '14 at 16:59
whoops my bad.. yeah no S :-)
– redrage
Jul 22 '14 at 17:00
add a comment |
Here you go replace copy file cmmand with your copy command
Edit replace PATHFILE with the destination you are checking.
if NOT EXISTS PATHFILE ( copy file command here )
Thanks for assistance, I tried this but it fell over with this error: CProgramDataMicrosoftWindowsStart was unexpected at this time. looks like it does not like the space between Start menu, any ideas? So this is my command: if NOT EXISTS CProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt (copy "\serverpathfile.txt" "CProgramDataMicrosoftWindowsStart Menuprogramsstartup)
– Laurence
Jul 22 '14 at 14:54
try putting quotes around the path in the if statement? for example "C:ProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt"
– redrage
Jul 22 '14 at 15:13
@Laurence The actual syntax isif [not] exist <some command here>. Notice there's no ending "S".
– and31415
Jul 22 '14 at 16:59
whoops my bad.. yeah no S :-)
– redrage
Jul 22 '14 at 17:00
add a comment |
Here you go replace copy file cmmand with your copy command
Edit replace PATHFILE with the destination you are checking.
if NOT EXISTS PATHFILE ( copy file command here )
Here you go replace copy file cmmand with your copy command
Edit replace PATHFILE with the destination you are checking.
if NOT EXISTS PATHFILE ( copy file command here )
answered Jul 22 '14 at 14:22
redrageredrage
211
211
Thanks for assistance, I tried this but it fell over with this error: CProgramDataMicrosoftWindowsStart was unexpected at this time. looks like it does not like the space between Start menu, any ideas? So this is my command: if NOT EXISTS CProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt (copy "\serverpathfile.txt" "CProgramDataMicrosoftWindowsStart Menuprogramsstartup)
– Laurence
Jul 22 '14 at 14:54
try putting quotes around the path in the if statement? for example "C:ProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt"
– redrage
Jul 22 '14 at 15:13
@Laurence The actual syntax isif [not] exist <some command here>. Notice there's no ending "S".
– and31415
Jul 22 '14 at 16:59
whoops my bad.. yeah no S :-)
– redrage
Jul 22 '14 at 17:00
add a comment |
Thanks for assistance, I tried this but it fell over with this error: CProgramDataMicrosoftWindowsStart was unexpected at this time. looks like it does not like the space between Start menu, any ideas? So this is my command: if NOT EXISTS CProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt (copy "\serverpathfile.txt" "CProgramDataMicrosoftWindowsStart Menuprogramsstartup)
– Laurence
Jul 22 '14 at 14:54
try putting quotes around the path in the if statement? for example "C:ProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt"
– redrage
Jul 22 '14 at 15:13
@Laurence The actual syntax isif [not] exist <some command here>. Notice there's no ending "S".
– and31415
Jul 22 '14 at 16:59
whoops my bad.. yeah no S :-)
– redrage
Jul 22 '14 at 17:00
Thanks for assistance, I tried this but it fell over with this error: CProgramDataMicrosoftWindowsStart was unexpected at this time. looks like it does not like the space between Start menu, any ideas? So this is my command: if NOT EXISTS CProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt (copy "\serverpathfile.txt" "CProgramDataMicrosoftWindowsStart Menuprogramsstartup)
– Laurence
Jul 22 '14 at 14:54
Thanks for assistance, I tried this but it fell over with this error: CProgramDataMicrosoftWindowsStart was unexpected at this time. looks like it does not like the space between Start menu, any ideas? So this is my command: if NOT EXISTS CProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt (copy "\serverpathfile.txt" "CProgramDataMicrosoftWindowsStart Menuprogramsstartup)
– Laurence
Jul 22 '14 at 14:54
try putting quotes around the path in the if statement? for example "C:ProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt"
– redrage
Jul 22 '14 at 15:13
try putting quotes around the path in the if statement? for example "C:ProgramDataMicrosoftWindowsStart menuprogramsstartupfile.txt"
– redrage
Jul 22 '14 at 15:13
@Laurence The actual syntax is
if [not] exist <some command here>. Notice there's no ending "S".– and31415
Jul 22 '14 at 16:59
@Laurence The actual syntax is
if [not] exist <some command here>. Notice there's no ending "S".– and31415
Jul 22 '14 at 16:59
whoops my bad.. yeah no S :-)
– redrage
Jul 22 '14 at 17:00
whoops my bad.. yeah no S :-)
– redrage
Jul 22 '14 at 17:00
add a comment |
if exist "C:ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt" (
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt"
)
add a comment |
if exist "C:ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt" (
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt"
)
add a comment |
if exist "C:ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt" (
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt"
)
if exist "C:ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt" (
copy "\serversharefile.txt" "\MachineNameC$ProgramDataMicrosoftWindowsStart MenuProgramsStartupfile.txt"
)
edited Jul 22 '14 at 15:39
answered Jul 22 '14 at 15:11
Marc05Marc05
271129
271129
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f786400%2fcopying-file-from-unc-path-to-startup-folder-on-windows-7-machines%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown