cmd

Password is being used as a command

馋奶兔 提交于 2021-01-03 06:54:30
问题 I'm trying to run a command from a python file: p = subprocess.Popen("mysqldump -h" + hostname + " -u" + mysql_user + " --password=" + mysql_pw + " " + db + " > dump_" + hostname + "_" + timestamp + ".sql", shell=True) But the --password= and even -p keep getting hanged up on my password string The password is similar to this structure: Z@F&sfeafxegwa the command line error: 'sfeafxegwa' is not recognized as an internal or external command, operable program or batch file. 回答1: As already

Batch file choice command more than 10 parameter

筅森魡賤 提交于 2021-01-01 13:54:04
问题 I have a batch script which founds which drive is carrying my folder (diskpart situation) and founding folder, then it lists the text files (for now its text) in that folder. Anyways the problem is while the batch is asking me to choose which one do i want to open, it works until 9. I can't even press 10 because when i press 1 it automatically opens the text file. How can i write 2 digit numbers? Because the folder always will change and the might be 30 choices. Here's my code; @for %%a in (

Batch file choice command more than 10 parameter

痴心易碎 提交于 2021-01-01 13:53:43
问题 I have a batch script which founds which drive is carrying my folder (diskpart situation) and founding folder, then it lists the text files (for now its text) in that folder. Anyways the problem is while the batch is asking me to choose which one do i want to open, it works until 9. I can't even press 10 because when i press 1 it automatically opens the text file. How can i write 2 digit numbers? Because the folder always will change and the might be 30 choices. Here's my code; @for %%a in (

How to safely echo FOR variable %%~p followed by a string literal

不问归期 提交于 2021-01-01 05:00:50
问题 I have a variable %%p created from for /f command When i try to use it with some additional references like: %%~dp and then write some text afterwards it accesses a different variable set var="%%~dpabc.txt" Code outputs %%~dpa instead of %%~dp 回答1: So you must be using FOR /F with multiple tokens, like for /f "tokens=1-16" %%a in (file) do echo %%~dpabc.txt Or your code could have nested FOR loops. Something like for %%a in (something) do ( for %%p in (somethingelse) do ( echo %%~dpabc.txt )

How do you match an exact file extension under Windows/command line/file open dialog?

ε祈祈猫儿з 提交于 2021-01-01 04:53:17
问题 I am trying to get a directory listing of only files with a given extension. At first blush this seems to be a simple thing to do, however check out this simple example: C:\CODE\metcal>dir /b *.exe metcal.exe metcal.exe1 Notice that this returns metcal.**exe** and metcal.**exe1** as matches. With python files a similar thing happens: C:\CODE\metcal>dir /b *.py metcal.py metcal.pyc Notice again Windows has determined that *.py takes anything that starts with *.py so it captures the .pyc files

How do you match an exact file extension under Windows/command line/file open dialog?

孤人 提交于 2021-01-01 04:52:33
问题 I am trying to get a directory listing of only files with a given extension. At first blush this seems to be a simple thing to do, however check out this simple example: C:\CODE\metcal>dir /b *.exe metcal.exe metcal.exe1 Notice that this returns metcal.**exe** and metcal.**exe1** as matches. With python files a similar thing happens: C:\CODE\metcal>dir /b *.py metcal.py metcal.pyc Notice again Windows has determined that *.py takes anything that starts with *.py so it captures the .pyc files

Open file by dragging and dropping it onto batch file

柔情痞子 提交于 2020-12-31 22:00:13
问题 You know how if you drag and drop a files icon over a program or shortcut to a program it will open the file with that program? Well I have a batch that opens a program and what I want it to do is take a file that was dragged and dropped onto the batch files icon and open that file with the program the batch is pointing to. Is there any batch script that can do that? The reason I want to do this is that I have multiple files next to multiple shortcuts and I want to have those shortcuts just

Open file by dragging and dropping it onto batch file

不打扰是莪最后的温柔 提交于 2020-12-31 21:37:25
问题 You know how if you drag and drop a files icon over a program or shortcut to a program it will open the file with that program? Well I have a batch that opens a program and what I want it to do is take a file that was dragged and dropped onto the batch files icon and open that file with the program the batch is pointing to. Is there any batch script that can do that? The reason I want to do this is that I have multiple files next to multiple shortcuts and I want to have those shortcuts just

Is it possible to edit a binary file using Windows command line?

筅森魡賤 提交于 2020-12-29 06:39:37
问题 Is there a way in Windows to edit a binary file, from the command line? i.e. a way that could be written into a batch file? I want to be able to edit a single byte, at a known position, in an existing file. This existing question[1] is solved, but that's a Linux solution. I'm looking for something similar for Windows. Background There's a bug in GTA 1 when downloaded from Steam whereby the save-game data file gets corrupted on exit. As a result, the game can be played fine the first time but

How to escape schtasks /tr arguments

最后都变了- 提交于 2020-12-25 13:43:25
问题 I need to schedule a PowerShell task like following: powershell.exe -file ..\Execute\execute.ps1 And I have tried assigning it to an argument $Argument then pass it to schtasks like following: $Argument = "powershell.exe -file '..\Execute\execute.ps1'" schtasks /create /tn "SOE_Checks" /tr $Argument /sc DAILY /st 05:00 /ru "System" /rl HIGHEST /f but after running above code, nothing happened - while the task is created successfully, it appears not to run. I have also tried assigning it to